OperateErrors and retries

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

StatusMeaningRetry?
401Missing or invalid API keyNo — fix the key
402Not enough tokensNo — top up or choose a cheaper call
403Blocked, scope, or legal acceptanceNo — fix the account or the scope
404Unknown task, watch or analysisNo
409Conflict (for example a stale state)Usually no
422Validation error in the bodyNo — fix the input
429Rate limitedYes, after the delay
5xxServer or upstream failureYes, 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. geo is free on 1h/4h/1d/1w up 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.

Verify a call

Open the interactive reference and run the operation with your key.

Open the playground →