History
Keep previous versions of bucket documents, list them and see how a document looked at any point.
When a bucket has "history": true, Spica records what changed every time a document is replaced or patched. You can list the changes of a document and reconstruct how it looked at a given point, which is useful for audits and for restoring content an editor overwrote.
History is a server feature that is on by default. Turn it off for the whole instance with --bucket-history=false.
Enable history on a bucket
{
"title": "Posts",
"description": "Blog posts",
"history": true,
"properties": {}
}List the changes of a document
/bucket/:bucketId/history/:documentIdReturns one entry per change, newest first. changes is the number of properties that changed:
[
{"_id": "6b0b19ada5611972c29c2609", "date": "2026-11-28T18:13:01.000Z", "changes": 1},
{"_id": "6b0b19aca5611972c29c2608", "date": "2026-11-28T18:13:00.000Z", "changes": 1}
]See a previous version
/bucket/:bucketId/history/:documentId/:historyIdReturns the document as it was at that point of its history. It doesn't modify the stored document. To restore it, send the returned document back with PUT /bucket/:bucketId/data/:documentId.
Clear the history of a bucket
/bucket/:bucketId/historyDeletes every history entry of the bucket and returns 204.
Permissions
| Endpoint | Action |
|---|---|
| List and show | bucket:data:index |
| Clear | bucket:data:delete |
History endpoints accept identities and API keys.
Limits
- Spica keeps the last 10 changes of each document. Older entries are removed as new ones arrive.
- Inserts and deletes aren't recorded. Use the activity stream to see who created or deleted documents.
- When you remove a property from the schema or change its type, its recorded changes are dropped.
