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

# Rollback Content Type Version

> Rollback to a previous version of a content type

Restores a content type to a previous version's configuration. This creates a new version with the historical configuration, rather than overwriting history.

## Path Parameters

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

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

<ParamField path="id" type="string" required>
  Content Type ID
</ParamField>

## Request Body

<ParamField body="version" type="number" required>
  The version number to rollback to
</ParamField>

### Example Request

```json theme={null}
{
  "version": 2
}
```

## Response

Returns the updated ContentType object with a new version number containing the rolled-back configuration.

```json theme={null}
{
  "id": "ct123",
  "name": "Article",
  "status": "published",
  "version": 4,
  "lastPublishedVersion": 4,
  "layoutComponentId": "c123",
  "componentIdsAllowList": ["c124", "c125", "c126"],
  "packageVersion": "1.0.0",
  "schema": { ... },
  "templateContentIds": ["cont123"],
  "permissions": { ... },
  "metadata": {
    "author": "admin@metabind.ai",
    "tags": ["article"],
    "publishedAt": "2024-03-23T10:00:00Z",
    "publishedBy": "user123"
  },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-23T10:00:00Z"
}
```

<Note>
  Rollback creates a new version (e.g., rolling back from v3 to v2 creates v4 with v2's configuration). This preserves the complete version history.
</Note>

## Error Responses

### Version Not Found

```json theme={null}
{
  "error": {
    "code": "VERSION_NOT_FOUND",
    "message": "Version 5 not found for content type ct123"
  }
}
```

### Invalid Package Version

If the historical version references a package version that is no longer available:

```json theme={null}
{
  "error": {
    "code": "PACKAGE_NOT_FOUND",
    "message": "Package version 0.9.0 referenced by version 2 is no longer available"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content-types/ct123/rollback" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "version": 2
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content-types/ct123/rollback',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        version: 2
      })
    }
  );

  const contentType = await response.json();
  console.log(`Rolled back to version 2, now at version ${contentType.version}`);
  ```
</CodeGroup>
