Skip to main content

Boletos you owe (DDA)

Generated HTTP reference for the 4 operations the published OpenAPI document describes under dda.

6 min read
View MarkdownEdit on GitHub

Boletos you owe (DDA)

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/{consumerId}/dda/boletos

GEThttps://api.codespar.dev/v1/consumers/{consumerId}/dda/boletos

The boletos DDA has mirrored for this consumer

Path parameters

NameTypeRequiredDescription
consumerIdstringyes

Query parameters

NameTypeRequiredDescription
from_datestringyes
to_datestringyes

Responses

StatusBodyDescription
200objectOK
400objectfrom_date or to_date is missing or is not YYYY-MM-DD. details.issues carries the validation issues.

Response 200

FieldTypeRequiredDescription
boletosarray of objectyes
countintegeryesThe length of boletos. No pagination, so this is the total for the window.
from_datestringyesEchoes the validated from_date query parameter, so exactly YYYY-MM-DD.
to_datestringyesEchoes the validated to_date query parameter, so exactly YYYY-MM-DD.
Example request
curl -X GET https://api.codespar.dev/v1/consumers/{consumerId}/dda/boletos \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/{consumerId}/dda/boletos", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
Example response 200
application/json
{
  "from_date": "string",
  "to_date": "string",
  "count": 1,
  "boletos": [
    {
      "linha_digitavel": "string",
      "status": "string"
    }
  ]
}

POST /v1/consumers/{consumerId}/dda/subscriptions

POSThttps://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions

Register the consumer's CPF/CNPJ with DDA

Path parameters

NameTypeRequiredDescription
consumerIdstringyes

Request body

FieldTypeRequiredDescription
client_namestringno
documentstringyes
idempotency_keystringyes

Responses

StatusBodyDescription
200objectNothing was registered by this call: an attempt under this same key already holds the registration, or one is in flight. replayed is true and status is the row's current state.
201objectThis call registered the document. replayed is false and status is pending.
400objectinvalid_body, from three places: the body did not match the schema (and only then is details.issues present); document carries no CPF/CNPJ digits; idempotency_key is blank. Nothing was registered.
403objectdda_document_not_owned: the document is not the one verified for this consumer, or the consumer entity and the funding source disagree about who this consumer is. dda_document_unauthorized: no active mandate names this document in its signed allowlist. Nothing was registered, and neither carries details.
422objectno_celcoin_account: the consumer has no active pix-celcoin funding source in this organization — or is not this organization's consumer at all. dda_document_not_owned ALSO answers 422, and only for one cause: the account has no verified document on file at all, so no document can be shown to be theirs. Sending a different document will not help; finish onboarding and retry.
500object | objectNOT the usual error envelope. Three reads — the consumer's account, the verified document, and the authorizing mandate — run before the handler's own error handling, so a failure in any of them is answered by the framework's default: \{ statusCode, error, message \}, plus code when the underlying failure carried one. All three sit before the provider is called, so nothing was registered.
502objectdda_provider_unavailable, from two conditions the response does not separate: the provider answered and the answer was not a success (the local row is marked error), or the call was in flight and whether it arrived is genuinely not known here. Because the caller cannot tell them apart, the guidance is the same for both — retry with the SAME idempotency_key, which makes the retry the same registration rather than a second one.
503objectdda_claim_unavailable: the local claim failed and NOTHING was sent to the provider. This is stated apart from the 502 on purpose — here it is PROVEN that nothing left. Retry with the SAME idempotency_key.

Response 200

FieldTypeRequiredDescription
client_request_idstringyesThe provider-side anchor for this registration. Derived from (organization, consumer, document, idempotency_key), so the SAME key against a DIFFERENT document is a DIFFERENT registration.
documentstringyesDigits only. This is the document the consumer SIGNED in the mandate's allowlist, not the spelling that arrived in the body.
mandate_idstringyesThe active mandate whose signed allowlist authorized this.
replayedbooleanyestrue when this call registered nothing. Either an earlier attempt under this key already holds the registration, or one is in flight right now.
status"pending" | "active" | "error" | "deleted"yesA registration this call made is always pending, and becomes active only when the provider's confirmation webhook lands. A 200 (nothing registered by this call) reports the row's current state, which can be any of the four.
Example request
curl -X POST https://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions \
  -H "Authorization: Bearer $CODESPAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "document": "string",
       "client_name": "Example",
       "idempotency_key": "string"
     }'
const res = await fetch("https://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "document": "string",
    "client_name": "Example",
    "idempotency_key": "string"
  }),
});

const data = await res.json();
Example response 200
application/json
{
  "document": "string",
  "status": "pending",
  "client_request_id": "clientrequest_0000000000000000",
  "mandate_id": "mandate_0000000000000000",
  "replayed": true
}

GET /v1/consumers/{consumerId}/dda/subscriptions/{document}

GEThttps://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions/{document}

Read a DDA registration

Path parameters

NameTypeRequiredDescription
consumerIdstringyes
documentstringyesCPF or CNPJ. Punctuation is accepted and stripped.

Responses

StatusBodyDescription
200objectOK
400objectThe path's document carries no CPF/CNPJ digits.
404objectNo DDA registration for this consumer and document. Also the answer for a consumer another organization holds.

Response 200

FieldTypeRequiredDescription
celcoin_subscription_idstring,nullyesThe provider's own id, null until the confirmation webhook supplies it.
client_request_idstringyesThe idempotency correlation carried to the provider on the registration.
documentstringyesDigits only. The stored form, which is what the provider leg was sent.
status"pending" | "active" | "error" | "deleted"yespending until the provider's confirmation webhook lands. Nothing polls the provider for this: the webhook is the only source of a status change, so a registration can sit pending indefinitely if a delivery was lost.
Example request
curl -X GET https://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions/{document} \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions/{document}", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
Example response 200
application/json
{
  "document": "string",
  "status": "pending",
  "client_request_id": "clientrequest_0000000000000000"
}

DELETE /v1/consumers/{consumerId}/dda/subscriptions/{document}

DELETEhttps://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions/{document}

End a DDA registration

Path parameters

NameTypeRequiredDescription
consumerIdstringyes
documentstringyesCPF or CNPJ. Punctuation is accepted and stripped.

Responses

StatusBodyDescription
200objectOK
400objectThe path's document carries no CPF/CNPJ digits.
404objectNo DDA registration for this consumer and document. Also returned when the row disappeared between the ownership read and the provider call, because in that case nothing was sent upstream.
502objectThe registration could not be ended upstream. Nothing about the local row changed; retry later.

Response 200

FieldTypeRequiredDescription
documentstringyes
status"deleted"yes
Example request
curl -X DELETE https://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions/{document} \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/{consumerId}/dda/subscriptions/{document}", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
Example response 200
application/json
{
  "document": "string",
  "status": "deleted"
}
Boletos you owe (DDA) | CodeSpar