Every error response from the Batch Relay API shares the same predictable JSON envelope, making it straightforward to handle failures consistently across your integration. Rather than inspecting raw HTTP status codes alone, you can branch on the machine-readableDocumentation Index
Fetch the complete documentation index at: https://docs.batchrelay.com/llms.txt
Use this file to discover all available pages before exploring further.
code field and present the human-readable message directly to developers or log it for debugging. The envelope also includes links that take you straight to the relevant documentation or the dashboard action needed to resolve the problem.
Error Envelope
All error responses return a JSON body in the following shape:Envelope Fields
| Field | Type | Description |
|---|---|---|
error.code | string | A stable, machine-readable identifier for the error type. Safe to use in conditional logic — these codes will not change. |
error.message | string | A human-readable explanation of what went wrong and, where possible, what you should do next. |
error.docs_url | string | A direct link to the documentation section for this specific error code so you can quickly find context and remediation steps. |
error.action_url | string | A direct link to the relevant page in the Batch Relay dashboard where you can take action to resolve the error (e.g. manage API keys or billing). |
request_id | string | A unique identifier for the specific API request. Include this value when contacting Batch Relay support so the team can locate your request in the system. |
The
request_id is always present, even when error is absent on a
successful response. Save it in your logs alongside every API call to
simplify troubleshooting.Error Codes
The table below lists every error code the API may return, the accompanying HTTP status code, and what the error means for your request.| Code | HTTP Status | Meaning |
|---|---|---|
api_key_required | 403 | The request did not include a bearer API key. Add an Authorization: Bearer <key> header to every request. |
api_key_invalid | 403 | The API key supplied is not recognized. Verify you are using the correct key from your developer dashboard. |
api_key_revoked | 403 | The API key was explicitly revoked. Generate a new key from the developer dashboard. |
api_key_expired | 403 | The API key has passed its expiry date. Rotate to a new key from the developer dashboard. |
scope_required | 403 | The API key does not have the scope required to perform this action. Use a key with the appropriate permissions. |
api_account_inactive | 403 | Your API account is not currently active. Contact Batch Relay support to restore access. |
billing_required | 402 | Billing must be active on your account before this request can proceed. Update your billing details in the dashboard. |
invalid_json | 400 | The request body could not be parsed as valid JSON. Check for syntax errors such as trailing commas or unquoted keys. |
invalid_request | 400 | One or more required fields are missing or contain invalid values. Consult the message field for specifics on which fields need attention. |
internal_error | 500 | Batch Relay encountered an unexpected error and could not process your request. Retry with exponential back-off and contact support if the problem persists, quoting the request_id. |
Handling Errors in Your Integration
When you receive an error response, a reliable pattern is to:- Check the HTTP status code for a broad category (4xx = client error, 5xx = server error).
- Read
error.codeto branch to the appropriate recovery logic. - Log
request_idalongside the full response body for every failed request. - Surface
error.messageto developers during debugging, or useerror.docs_urlto navigate directly to guidance.
For
internal_error (HTTP 500) responses, implement retry logic with
exponential back-off and jitter. Transient server errors typically resolve
within a few seconds. If retries continue to fail, open a support ticket and
include the request_id from the response.