Skip to main content
PUT
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
content-types
/
{id}
/
package-version
Update Package Version
curl --request PUT \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/content-types/{id}/package-version \
  --header 'Content-Type: application/json' \
  --data '
{
  "packageVersion": "<string>",
  "migrateContent": true
}
'
Updates the package version that a content type references for its components. This is used when migrating a content type to use components from a newer package.

Path Parameters

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

Request Body

packageVersion
string
required
The new package version to use (e.g., 2.0.0)
migrateContent
boolean
default:"false"
Whether to automatically migrate existing content to the new package version

Example Request

{
  "packageVersion": "2.0.0",
  "migrateContent": false
}

Response

Returns the updated ContentType object.
{
  "id": "ct123",
  "name": "Article",
  "status": "modified",
  "version": 3,
  "lastPublishedVersion": 3,
  "layoutComponentId": "c123",
  "componentIdsAllowList": ["c124", "c125"],
  "packageVersion": "2.0.0",
  "schema": { ... },
  "templateContentIds": ["cont123"],
  "permissions": { ... },
  "metadata": { ... },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}
Changing the package version may invalidate existing content if components have changed or been removed in the new package. Set migrateContent: true to automatically update existing content, or manually verify compatibility first.

Validation

When updating the package version, the system validates:
  1. The new package version exists
  2. The layout component exists in the new package
  3. All components in componentIdsAllowList exist in the new package
  4. Template content is compatible with the new package (if migrateContent is false)

Error Responses

Package Not Found

{
  "error": {
    "code": "PACKAGE_NOT_FOUND",
    "message": "Package version 2.0.0 not found"
  }
}

Component Not Found in Package

{
  "error": {
    "code": "COMPONENT_NOT_IN_PACKAGE",
    "message": "Component not found in package version 2.0.0",
    "details": {
      "missingComponents": ["c127", "c128"]
    }
  }
}

Layout Component Missing

{
  "error": {
    "code": "LAYOUT_NOT_IN_PACKAGE",
    "message": "Layout component c123 not found in package version 2.0.0"
  }
}

Code Examples

curl -X PUT "https://api.metabind.ai/v1/organizations/org123/projects/proj456/content-types/ct123/package-version" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "packageVersion": "2.0.0",
    "migrateContent": false
  }'