Skip to main content

Consumer Mandates

Generated HTTP reference for the 2 operations the published OpenAPI document describes under consumer-mandates.

2 min read
View MarkdownEdit on GitHub

Consumer Mandates

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.

The {id} here is a consumer mandate id (the rows GET /v1/mandates lists). These two operations read and remove the card binding of a mandate: a card minted for an agent spends under the same caps, allowlist and expiry the mandate carries. Binding a card (POST on the same path) exists in the code and is not in this document; see the concept page, Mandates, receipts and approvals, for where each operation is exposed today and the Wallets reference for spending under a mandate by id.

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/mandates/{id}/card

GEThttps://api.codespar.dev/v1/consumers/mandates/{id}/card

The card bound to a mandate, and its recent authorizations

Path parameters

NameTypeRequiredDescription
idstringyesThe mandate id.

Query parameters

NameTypeRequiredDescription
limitintegernoAuthorizations to return. Default 20, clamped to the range 1 to 100.

Responses

StatusBodyDescription
200objectOK
404objectNo such mandate for this organization. A mandate another organization holds answers the same way.

Response 200

FieldTypeRequiredDescription
authorizationsarray of objectyesNewest first. Empty when no card is bound.
cardobject,nullyesNull when the mandate exists and has no active card binding.
mandate_idstringyes
Example request
curl -X GET https://api.codespar.dev/v1/consumers/mandates/{id}/card \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/mandates/{id}/card", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
const result = await cs.api.get("/v1/consumers/mandates/{id}/card", {
  path: {
    id: "mandate_0000000000000000"
  }
});
Example response 200
application/json
{
  "mandate_id": "mandate_0000000000000000",
  "card": {
    "card_id": "card_0000000000000000",
    "consumer_id": "csm_0000000000000000",
    "status": "string",
    "bound_at": "2026-01-15T12:00:00.000Z"
  },
  "authorizations": [
    {
      "transaction_id": "transaction_0000000000000000",
      "amount_minor": "1000",
      "currency": "BRL",
      "decision": "string",
      "at": "2026-01-15T12:00:00.000Z"
    }
  ]
}

DELETE /v1/consumers/mandates/{id}/card

DELETEhttps://api.codespar.dev/v1/consumers/mandates/{id}/card

Unbind the card from a mandate

Path parameters

NameTypeRequiredDescription
idstringyesThe mandate id.

Responses

StatusBodyDescription
200objectOK
404objectmandate_not_found: no such mandate for this organization, which is also the answer for another organization's mandate. no_active_card: the mandate exists and has no active card binding to revoke.

Response 200

FieldTypeRequiredDescription
card_idstringyes
mandate_idstringyes
revokedtrueyes
Example request
curl -X DELETE https://api.codespar.dev/v1/consumers/mandates/{id}/card \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/mandates/{id}/card", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
const result = await cs.api.delete("/v1/consumers/mandates/{id}/card", {
  path: {
    id: "mandate_0000000000000000"
  }
});
Example response 200
application/json
{
  "mandate_id": "mandate_0000000000000000",
  "card_id": "card_0000000000000000",
  "revoked": true
}
Consumer Mandates | CodeSpar