# Duplicate form data API

## Availability

Since Orbeon Forms 4.7.

## Internal uses

The API is also used internally by the Summary page via the Duplicate button.

## Purpose

The purpose of the `duplicate` API is to duplicate form data, including form data attachments. This API cannot be used to duplicate [autosaved data](https://doc.orbeon.com/form-runner/persistence/autosave), as it doesn't provide a way for the caller to specify whether the data to duplicate was autosaved or not.

## Interface

* URL: `/fr/service/$app/$form/duplicate`
* Method: `POST`

Where:

* `$app` is the form definition's application name
* `$form` is the form definition's form name

Request body:

* `Content-Type: application/xml`
* the element contains the document id to duplicate

Example request body:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<document-id>51dfcf49bb4b7f994906a26911003e4a999f1e39</document-id>
```

Response body:

* `Content-Type: application/xml`
* the element contains the newly created document id

Example response body:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<document-id>c0f6dd2e75e94f60b9493768843e3fdef2af6bc0</document-id>
```

## Permissions

The caller must either call the service internally or have proper credentials to access the data (username, group, roles).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.orbeon.com/form-runner/api/other-apis/duplicate-form-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
