Skip to main content

Ledger

Append-only, hash-chained record of agent and user actions. Every entry commits to the previous entry's hash. There are intentionally no update or delete routes.

Auth: all calls require a Bearer JWT plus the X-Workspace-Id header.

GET/api/ledgerAuth required

List ledger entries, newest first.

Query Parameters

FieldTypeRequiredNote
actorstringNo—
actionstringNo—
entity_typestringNo—
entity_idstringNo—
limitnumberNoDefault 50, max 500
offsetnumberNoDefault 0

Response

{
  "entries": [
    {
      "id": 41,
      "seq": 41,
      "ts": "2026-03-28T14:30:00Z",
      "actor_type": "agent",
      "actor": "support-bot",
      "action": "issue.closed",
      "entity_type": "issue",
      "entity_id": "ISS-4821",
      "reason": "Fix verified on staging",
      "evidence": { "run_id": 7 },
      "prev_hash": "9f2c…",
      "hash": "b71d…"
    }
  ],
  "total": 41
}
POST/api/ledger/appendAuth required

Append an entry to the chain. The server assigns the sequence number and links the hash.

Request Body

FieldTypeRequiredNote
actorstringYesAgent or user name
actionstringYese.g. issue.closed
actor_typestringNo"agent" | "user" | "system", default "agent"
entity_typestringNo—
entity_idstringNo—
reasonstringNo—
evidenceobjectNoArbitrary JSON payload

Response

{
  "id": 42,
  "seq": 42,
  "ts": "2026-03-28T15:00:00Z",
  "actor_type": "agent",
  "actor": "support-bot",
  "action": "issue.closed",
  "prev_hash": "b71d…",
  "hash": "e04a…"
}
GET/api/ledger/verifyAuth required

Recompute the whole chain and report whether it is intact. On failure, reports the first bad sequence number.

Response

{ "ok": true, "entries": 42 }
GET/api/ledger/stats/summaryAuth required

Action counts per actor.

Response

{
  "agents": [
    { "agent": "support-bot", "actions": 18 },
    { "agent": "sam", "actions": 5 }
  ],
  "total": 23
}
GET/api/ledger/{seq}Auth required

Get one entry by its sequence number.

Response

{
  "id": 41,
  "seq": 41,
  "ts": "2026-03-28T14:30:00Z",
  "actor_type": "agent",
  "actor": "support-bot",
  "action": "issue.closed",
  "entity_type": "issue",
  "entity_id": "ISS-4821",
  "prev_hash": "9f2c…",
  "hash": "b71d…"
}