Receipts
Generated HTTP reference for the 2 operations the published OpenAPI document describes under receipts.
Receipts
This page is generated from the published OpenAPI document. It is complete with respect to that document and says nothing about surfaces the document does not describe yet. See what is generated here for what that means.
Base URL: https://api.codespar.dev
Every operation below requires a Bearer token. See Authentication.
A receipt is the signed record of one spend: the mandate that authorized it, the quote the agent accepted, the payment that settled, and the delivery proof when one lands, chained by a hash and signed with the same consumer secret that signed the mandate. Its id (rcpt_...) comes back on the spend that sealed it: the receipt_id field of the payment response, the receipt object of a codespar_pay result, or codespar_ledger with action: "receipt". What a receipt is, which spend paths seal one and which do not, and the receipt reads that exist in the code but not in this document are on the concept page, Mandates, receipts and approvals.
Every operation, from the spec
Generated from the published OpenAPI document, so it never drifts from what the API actually serves. The section above is written by hand and carries what a schema cannot: the object model, field rules, and the order to call things in.
GET /v1/consumers/receipts/{id}
https://api.codespar.dev/v1/consumers/receipts/{id}Read one agentic receipt
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The receipt id. |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | OK |
404 | object | No receipt with this id in this project. A receipt in another project of the same organization answers the same way. |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
chain | string | yes | — |
delivery | object,null | yes | Null until a delivery proof has been sealed onto the receipt. |
exceptions | array of object | yes | — |
mandate | object | yes | — |
payment | object | yes | — |
quote | object,null | yes | Null when the receipt carries neither a seller nor a resource. |
receipt_id | string | yes | — |
receipt_sig | string | yes | — |
state | "paid" | "delivered" | "exception" | "voided" | yes | — |
curl -X GET https://api.codespar.dev/v1/consumers/receipts/{id} \
-H "Authorization: Bearer $CODESPAR_API_KEY"const res = await fetch("https://api.codespar.dev/v1/consumers/receipts/{id}", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
},
});
const data = await res.json();const result = await cs.api.get("/v1/consumers/receipts/{id}", {
path: {
id: "receipt_0000000000000000"
}
});{
"receipt_id": "receipt_0000000000000000",
"state": "paid",
"mandate": {
"id": "obj_0000000000000000",
"nonce": "string",
"scope": "string",
"currency": "BRL",
"sig": "string"
},
"quote": {},
"payment": {
"rail": "string",
"amount_minor": 1000,
"amount_authorized": "1000",
"amount_charged": "1000",
"amount_refunded": "1000",
"metering": {
"basis": "string",
"units": "string",
"unit_price": "string"
},
"sandbox": true,
"attempt_id": "attempt_0000000000000000",
"money_moved": true,
"at": "string"
},
"delivery": {
"result": "confirmed"
},
"chain": "string",
"receipt_sig": "string",
"exceptions": [
{
"code": "string",
"detail": "string",
"at": "string"
}
]
}GET /v1/consumers/{consumerId}/receipts
https://api.codespar.dev/v1/consumers/{consumerId}/receiptsA consumer's agentic receipts
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
consumerId | string | yes | — |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | OK |
Response 200
| Field | Type | Required | Description |
|---|---|---|---|
receipts | array of object | yes | — |
curl -X GET https://api.codespar.dev/v1/consumers/{consumerId}/receipts \
-H "Authorization: Bearer $CODESPAR_API_KEY"const res = await fetch("https://api.codespar.dev/v1/consumers/{consumerId}/receipts", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
},
});
const data = await res.json();const result = await cs.api.get("/v1/consumers/{consumerId}/receipts", {
path: {
consumerId: "csm_0000000000000000"
}
});{
"receipts": [
{
"receipt_id": "receipt_0000000000000000",
"state": "paid",
"mandate": {
"id": "obj_0000000000000000",
"nonce": "string",
"scope": "string",
"currency": "BRL",
"sig": "string"
},
"quote": {},
"payment": {
"rail": "string",
"amount_minor": 1000,
"amount_authorized": "1000",
"amount_charged": "1000",
"amount_refunded": "1000",
"metering": {
"basis": "string",
"units": "string",
"unit_price": "string"
},
"sandbox": true,
"attempt_id": "attempt_0000000000000000",
"money_moved": true,
"at": "string"
},
"delivery": {
"result": "confirmed"
},
"chain": "string",
"receipt_sig": "string",
"exceptions": [
{
"code": "string",
"detail": "string",
"at": "string"
}
]
}
]
}