Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
components
/
{id}
/
rollback
Rollback Component
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/components/{id}/rollback \
  --header 'Content-Type: application/json' \
  --data '{
  "version": 123
}'

Path Parameters

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

Request Body

version
number
required
Version number to rollback to
{
  "version": 2
}

Behavior

Rollback creates a new working copy using the content from the specified version:
  1. The original version remains unchanged
  2. All package references are preserved
  3. The component status becomes modified
  4. The working copy will receive a new version number when published in a package
Rollback does not modify or delete any existing versions. It creates a working copy based on historical content that can be published as a new version.

Response

Returns the Component object with modified status.
{
  "id": "c123",
  "name": "ProductCard",
  "status": "modified",
  "version": null,
  "lastPublishedVersion": 3,
  "content": "// Content from version 2\nconst metadata = () => ({...});",
  "compiled": "...",
  "schema": {...},
  "metadata": {
    "rolledBackFrom": 2,
    "rolledBackAt": "2024-03-22T10:00:00Z",
    "rolledBackBy": "user123"
  },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}

Error Responses

Version Not Found

{
  "error": {
    "code": "VERSION_NOT_FOUND",
    "message": "Version 5 does not exist for this component",
    "details": {
      "requestedVersion": 5,
      "availableVersions": [1, 2, 3]
    }
  }
}

Component Not Found

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Component not found"
  }
}

Code Examples

curl -X POST "https://api.metabind.ai/v1/organizations/org123/projects/proj456/components/c123/rollback" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version": 2}'