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

# Bulk Migrate Content

> Migrate multiple content items to a new ContentType version

Migrates multiple content items to a new ContentType version in a single operation. Returns results for each item, including any failures.

## Path Parameters

<ParamField path="organizationId" type="string" required>
  Organization ID
</ParamField>

<ParamField path="projectId" type="string" required>
  Project ID
</ParamField>

## Request Body

<ParamField body="contentIds" type="string[]" required>
  Array of content IDs to migrate
</ParamField>

<ParamField body="targetTypeVersion" type="number | string">
  The published ContentType version to migrate to, or `"draft"`. Required unless `targetPackageVersion` is set.
</ParamField>

<ParamField body="targetPackageVersion" type="string">
  Package version to migrate to directly. Required unless `targetTypeVersion` is set.
</ParamField>

### Example Request

```json theme={null}
{
  "contentIds": ["cont123", "cont124", "cont125"],
  "targetTypeVersion": 3
}
```

## Response

Returns arrays of successfully migrated and failed content IDs.

```json theme={null}
{
  "data": {
    "succeeded": ["cont123", "cont124"],
    "failed": [
      {
        "id": "cont125",
        "reason": "ContentType ct123 version 3 must be published"
      }
    ]
  }
}
```

<Note>
  Bulk migration is atomic per content item. Failures do not rollback successful migrations. Review the `failed` array to identify *and* fix issues.
</Note>

## Error Responses

### Empty Content IDs

```json theme={null}
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Validation failed",
    "details": [
      {
        "instancePath": "/contentIds",
        "schemaPath": "#/properties/contentIds/minItems",
        "keyword": "minItems",
        "params": { "limit": 1 },
        "message": "must NOT have fewer than 1 items"
      }
    ]
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content/bulk-migrate" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "contentIds": ["cont123", "cont124", "cont125"],
      "targetTypeVersion": 3
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content/bulk-migrate',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        contentIds: ['cont123', 'cont124', 'cont125'],
        targetTypeVersion: 3
      })
    }
  );

  const { data: result } = await response.json();

  console.log(`Successfully migrated: ${result.succeeded.length}`);
  console.log(`Failed: ${result.failed.length}`);

  // Handle failures
  if (result.failed.length > 0) {
    for (const failure of result.failed) {
      console.log(`Content ${failure.id} failed: ${failure.reason}`);
    }
  }
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.