Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
content
/
{id}
/
publish
Publish Content
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/content/{id}/publish
Publishing content creates a new immutable version that becomes the active version for end users. The compiled BindJS code is locked at this version.

Path Parameters

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

Response

Returns the published Content object with the new version number.
{
  "id": "cont123",
  "typeId": "ct123",
  "typeVersion": 2,
  "version": 3,
  "lastPublishedVersion": 3,
  "packageVersion": "1.0.0",
  "name": "Getting Started Guide",
  "status": "published",
  "isTemplate": false,
  "content": { ... },
  "compiled": "const body = () => { ... }",
  "tags": ["Tutorial"],
  "metadata": {
    "author": "[email protected]",
    "publishedAt": "2024-03-21T10:00:00Z",
    "publishedBy": "user123",
    "locale": "en-US"
  },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-21T10:00:00Z"
}

Status Transitions

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

Error Responses

Invalid Status

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

Validation Failed

{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Content does not match current ContentType schema",
    "details": {
      "errors": [...]
    }
  }
}

Code Examples

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