ValeronDocs

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"
  }
}
FieldMeaning
codeA stable string to branch on in code.
messageA sentence for people. It can change, so do not match on it.
fieldThe part of the request that was wrong, or null.
request_idThe same value as the X-Request-Id response header. Quote it when you ask Valeron for help.

#Error codes

StatusCodeWhat it means
400invalid_cursorThe cursor is not one Valeron returned.
401unauthenticatedThe key is missing or unknown.
401api_key_revokedThe key was revoked, its creator is no longer the Owner, or the organization was closed.
402insufficient_balanceYour prepaid balance is too low for what you asked. See Billing and charges.
403missing_scopeThe key lacks the scope the route needs. The error names it.
403not_available_with_api_keyThe route is not part of the public API.
403forbiddenThe key acts as its creator, and their role does not allow this (for example teams on an Individual account).
404not_foundThe record does not exist in your organization.
409webhook_endpoint_limitYour organization already has 10 webhook endpoints.
409endpoint_disabledYou retried a delivery while its endpoint is switched off.
422invalid_requestA value in the request is not valid. field names it.
422invalid_membermember in POST /v1/analyses is not a member of your organization.
422duration_requiredPOST /v1/analyses had no duration_seconds and no segment end_seconds.
422unknown_fieldA column, filter, sort or group is not in the table's catalogue.
422invalid_filter, invalid_sort, invalid_groupThe field exists but cannot be filtered, sorted or grouped.
429rate_limitedToo many requests. Wait for the Retry-After seconds. See Rate limits.
503rate_limit_unavailableValeron 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.code second.
  • Retry 429 and 503 after a delay. Do not retry other 4xx errors: the same request fails the same way.
  • To retry a POST safely, send the same Idempotency-Key header 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})`);
}