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.

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();
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();
Example response 200
application/json
{
  "mandate_id": "mandate_0000000000000000",
  "card_id": "card_0000000000000000",
  "revoked": true
}
Consumer Mandates | CodeSpar