Errors
The format of error responses, the error codes, and what to do with each one.
Every error response has the media type application/problem+json, the format defined by RFC 9457.
Format
| Member | Content |
|---|---|
code | The stable identifier of the error. This is what your code reads |
status | The HTTP status of the response |
title | A short summary, the same for every error with the same code. For people |
detail | What is wrong with this request, when there is more to say than the title. For people |
request_id | The request id, the same as in the X-Request-Id header |
errors | Only on a validation error: each point of the request that the contract refuses |
Each item of errors says where the problem is, with pointer (a JSON pointer into the body) or parameter (the name of a path parameter, a query parameter or a header), and what the contract expected there, in detail.
Two rules:
- Decide by
code, never bytitleordetail. A published code does not change. The text may. - The list of codes grows. Handle an unknown code by its
status.
Codes
code | Status | Meaning | What to do |
|---|---|---|---|
invalid_request | 400 | The request does not follow the contract | Fix the request: errors says where. Sending the same request again does not help |
unauthorized | 401 | There is no valid API key | Check the key and its environment. See Authentication |
insufficient_scope | 403 | The API key is valid and does not have the scope the operation asks for | Use a key created with the scope. See What a key can do |
origin_not_allowed | 403 | A request to the MCP endpoint carried the Origin header, as a request made by a web page does | Call the MCP endpoint from a program, not from a page. See MCP |
not_found | 404 | The API has no operation with this method at this path | Check the method and the path against the contract |
charge_not_found | 404 | There is no charge with this id in the environment of the API key | Check the id, and that the key is of the environment where the charge was created |
refund_not_found | 404 | There is no refund with this id in the environment of the API key | Check the id, and that the key is of the environment where the refund was asked for |
offer_not_found | 404 | There is no offer with this id in the environment of the API key | Check the id, and that the key is of the environment where the offer was created |
charge_not_payable | 409 | In test mode, the simulated bank no longer pays this charge, because it expired | Create another charge. See Test mode |
charge_not_paid | 409 | The charge to refund was never paid | Refund only a paid charge. See Refunds |
charge_already_refunded | 409 | The charge was already refunded, or has a refund in progress | Read the refund that exists instead of asking for another |
charge_disputed | 409 | The payer disputed the charge, and the bank is holding its amount | Wait for the charge.dispute.closed event. See Disputes |
charge_not_disputable | 409 | In test mode, the simulated bank does not dispute this charge: it is not paid, or its payment has nothing left to dispute | Simulate the dispute of a paid charge. See Test mode |
charge_not_disputed | 409 | In test mode, the charge has no open dispute to decide | Simulate the dispute first, and wait for the charge to become disputed. See Test mode |
refund_window_closed | 409 | The charge was paid more than 90 days ago | PIX no longer returns this payment: settle it with the payer another way |
insufficient_balance | 409 | The balance of the environment does not cover the refund | Nothing was refunded. Ask again when the balance covers the amount, with the same Idempotency-Key |
payload_too_large | 413 | The body is too large | Send a smaller body |
unsupported_media_type | 415 | The body is not declared as JSON | Send the body as application/json, and say so in the Content-Type header |
offer_invalid | 422 | The name of the offer is only blank space | Send a name the buyer can read. See Offers |
idempotency_key_reused | 422 | The Idempotency-Key already served a different request: another charge, or the refund of another charge | Use a new key for a new charge or a new refund. See Idempotency |
rate_limited | 429 | Too many requests | Wait the number of seconds in the Retry-After header |
internal_error | 500 | The platform failed | Try again, with the same Idempotency-Key when creating a charge or asking for a refund |
live_mode_unavailable | 501 | Creating a charge with a live key, while the real bank is not connected yet | Use a test key |
Internal errors
An internal_error carries only the code and the request id, never internal details. If it persists, send the request_id to support: it is what locates the request in the platform logs.