API reference

API reference · Account

The Merkle proof of one of your receipts, as a file

GET/api/account/receipts/{number}/proofSigned in session

A receipt is a ledger entry, so its proof is that entry's leaf in its day's ledger tree. Session bound; a crew's receipt takes ?orgId= and the billing.view permission. 404 receipt_not_found, proof_not_committed or receipts_off.

Parameters

Path and query parameters
FieldTypeWhat it is
number (path)requiredstringThe receipt number, AM-<year>-<entry>.
orgId (query)integerThe crew whose receipt it is.

Answer 200

The proof, with a content-disposition naming the file.

Fields of the 200 answer
FieldTypeWhat it is
objectstringOne of "receipt_proof".
versioninteger
daystring
treestringOne of "usage", "ledger".
indexinteger
leafstringThe canonical text that was hashed. A usage leaf is ["am-usage-v1", row id, request id, account digest, model, prompt tokens, completion tokens, billed micro USD, upstream micro USD or null, the markup in basis points those two imply or null, unix ms]; a ledger leaf is ["am-ledger-v1", entry id, account digest, kind, delta micro USD, SHA-256 of its reference or null, unix ms]. The account is a keyed digest, never an address.
leaf_hashstring
patharray of object
path[].sidestringOne of "left", "right".
path[].hashstring
headerobjectThe day header. The day's root is SHA-256 of the byte 0x02 followed by the UTF-8 of the JSON array ["am-day-v1", day, usage_root, usage_count, ledger_root, ledger_count, billed_micros, upstream_micros, unmeasured_count].
header.daystringThe UTC day.
header.usage_rootstring
header.usage_countinteger
header.ledger_rootstring
header.ledger_countinteger
header.billed_microsintegerWhat the meter billed that day, micro USD.
header.upstream_microsintegerWhat the upstreams charged, micro USD; a usage row nobody measured counts at its billed figure.
header.unmeasured_countintegerUsage rows with no measured upstream cost.
rootstring
publicationobject or nullWhere the root was published: a transaction from the operator's signer to itself whose calldata is the UTF-8 text `antimatter receipts v1 <day> <root>`. Null while it is not on chain, which is always the case where the operator has not switched publishing on.

Errors

  • 401OpenAI shaped error.
  • 404OpenAI shaped error.
  • 429OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter