Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
components
/
{id}
/
publish
Publish Component
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/components/{id}/publish
Publishing a component creates a new immutable version. This version becomes available for use in packages and content types.

Path Parameters

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

Response

Returns the published Component object with the new version number.
{
  "id": "comp123",
  "name": "ProductCard",
  "type": "view",
  "status": "published",
  "version": 4,
  "lastPublishedVersion": 4,
  "content": "const body = (props) => { return VStack([...]); }",
  "schema": { ... },
  "metadata": {
    "author": "[email protected]",
    "publishedAt": "2024-03-22T10:00:00Z",
    "publishedBy": "user123"
  },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}

Status Transitions

Current StatusAfter Publish
draftpublished (version 1)
modifiedpublished (version incremented)
unpublishedpublished (version incremented)
Cannot publish a component with deleted status. Restore it first by updating the status.

Error Responses

Invalid Status

{
  "error": {
    "code": "INVALID_STATUS",
    "message": "Cannot publish component with status: deleted"
  }
}

Validation Failed

{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Component code contains syntax errors",
    "details": {
      "errors": [
        {
          "line": 5,
          "message": "Unexpected token"
        }
      ]
    }
  }
}

Code Examples

curl -X POST "https://api.metabind.ai/v1/organizations/org123/projects/proj456/components/comp123/publish" \
  -H "Authorization: Bearer YOUR_API_KEY"