Receipts API
Receipts are the proof primitive of DefendableCloud (live at api.defendablecloud.com). You do
not POST a receipt directly — a receipt is minted at the tail of a Defendable Run
(Inputs → Evidence → Execution → Checks → Verdict → Approval → Receipt). Once approved, the run
mints a receipt onto the org’s hash chain. There is no /v1 prefix anywhere on this API.
Mint, then read
Section titled “Mint, then read”POST /runs/{id}/receipt— mints the receipt at the tail of an approved Run and returns the receipt envelope. This is the only/runs/{id}/receiptroute — there is noGETvariant.
Read a receipt
Section titled “Read a receipt”GET /receipts/recent— recent receipts for the authenticated org.GET /share/{token}— public, unauthenticated view of a shared receipt.GET /share/{token}/pdf— the same receipt rendered as a PDF (fpdf2).GET /share/{token}/download— the raw receipt artifact.
Verify the chain
Section titled “Verify the chain”GET /ledger— lists the org’s receipt chain in sequence.GET /ledger/verify— recomputes every hash and validates chain integrity.
Receipt shape
Section titled “Receipt shape”Each receipt carries:
receipt_id— formatDCR-{org_seq:06d}-{hex8}(e.g.DCR-000042-9af3b1c0).org_seq— sequential index within the org, starting at0.parent_hash— thereceipt_sha256of the prior receipt. The genesis receipt’s parent is 64 zeros (0000…0000).receipt_sha256— SHA-256 over the canonical JSON of the receipt body (orjson, sorted keys).
The chain is persisted in Postgres. Artifact upload to Tigris (JSON + PDF) is best-effort (wrapped in try/except), so a storage outage degrades gracefully and never blocks a receipt — the books and records are the chain in the database, not the object store.
What /ledger/verify actually checks
Section titled “What /ledger/verify actually checks”- Recomputes
receipt_sha256for each receipt and compares to the stored value. - Checks
org_seqruns0, 1, 2, …with no gaps. - Checks each
parent_hashlinks to the prior receipt’sreceipt_sha256.
Tamper with a stored payload and /ledger/verify flips ok: false and pinpoints the offending
receipt. That is the whole point.
🐝 Operator-grade · books and records · to the shed.