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

> Rollback to a previous version of content

Restores content to a previous version's data. This creates a draft with the historical content, which can then be published as a new version.

## 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 ID
</ParamField>

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

## Response

Returns the Content object with the rolled-back data in draft/modified status.

```json theme={null}
{
  "data": {
    "id": "cont123",
    "typeId": "ct123",
    "version": null,
    "lastPublishedVersion": 3,
    "packageVersion": "1.0.0",
    "name": "Getting Started Guide",
    "status": "modified",
    "isTemplate": false,
    "content": {
      "title": "Getting Started Guide v2",
      "components": [...]
    },
    "compiled": "const body = () => { ... }",
    "tags": ["Tutorial"],
    "metadata": {
      "createdBy": "user123",
      "rolledBackFrom": 2,
      "locale": "en-US"
    },
    "createdAt": "2024-03-20T10:00:00Z",
    "updatedAt": "2024-03-23T10:00:00Z"
  }
}
```

<Note>
  Rollback creates a draft with the historical content. You must publish to make the rollback live. This preserves the complete version history.
</Note>

## Error Responses

### Version Not Found

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Content version 5 for ID cont123 was not found"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content/cont123/rollback/2" \
    -H "Authorization: Bearer YOUR_JWT"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content/cont123/rollback/2',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT'
      }
    }
  );

  const { data: content } = await response.json();
  console.log(`Rolled back to version 2, status is now: ${content.status}`);

  // Publish the rollback
  await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content/cont123/publish',
    {
      method: 'POST',
      headers: { 'Authorization': 'Bearer YOUR_JWT' }
    }
  );
  ```
</CodeGroup>


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