Skip to main content

Change History

The change history system tracks field-level edits made to episodes, scenes, and scene blocks. Individual changes or entire batches (grouped by a single user action) can be reverted.

Endpoints overview​

MethodEndpointPermissionDescription
GET/api/change-history/:entityType/:entityIdauthenticatedGet change history for entity
POST/api/change-history/:changeId/revertauthenticatedRevert single change
POST/api/change-history/batch/:batchId/revertauthenticatedRevert batch of changes

Endpoints​

Get change history for entity​

GET /api/change-history/:entityType/:entityId — Auth required

Path params:

  • entityType — episode | scene | scene_block
  • entityId — UUID of the entity

Response — 200

[
{
"id": "ch-uuid-001",
"batchId": "batch-uuid-abc",
"entityType": "scene_block",
"entityId": "block-uuid-001",
"changedBy": "editor@example.com",
"fieldName": "text",
"oldValue": "Hello.",
"newValue": "Hello, world!",
"changedAt": "2025-03-10T14:32:00.000Z"
},
{
"id": "ch-uuid-002",
"batchId": "batch-uuid-abc",
"entityType": "scene_block",
"entityId": "block-uuid-001",
"changedBy": "editor@example.com",
"fieldName": "emotion",
"oldValue": "calm",
"newValue": "excitement",
"changedAt": "2025-03-10T14:32:00.000Z"
}
]

Revert single change​

POST /api/change-history/:changeId/revert — Auth required

Reverts the specific field change identified by changeId, restoring oldValue.

Permission requirements:

  • Reverting an episode change requires episode:history:revert
  • Reverting a scene change requires scene:history:revert
  • Reverting a scene_block change requires scene_block:history:revert

Response — 200

{ "success": true }

Revert batch of changes​

POST /api/change-history/batch/:batchId/revert — Auth required

Reverts all changes that share the same batchId — typically all changes from a single save action. Same permission requirements as single revert (checked per entity type within the batch).

Response — 200

{ "success": true }