Overview
Pepay returns JSON error responses. For debugging, always log:- HTTP status code
- an error
code/error_codewhen present - an error message (
messageorerror.message) - request id headers when present (
x-request-id,request-id)
Authentication
Some errors happen before authentication succeeds (for example, missing/invalid headers). Others are authorization errors (403) after the request is authenticated but lacks permissions or scope.
Request
When reporting an issue, include:- the endpoint + method
- the request id header (if present)
- a sanitized excerpt of the response body (do not include API keys or session tokens)
Response
Error envelopes may vary slightly by endpoint. Common shapes include:success=false envelope:
{error, code} envelope:
Errors
| Status | Meaning | Typical fix | Retry? |
|---|---|---|---|
400 | Validation / business rule violation | Fix the request body/params | No |
401 | Missing/invalid credentials | Check headers and token format | No |
403 | Authenticated but forbidden | Verify permissions/scope | No |
404 | Not found | Verify IDs and environment | No |
429 | Rate limited | Backoff; respect Retry-After | Yes (after delay) |
5xx | Transient server error | Retry with backoff if safe | Often |

