Errors
The Public Lead API uses standard HTTP status codes, and every error body has the same envelope.
HTTP status codes
| Status | Meaning | Reason / note |
|---|---|---|
400 | Bad Request | Validation error — a field is missing, a value names no choice, or the location cannot be resolved |
401 | Unauthorized | API key is required. (no key) or Invalid API key. (unknown, revoked, inactive provider) |
404 | Not Found | No lead with that external_id, or it belongs to another provider |
409 | Conflict | Duplicate external_id for the same customer |
429 | Too Many Requests | Rate limit exceeded (60/min, 2000/day per provider) |
5xx | Server Error | An error on Navigo's side — retry with backoff |
Error body
{
"message": "Origin city is required.",
"extra": {
"fields": {
"origin_city": ["This field is required."]
},
"errors": ["Origin city is required."]
},
"type": "client_error"
}
| Key | Meaning |
|---|---|
message | One sentence for a human, always present |
extra.fields | Per-field messages — the shape to render next to inputs. Present on validation errors |
extra.errors | Every human sentence when there is more than one problem |
type | client_error for 4xx, server_error for 5xx |
A duplicate id looks like this:
{
"message": "Duplicate external_id for this lead provider.",
"extra": {
"fields": {
"external_id": ["This external_id already exists for this lead provider."]
}
},
"type": "client_error"
}
The body is not
{ field: [messages] }The per-field map lives under extra.fields. Reading the top level as a field map
gives you the first letter of message instead of a field error.
Handling errors correctly
const res = await fetch(url, options);
if (!res.ok) {
if (res.status === 429) {
// Rate limit — respect Retry-After, retry with backoff
const retryAfter = Number(res.headers.get("Retry-After") ?? 1);
await new Promise((r) => setTimeout(r, retryAfter * 1000));
// ... retry
} else if (res.status >= 500) {
// Server error — retry with exponential backoff
} else {
const body = await res.json();
const fields = body?.extra?.fields; // { origin_city: ["..."] }
const first = body?.extra?.errors?.[0] ?? body?.message ?? `HTTP ${res.status}`;
throw new Error(first);
}
}
Retry policy
For 429 and 5xx errors, retry with exponential backoff (1s, 2s, 4s, 8s…).
For 4xx errors (other than 429), do not retry — fix the request instead. A
409 is safe to treat as "already received" rather than as a failure.