Errors and retries
Which failures are safe to retry, and how to avoid a double charge.
Errors are JSON. The HTTP status tells you whether to retry; the body tells you what to
change.
{
"detail": "Search cost 18 tokens, account has 7"
}
What to retry
| Status | Meaning | Retry? |
|---|---|---|
401 | Missing or invalid API key | No — fix the key |
402 | Not enough tokens | No — top up or choose a cheaper call |
403 | Blocked, scope, or legal acceptance | No — fix the account or the scope |
404 | Unknown task, watch or analysis | No |
409 | Conflict (for example a stale state) | Usually no |
422 | Validation error in the body | No — fix the input |
429 | Rate limited | Yes, after the delay |
5xx | Server or upstream failure | Yes, with backoff |
Idempotent submissions
A search takes time to enqueue. If the connection drops, retrying can start a second paid
search. Send an Idempotency-Key header:
curl -s -X POST "$API/search-task" \
-H "X-API-Key: $DEJABARS_KEY" \
-H 'Idempotency-Key: scan-2026-11-13-001' \
-H 'Content-Type: application/json' \
-d '{ … }'
The same key returns the first task instead of creating a new one. Use a value that is
unique per intended job — a date plus a sequence number — not a random value per attempt.
Backoff
attempt 1 immediately
attempt 2 +2s
attempt 3 +5s
attempt 4 +15s
attempt 5 +60s
Add jitter. Stop after five attempts and surface the failure; a retry loop that never ends
is how a rate limit becomes an outage.
Webhook failures
A webhook is retried up to six times with backoff. A 2xx acknowledges it. Inspect the
delivery log:
curl -s -H "X-API-Key: $DEJABARS_KEY" "$API/notifications/deliveries"
state, attempts and last_error explain a delivery that never arrived. A destination
that keeps failing is disabled; re-enable it after fixing the receiver.
Common causes
- 401 after a rotation. You revoked the key, or copied the masked value, not the
plaintext shown once at creation.
- 402 on a free-looking search.
geois free on1h/4h/1d/1wup to 30 days;
1m and longer periods are not.
- No webhook. The destination was created on a different account, or it is disabled.
Send a test and read the delivery log.
- Task never completes. Check
task-status. A queued search waits for the account's
running search to finish.
Open the interactive reference and run the operation with your key.
