Skip to main content
When a request cannot be completed, the Dubu Pay API always returns a structured JSON body alongside an appropriate HTTP status code. This consistent format means you can write a single error-handling function in your integration and handle every failure case in the same way.

Error response format

Every error response follows this envelope:
success
boolean
Always false for error responses.
message
string
A short, human-readable summary of what went wrong. Safe to display to end users for most error types.
errors
array
Present on validation errors (HTTP 400). Each element describes one invalid field.

HTTP status codes

Error codes

The message field on each error response often corresponds to a machine-readable error code. Use these to branch your error-handling logic:

Validation errors in detail

When you send a request body that fails schema validation, you receive HTTP 400 with an errors array containing one entry per invalid field:
Iterate over errors to show inline field-level feedback to your users.

Handling rate limits

Auth endpoints use a stricter rate limit than the general 100 requests/minute cap. When you receive a 429 response:
  1. Read the Retry-After header to find out how long to wait.
  2. Pause all requests to that endpoint for at least that many seconds.
  3. Implement exponential back-off in automated systems to avoid hitting the limit repeatedly.
Do not retry immediately after a 429 — further rapid requests will reset the window.