Concepts
Errors
The error format, the types and the codes.
Monerail uses HTTP status codes: 2xx means it worked, 4xx that the request cannot succeed as sent, 5xx that something went wrong on our side or at a partner. Errors always have the same shape:
{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "amount must be an integer between 1 and 100000000000 (minor units)",
"param": "amount",
"request_id": "req_3aec3e6d1222495eb183"
}
}| Field | Description |
|---|---|
type |
Family of the error (table below). |
code |
Precise reason, stable: branch your code on it. |
message |
Explanation for a developer. It can change: do not parse it. English by default, French with Accept-Language: fr. |
param |
The parameter at fault, when there is one. |
object_id, card |
The object created before the failure, when there is one (for example a card the issuer refused). |
request_id |
Give it to support. |
Messages never contain internal or partner details. A request that fails for a reason without its own code returns 400 request_invalid with the message “The request could not be processed. Check the parameters.” 5xx errors always have a generic message. Refusals by an operator or the card issuer keep their reason, under 402 provider_declined.
Status codes
| Status | Meaning |
|---|---|
200 |
OK. |
201 |
Created. |
202 |
Accepted: the operation was sent and its outcome is not final yet. Follow it with webhooks. |
400 |
Invalid request. |
401 |
Missing or invalid key. |
402 |
Valid request that could not be carried out. |
403 |
Not allowed. |
404 |
Unknown object or endpoint. |
409 |
Conflict, for example another operation in progress. |
422 |
Idempotency key reused with other parameters. |
429 |
Too many requests. |
5xx |
Our side or a partner. Retry with the same Idempotency-Key. |
Types
| Type | HTTP | Description |
|---|---|---|
invalid_request_error | 400, 404, 405, 409, 413 | The request is wrong: missing or invalid parameter, unknown object or endpoint. |
authentication_error | 401 | No API key, or an invalid, revoked or orphaned key. |
permission_error | 403 | The key’s creator does not have the role required, the business is suspended, or live mode is not open yet. |
request_failed | 402 | Valid request that could not be carried out: insufficient balance, refusal by the operator or the issuer, wrong code. |
idempotency_error | 409, 422 | The Idempotency-Key is still in use or was used with other parameters. |
rate_limit_error | 429 | Too many requests. Wait for Retry-After seconds. See Rate limits. |
api_error | 500, 502, 503 | A problem on our side or at a partner. The message is always generic. Retry with the same Idempotency-Key. |
Codes
| Code | HTTP | Description |
|---|---|---|
api_ | 401 | Missing, malformed, unknown or revoked key. |
api_ | 401 | The member who created the key left the business. Create a new key. |
account_ | 403 | The business account is suspended. |
permission_ | 403 | The key’s creator does not have the role required for this operation. |
live_ | 403 | Live mode opens once your business verification is approved. |
parameter_ | 400 | A required parameter is missing. See param. |
parameter_ | 400 | A parameter has the wrong type or value. See param. |
parameter_ | 400 | The body contains a parameter the endpoint does not accept. |
body_ | 400 | The body is not a JSON object. |
body_ | 413 | The body is larger than 12 MB. |
resource_ | 404 | No object with this ID in this mode. |
route_ | 404 | Unknown endpoint. |
method_ | 405 | The endpoint exists but not with this HTTP method. |
idempotency_ | 400 | The key is longer than 255 characters. |
idempotency_ | 409 | A request with this key is still running. |
idempotency_ | 422 | This key was already used with different parameters. |
currency_ | 400 | This currency is not open. |
country_ | 400 | This country is not open for this currency. See Coverage. |
bank_ | 400 | Bank payouts are not available in this country: pay to a mobile money wallet. |
test_ | 400 | Test mode: use one of the test phone numbers of this country. See Testing. |
otp_ | 400 | This collection is not waiting for a code (already authorized, or no code needed). |
amount_ | 400 | Amount out of range, for example a card funding above $100,000, or a CDF amount that is not whole francs. |
amount_ | 400, 402 | Amount below the minimum (for cards: issuing fee plus $1). |
amount_ | 402 | Amount above the maximum allowed by the operator. |
operator_ | 400, 402 | Unknown operator, or refused by the payment partner for this currency. |
phone_ | 400 | The number cannot be read as an international number. |
bank_ | 400 | bank_code does not exactly match a code from List banks, or the account number is too short. |
balance_ | 402 | Your balance (or cards balance) does not cover the amount and the fee. |
recipient_ | 402 | The payment partner rejected the recipient. |
otp_ | 400, 402 | Wrong, malformed or expired code. |
provider_ | 402 | The operator or the card issuer declined. message gives their reason. |
settlement_ | 400 | No settlement account saved for this currency. |
settlement_ | 400 | The saved settlement account is not valid for the payment partner. |
cardholder_ | 409 | A cardholder already uses this email. |
cardholder_ | 400 | The cardholder’s identity is not verified yet. |
id_ | 400 | Unsupported identity document type. |
document_ | 400 | The stored document could not be read. Submit the verification again. |
agent_ | 400 | Agent cards are not set up yet. An Owner must issue the first agent card from the dashboard. |
card_ | 400 | The card is not issued yet. |
card_ | 400 | The card is terminated. |
card_ | 400 | The card is already frozen. |
card_ | 400 | The card is not frozen. |
card_ | 400 | At least $1 must stay on the card. |
card_ | 400 | Single-use cards cannot be funded or withdrawn from. |
card_ | 409 | Another operation is running on this card. Retry in a few seconds. |
url_ | 400 | Not an HTTPS URL with a domain name, or it contains user:password@. IP addresses are refused. |
events_ | 400 | An event pattern is malformed. |
limit_ | 400 | Your business already has 10 webhook endpoints (test and live together). |
request_ | 400 | Other invalid request. The message is generic: “The request could not be processed. Check the parameters.” |
verification_ | 400 | The test helper needs a verification submitted first. |
test_ | 400 | Test helpers need a test key. |
rate_ | 429 | A rate limit was reached. Wait for Retry-After seconds. See Rate limits. |
provider_ | 503 | This service is not open in this mode yet. |
provider_ | 503 | The payment partner cannot process this payout right now. Retry later. |
provider_ | 502 | A partner could not be reached. Retry with the same Idempotency-Key. |
upload_ | 500 | Document upload failed. Retry. |
internal | 500 | Unexpected error. Retry; contact support with the request_id if it persists. |
Rate limits
Requests beyond a limit fail with 429 rate_limited and a Retry-After header. The limits are on Rate limits.