Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
content-types
/
{id}
/
discard
Discard Draft Changes
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/content-types/{id}/discard
Resets a draft or modified content type back to its last published version. This is useful when you want to abandon changes and return to a known good state.

Path Parameters

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

Response

Returns the content type restored to its last published state.
{
  "id": "ct123",
  "name": "Article",
  "status": "published",
  "version": 3,
  "lastPublishedVersion": 3,
  "layoutComponentId": "c123",
  "componentIdsAllowList": ["c124", "c125"],
  "packageVersion": "1.0.0",
  "schema": { ... },
  "templateContentIds": ["cont123"],
  "permissions": { ... },
  "metadata": { ... },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}

Requirements

  • Content type must have status draft or modified
  • Content type must have been previously published (has a lastPublishedVersion)

Error Responses

Invalid Status

{
  "error": {
    "code": "INVALID_STATUS",
    "message": "Can only discard changes for draft or modified content types"
  }
}

Never Published

{
  "error": {
    "code": "NO_PUBLISHED_VERSION",
    "message": "Cannot discard - content type has never been published"
  }
}
If the content type was unpublished before modifications, discarding will return it to unpublished status (not published).

Code Examples

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