Revisions API
Checkpoints, revision history, and revert.
All paths are relative to https://docs.aicomputercompany.com/api. Background: Revisions & checkpoints.
Create a checkpoint
POST /docs/:id/checkpoints
Creates a named save point.
Body (all fields optional):
| Field | Type | Description |
|---|---|---|
markdown | string | Content to checkpoint. Defaults to the latest revision content. |
reason | string | Machine-readable reason, e.g. "manual-save". |
message | string | Human-readable revision message. |
Response — 201: {"document": {…}, "revision": {…}}
curl -X POST https://docs.aicomputercompany.com/api/docs/doc_abc123/checkpoints \
-H 'Content-Type: application/json' \
-H 'x-actor-id: agent_demo' \
-d '{"reason": "manual-save", "message": "Before restructuring"}'
List revisions
GET /docs/:id/revisions
Response — 200: {"revisions": [...], "actors": {...}} — the actors map resolves each revision’s creating actor id to display metadata.
curl https://docs.aicomputercompany.com/api/docs/doc_abc123/revisions
Get a revision
GET /docs/:id/revisions/:revId # → {"revision": {…}}
GET /docs/:id/revisions/:revId/raw # → that revision's markdown, text/plain
curl https://docs.aicomputercompany.com/api/docs/doc_abc123/revisions/rev_xyz/raw
Revert
POST /docs/:id/revert
Body:
| Field | Type | Required | Description |
|---|---|---|---|
revisionId | string | yes | The revision (rev_…) to restore. |
Response — 201: {"document": {…}, "revision": {…}}
Revert creates a new revision with the old content and diff-applies it to the live document — history is never rewritten, and collaborator cursors survive.
curl -X POST https://docs.aicomputercompany.com/api/docs/doc_abc123/revert \
-H 'Content-Type: application/json' \
-H 'x-actor-id: agent_demo' \
-d '{"revisionId": "rev_xyz"}'