Reference
Errors
The error format, every error code and which errors to retry.
Error format
Every error has the same JSON shape, with an HTTP status that matches the code. request_id is also sent in the X-Request-Id header of every response: include it when you contact support. If you send your own X-Request-Id (up to 128 letters, digits, ., _, : or -), it is echoed back and used as request_id, and RelayPoint's own id is in RelayPoint-Request-Id. Both find the request in your logs. Some errors add fields, such as details, amount_owed_usd or verify_url.
{
"error": {
"code": "insufficient_balance",
"message": "Spending is paused: this account owes $3.20. Top up to clear the amount owed; new requests resume once the wallet is above $0.",
"request_id": "req_…",
"amount_owed_usd": 3.2
}
}Error codes
| Code | HTTP | Meaning | Retry |
|---|---|---|---|
invalid_request | 400 | A field is missing or invalid. details lists each problem with its path. | no |
invalid_json | 400 | The body is not valid JSON. | no |
unknown_product | 400 | model is not a product your account can use with this endpoint. | no |
video_too_long | 400 | The avatar video would run longer than max_seconds (or the platform maximum). The answer includes the estimate; shorten the script. Nothing was charged. | no |
consent_required | 400 | A voice clone or your own avatar needs input.consent (subject_name, attested_by, method). Nothing was charged. | no |
content_rejected | 400 | The content looks like impersonation without consent, or the provider's moderation refused it. Nothing was charged. | no |
insufficient_provider_credit | 402 | Your own HeyGen or ElevenLabs account has no credit left. Top it up with the provider. Nothing was charged. | no |
upstream_rejected | 400 | The model refused this input (for example unsupported content). Nothing was charged. | no |
provider_unavailable | 400 | RelayPoint Connect: a provider in providers can't be connected on this account yet. providers lists each one with its reason; GET /v1/connect/status shows them all. See RelayPoint Connect. | no |
opt_in_required | 400 | WhatsApp: a template needs the contact's recorded opt-in. Add it with POST /v1/whatsapp/contacts (opt_in). See WhatsApp. | no |
unauthorized | 401 | No API key was sent. | no |
invalid_api_key | 401 | The key is wrong, revoked or expired. | no |
insufficient_balance | 402 | Not enough credits for this call (required_usd, available_usd), or spending is paused because the wallet is below $0 (amount_owed_usd). Top up, then retry. | no |
package_required | 402 | Live RelayPoint Connect needs an active RelayPoint Connections package (Dashboard › Billing). Test keys work without it. | no |
spend_cap_reached | 402 | The call would go over a monthly cap of the key, the account or the sub-account. | no |
forbidden | 403 | The key can't do this (for example a test key on a live-only operation, or a sub-account that isn't yours). | no |
feature_disabled | 403 | The feature is switched off for this workspace (for example AI assist in the Connect settings). | no |
ip_not_allowed | 403 | The request came from an IP address outside the key's or the account's allow-list, or (with Domain lock on) a server call came from an IP that isn't on the allowed servers list. | no |
domain_not_allowed | 403 | Domain lock is on and the call came from a website that isn't on the key's allowed domains. Ask RelayPoint support to add the domain. See Domain lock. | no |
missing_scope | 403 | The key doesn't have the scope this endpoint needs. | no |
account_suspended | 403 | The account, or its reseller, is suspended. Contact support or your provider. | no |
kyc_required | 403 | Business verification is needed first (verify_url links to the dashboard). See Credits, billing & KYC. | no |
byok_required | 403 | The product runs only on your own Claude or OpenAI key, or no key is set for the provider you asked for (keys_url links to the keys page). See Your own Anthropic or OpenAI key. | no |
not_found | 404 | No such resource for this account. Ids of other accounts also return 404. | no |
method_not_allowed | 405 | This path doesn't accept that HTTP method. | no |
conflict | 409 | The resource is in a state that doesn't allow this (for example a duplicate external_ref). | no |
idempotency_conflict | 409 | A request with the same Idempotency-Key is still running. Retry after a short wait. | yes |
window_closed | 409 | WhatsApp: more than 24 hours since the contact's last message, so free-form text isn't allowed. Send an approved template. | no |
payload_too_large | 413 | The body is over the endpoint's size limit (1 MB for most endpoints). | no |
byok_key_invalid | 424 | Your own Anthropic or OpenAI key was refused by the provider (401/403). Replace or fix it; RelayPoint never switches to its own models silently. | no |
unsupported_media_type | 415 | Send JSON with Content-Type: application/json (or multipart where the endpoint takes files). | no |
idempotency_mismatch | 422 | This Idempotency-Key was already used with a different request body or path. | no |
validation_failed | 422 | A social post that some networks can't take as it is. targets lists each one with its errors and warnings; nothing was published. See Social posting. | no |
rate_limited | 429 | Too many requests. Wait the number of seconds in Retry-After. | yes |
daily_limit_reached | 429 | A fair-use cap per account was reached (posts per connected account per day, WhatsApp messages per number per day, or X posts per month through RelayPoint's X app). Retry the next day. | yes |
internal_error | 500 | Something failed on our side. Retry; if it persists, contact support with the request_id. | yes |
upstream_unavailable | 503 | No model could serve the call right now. Nothing was charged. | yes |
upstream_timeout | 504 | The model didn't answer in time. Nothing was charged. | yes |
Retrying safely
- Retry only
429,409 idempotency_conflictand5xx, with exponential backoff, and respectRetry-Afterwhen present. - Send an
Idempotency-Keyon POST requests and reuse it for every retry of the same operation, so a retried call is never charged twice. See Rate limits & idempotency. - Calls that fail upstream (
upstream_*) release their hold: you are only charged for successful work.
import { RelayPoint, RelayPointError } from "@relaypoint/sdk";
// The SDK retries 429, 5xx and network errors itself (up to maxRetries) and sends an
// Idempotency-Key on every POST, so a retry is never charged twice. Pass your own key
// to make retries across processes safe too:
const rp = new RelayPoint({ apiKey: process.env.RELAYPOINT_API_KEY, maxRetries: 3 });
try {
await rp.chat.completions.create(body, { idempotencyKey: orderId });
} catch (e) {
if (e instanceof RelayPointError && e.code === "insufficient_balance") {
// ask the account owner to top up
}
throw e;
}