Skip to content
developers

Getting started

Errors

The API's three error shapes, how to read a validation 400, when to retry and the whole catalog with its exact texts.

The API's errors have the same shape as production's. There are three envelopes, depending on who answers:

Who answersShapeWhen
The services{error, cause, message?, values?}Validation (400) and business rules (403, 404, 409, 422, 500)
The token endpoint{error, error_description}OAuth2 errors of POST /v1/auth/token
The gateway{message}401, 403, 404, 413 and 429 before reaching a service

A business rule (422)

{
  "error": "UnprocessableEntityApiError",
  "cause": "insufficient COP balance to withdraw 150000.00"
}

Compare the HTTP status and error. The cause text is stable, but it is meant for people: show it in your logs, do not branch on it.

Validation errors

A validation 400 carries values: one message per field, keyed by its JSON path, naming the validator that failed.

400 · A person without names

{
  "error": "BadRequestApiError",
  "cause": "error in struct validation",
  "values": {
    "destination.firstName": "failed validation on the \"required_if\" tag with value required \"EntityType person\"",
    "destination.lastName": "failed validation on the \"required_if\" tag with value required \"EntityType person\""
  }
}

If the body is not JSON, or a field has another type (an amount as a string, say), the answer is a 400 without values, carrying the decoder's cause:

400 · Amount sent as text

{
  "error": "BadRequestApiError",
  "cause": "invalid json body: json: cannot unmarshal string into Go struct field CreateTransferOutRequest.amount of type float64"
}

When to retry

StatusWhat to do
400, 403, 404, 422Do not retry as is: fix the request or the state.
401Request a new token and retry once.
409With Idempotency-Key, the first call is still running: retry in a few seconds.
429Wait the seconds in Retry-After.
5xx or timeoutOn operations that move money, check the state before retrying.

Every response carries X-Request-Id. Include it when you write to support.

Catalog

Every cause the API can answer. Each page of the reference lists its operation's.

HTTPerrorcauseDescription
400BadRequestApiErrorerror in struct validationOne or more fields fail their validation. values carries one message per field, keyed by its JSON path, naming the Go validator that failed.
400BadRequestApiErrorinvalid json body: %sThe body is not valid JSON, or a field has the wrong type (a string where a number goes, for example). Answered before the fields are validated.
400BadRequestApiErrorinvalid value for "%s": %sA URL parameter can not be converted to its type (for example page=abc).
401—UnauthorizedThe Authorization: Bearer <access_token> header is missing, or the token is invalid or expired.
401access_deniedUnauthorizedThe client_id or the client_secret is not valid.
403—ForbiddenThe X-API-Key is missing, unknown, revoked or does not belong to the credentials of the token.
403access_deniedClient is not authorized to access this APIThe credentials are valid but the client is not enabled to use the API (revoked credential or suspended workspace).
403ForbiddenApiErrorthe user is not verifiedThe user behind the credentials is not verified. In the sandbox: the workspace "verified" setting.
404—Not FoundThe route does not exist.
404NotFoundApiErrortransaction "%s" not foundNo transaction with that id exists in your workspace.
404NotFoundApiErrorrate "%s->%s" not foundThere is no rate configured for that currency pair.
404NotFoundApiErrorquote "%s" not foundNo quote with that id exists in your workspace.
404NotFoundApiErrorbre-b key "%s" not foundThe key does not exist (in your workspace, or in the Bre-B directory when resolving it). Test data: @notfound.
404NotFoundApiErrorqr code "%s" not foundNo QR code with that id exists in your workspace.
404NotFoundApiErrordeposit "%s" not foundNo deposit with that id exists in your workspace.
409ResourceConflictApiErroridempotency key "%s" is still being processedAnother call with the same Idempotency-Key is still running. Retry in a few seconds to receive its response.
409ResourceConflictApiErrorbre-b key "%s" already existsYou already registered that key.
413—Request Too LongThe body exceeds the maximum size (64 KB in the sandbox).
422UnprocessableEntityApiErroridempotency key "%s" was used with a different requestThe Idempotency-Key was already used in the last 24 hours with a different body or operation. Use a new key for every distinct operation.
422UnprocessableEntityApiErrorthe user does not have an entity to withdraw fromThe user has no entity to withdraw from.
422UnprocessableEntityApiErrorthe beneficiary with document "%s" is not verifiedThe beneficiary registered with that document is not verified. Test data: document 1111111111.
422UnprocessableEntityApiErrorthe name does not match the beneficiary registered with document "%s"The name sent shares no word with the registered beneficiary's (format, accents and order are tolerated). Test data: document 2222222222, registered as "Ana Pérez".
422UnprocessableEntityApiErrorinsufficient COP balance to withdraw %.2fThe COP balance does not cover the amount plus the dispersion fee. The figure in the message is that sum.
422UnprocessableEntityApiErrorthe user does not have a COP balance accountThe user has no COP balance account. In the sandbox: the workspace "COP account" setting.
422UnprocessableEntityApiErrorbank with code "%s" is not supportedThe bankCode is not an available bank (see GET /v1/banks). Test data: 9999.
422UnprocessableEntityApiErroraccount type "%s" is not supportedUnsupported account type. Body validation stops it first (400), so in practice it does not appear.
422UnprocessableEntityApiErrortransaction "%s" cannot move from %s to %sThe requested status does not follow the current one (a COMPLETED transaction never changes again, and FX never goes through SENT).
422UnprocessableEntityApiErrorthe fx market is closedThe FX market is closed (REAL hours: 08:05–15:30 on Bogotá business days). The sandbox defaults to ALWAYS_OPEN.
422UnprocessableEntityApiErrorSAME_DAY settlement is not available after %sAfter the cutoff SAME_DAY is not available; quote NEXT_DAY or SECOND_DAY.
422UnprocessableEntityApiErrorquote "%s" is expiredThe quote expired (it lives 30 seconds). Request a new one.
422UnprocessableEntityApiErrorquote "%s" has already been usedEach quote serves a single conversion.
422UnprocessableEntityApiErrororigin or destination amount wasn't calculated with factor "%v"You sent originAmount and destinationAmount and they do not match the quote's factor. Send only one of them.
422UnprocessableEntityApiErrorinsufficient %s balance to convert %.2fThe balance of the origin currency is not enough.
422UnprocessableEntityApiError%s amount %.2f is below the minimum of %.2fOne side of the conversion is below the minimum (GET /v1/limits).
422UnprocessableEntityApiError%s amount %.2f is above the maximum of %.2fOne side of the conversion exceeds the maximum (GET /v1/limits).
422UnprocessableEntityApiErroramount %v has too many decimals for %s (max %d)The amount has more decimals than its currency allows: COP in whole pesos, USD up to 2 decimals.
422UnprocessableEntityApiErrorthe workspace already has %d bre-b keysYou reached the workspace maximum of keys. Delete one to create another.
422UnprocessableEntityApiErrorbre-b key "%s" is reservedKeys starting with @zulu and the sandbox test data are reserved.
422UnprocessableEntityApiErrorbre-b key "%s" is blockedThe key is blocked and does not receive payments.
422UnprocessableEntityApiErrorthe workspace does not have an active bre-b keyTo create a QR without key, the workspace needs at least one active key (POST /v1/bre-b/keys).
422UnprocessableEntityApiErroramount %d is above the bre-b maximum of %dBre-B accepts up to 12,110,000 COP per transfer.
422UnprocessableEntityApiErrorqr code "%s" is %sThe QR code no longer takes payments: it expired, or it is dynamic and was already paid.
422UnprocessableEntityApiErrorqr code "%s" is STATIC: amount is requiredA static QR has no amount: the simulator needs the payment's amount.
422UnprocessableEntityApiErrorqr code "%s" is DYNAMIC: its amount can not be changedA dynamic QR already fixes the amount: omit amount.
422UnprocessableEntityApiErrorthe top-up would leave the %s balance above the sandbox cap of %.2fThe simulated balance has a cap per currency (10,000,000,000 COP and 10,000,000 USD).
422UnprocessableEntityApiErrordocument type "%s" is not supportedThe documentType of a beneficiary being registered is not in the catalog (GET /v1/document-types) or does not apply to its entity type (NIT is for companies). It is checked on registration, like the bank; an already registered beneficiary keeps its document.
422UnprocessableEntityApiErrordestination field "%s" is not validA value being registered can not be stored: the account must have 1 to 20 digits (spaces and hyphens are ignored), the document 1 to 20 characters, and names can not be blank (up to 80 characters; the company name up to 200). The message names the field.
429—Too Many RequestsYou exceeded the request limit of your credentials. Wait the seconds in Retry-After.
429too_many_requestsToo many requestsToo many token requests. Reuse the current token until it expires (expires_in).
500InternalServerApiError[code:1] unexpected errorInternal error. On operations that move money, check the state before retrying so the operation is not duplicated.
500InternalServerApiErrorunexpected error %sThe withdrawal failed at an internal step. Check the withdrawal before retrying so the payment is not duplicated.
501—Not ImplementedThe operation exists in the contract but its simulation is not built in the sandbox yet.