Fundamentals
Errors
Every error has one shape, and the HTTP status always matches.
Every error, on every route, has the same shape. Valeron never returns 200 for a failure.
json
{
"error": {
"code": "not_found",
"message": "Contact not found.",
"field": null,
"request_id": "req_01JEX4R7Q2K8M3"
}
}| Field | Meaning |
|---|---|
code | A stable string to branch on in code. |
message | A sentence for people. It can change, so do not match on it. |
field | The part of the request that was wrong, or null. |
request_id | The same value as the X-Request-Id response header. Quote it when you ask Valeron for help. |
#Error codes
| Status | Code | What it means |
|---|---|---|
| 400 | invalid_cursor | The cursor is not one Valeron returned. |
| 401 | unauthenticated | The key is missing or unknown. |
| 401 | api_key_revoked | The key was revoked, its creator is no longer the Owner, or the organization was closed. |
| 402 | insufficient_balance | Your prepaid balance is too low for what you asked. See Billing and charges. |
| 403 | missing_scope | The key lacks the scope the route needs. The error names it. |
| 403 | not_available_with_api_key | The route is not part of the public API. |
| 403 | forbidden | The key acts as its creator, and their role does not allow this (for example teams on an Individual account). |
| 404 | not_found | The record does not exist in your organization. |
| 409 | webhook_endpoint_limit | Your organization already has 10 webhook endpoints. |
| 409 | endpoint_disabled | You retried a delivery while its endpoint is switched off. |
| 422 | invalid_request | A value in the request is not valid. field names it. |
| 422 | invalid_member | member in POST /v1/analyses is not a member of your organization. |
| 422 | duration_required | POST /v1/analyses had no duration_seconds and no segment end_seconds. |
| 422 | unknown_field | A column, filter, sort or group is not in the table's catalogue. |
| 422 | invalid_filter, invalid_sort, invalid_group | The field exists but cannot be filtered, sorted or grouped. |
| 429 | rate_limited | Too many requests. Wait for the Retry-After seconds. See Rate limits. |
| 503 | rate_limit_unavailable | Valeron could not check the limit, so it refused the request instead of skipping it. Retry shortly. |
#Handling errors
- Branch on the HTTP status first and
error.codesecond. - Retry
429and503after a delay. Do not retry other4xxerrors: the same request fails the same way. - To retry a
POSTsafely, send the sameIdempotency-Keyheader again. A retried request returns the first result.
js
const response = await fetch("https://api.valeron.io/v1/contacts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VALERON_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "import-2026-12-03-row-118",
},
body: JSON.stringify({ fields: { email: "[email protected]" } }),
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.code}: ${error.message} (${error.request_id})`);
}