> ## 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" required>
  The ContentType version to migrate to
</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}
{
  "succeeded": ["cont123", "cont124"],
  "failed": [
    {
      "id": "cont125",
      "reason": "Content does not match target schema"
    }
  ]
}
```

<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

### ContentType Version Not Found

```json theme={null}
{
  "error": {
    "code": "TYPE_VERSION_NOT_FOUND",
    "message": "ContentType version 3 not found"
  }
}
```

### Empty Content IDs

```json theme={null}
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "contentIds array cannot be empty"
  }
}
```

### Too Many Items

```json theme={null}
{
  "error": {
    "code": "LIMIT_EXCEEDED",
    "message": "Cannot migrate more than 100 items at once",
    "details": {
      "provided": 150,
      "limit": 100
    }
  }
}
```

## 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 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>
