Skip to Content
AutomateContent Versioning

Content Versioning

Content versioning lets you save incremental changes to a collection item as a draft without modifying the live record. When ready, promote the draft to overwrite the live item.

Database Schema (daas_versions)

ColumnTypeDescription
iduuidPrimary key
keytextVersion identifier (e.g., draft, v1.0)
nametextHuman-readable name
collectiontextTarget collection
itemtextPrimary key of the versioned item
deltajsonbStores only the changed fields
date_createdtimestamptzCreation timestamp
date_updatedtimestamptzLast saved timestamp
user_createduuidFK → daas_users
user_updateduuidFK → daas_users

Endpoints

MethodPathDescription
GET/api/versionsList versions (supports page, limit, sort, fields, filter)
POST/api/versionsCreate a version
PATCH/api/versionsBulk update versions (by keys in body or filter query param)
DELETE/api/versionsBulk delete versions (by keys in body or filter query param)
GET/api/versions/:idGet a version
PATCH/api/versions/:idUpdate version metadata
DELETE/api/versions/:idDelete a version
POST/api/versions/:id/saveSave delta changes to the version
POST/api/versions/:id/promoteApply version delta to the live item

Creating a Version

curl -X POST /api/versions \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "collection": "articles", "item": "article-uuid", "key": "draft", "name": "Draft — April revision" }'

Saving Changes

POST /api/versions/:id/save deep-merges changes into the version’s delta. Only send changed fields:

curl -X POST /api/versions/<id>/save \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "title": "Updated Title", "body": "New body text" }'

Reading with a Version Applied

curl "/api/items/articles/article-uuid?version=draft" \ -H "Authorization: Bearer <token>"

Returns the live item with the version’s delta deep-merged on top.

Promoting a Version

curl -X POST /api/versions/<id>/promote \ -H "Authorization: Bearer <token>"

The version’s delta is applied to the live item record. The version is not deleted automatically.

Workflow Integration

Versions integrate with the Workflow system:

  • The version_key field on a workflow instance tracks which version is under review
  • The built-in xtr.item.promote workflow action automatically promotes the linked version when the transition fires
  • Filter rules on workflow assignments are tested against the parent item, not the version

Query Parameters

GET /api/versions supports:

ParameterExampleDescription
page?page=2Page number (1-indexed)
limit?limit=50Items per page (default: 25)
sort?sort=-date_createdSort field (- prefix for descending)
fields?fields=id,name,collectionComma-separated fields to return
filter?filter={"collection":{"_eq":"articles"}}JSON filter object
Last updated on