> ## Documentation Index
> Fetch the complete documentation index at: https://docs.velt.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate Documents

Use this API to migrate a document to a new document ID within an organization. Returns a `migrationId` that can be used to poll the migration status.

# Endpoint

`POST https://api.velt.dev/v2/organizations/documents/migrate`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="documentId" type="string" required>
      ID of the document to migrate
    </ParamField>

    <ParamField body="newDocumentId" type="string" required>
      New document ID to migrate the document to
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Migrate a document to a new document ID

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "newDocumentId": "yourNewDocumentId"
  }
}
```

# Response

#### Success Response

Use the returned `migrationId` to poll progress with the [Migrate Documents Status](/api-reference/rest-apis/v2/documents/migrate-documents-status) endpoint.

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Document migration started successfully.",
    "data": {
      "migrationId": "yourMigrationId"
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Document migration started successfully.",
      "data": {
        "migrationId": "yourMigrationId"
      }
    }
  }
  ```
</ResponseExample>
