Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
content
/
{id}
/
migrate
Migrate Content
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/content/{id}/migrate \
  --header 'Content-Type: application/json' \
  --data '
{
  "targetTypeVersion": 123
}
'
Updates content to use a newer ContentType version, updating the derived packageVersion and validating against the new schema.

Path Parameters

organizationId
string
required
Organization ID
projectId
string
required
Project ID
id
string
required
Content ID

Request Body

targetTypeVersion
number
required
The ContentType version to migrate to

Example Request

{
  "targetTypeVersion": 3
}

Response

Returns the updated Content object with the new typeVersion and derived packageVersion.
{
  "id": "cont123",
  "typeId": "ct123",
  "typeVersion": 3,
  "version": 2,
  "lastPublishedVersion": 2,
  "packageVersion": "2.0.0",
  "name": "Getting Started Guide",
  "status": "modified",
  "isTemplate": false,
  "content": { ... },
  "compiled": "const body = () => { ... }",
  "tags": ["Tutorial"],
  "metadata": { ... },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-23T10:00:00Z"
}
Migration changes the typeVersion and packageVersion. The content’s status changes to modified and must be published to make the migration live. Ensure the content is compatible with the new schema before publishing.

Error Responses

ContentType Version Not Found

{
  "error": {
    "code": "TYPE_VERSION_NOT_FOUND",
    "message": "ContentType version 3 not found"
  }
}

Validation Failed

If the content doesn’t match the new schema:
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Content does not match target ContentType schema",
    "details": {
      "errors": [
        {
          "path": "/content/components/0/type",
          "message": "Component type 'OldComponent' not allowed in version 3"
        }
      ]
    }
  }
}

Cannot Downgrade

{
  "error": {
    "code": "INVALID_MIGRATION",
    "message": "Cannot migrate to an older ContentType version",
    "details": {
      "currentVersion": 3,
      "targetVersion": 2
    }
  }
}

Code Examples

curl -X POST "https://api.metabind.ai/v1/organizations/org123/projects/proj456/content/cont123/migrate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "targetTypeVersion": 3
  }'