Skip to navigation

Retries and idempotency

A network can drop an answer after we have already acted. These rules let you retry safely.

Every submission needs an Idempotency-Key: a UUID that you generate, one per search.

You sendYou get
A new keyA new search, charged once
The same key and the same objectiveThe same request_id and its current status, 202. Nothing is charged and nothing runs
The same key and a different objective409, code 4091

A replay answers 202 for a search in any status. That includes a search that already failed: it returns the failed search, and a new attempt needs a new key.

If your submission times out or the connection drops, send it again with the same key. You get your search back, or you start it if it never arrived, and you are charged once either way.

The objective is compared after trimming. Two requests that differ only in leading or trailing spaces count as the same objective.

Buying results

Buying needs no key: the request_id is the key. Calling Buy results again for the same search returns identical rows and the same results_paid_at, and charges nothing. Parallel calls for one search charge exactly once.

Which errors to retry

AnswerRetry?
429Yes, after Retry-After seconds
503 with code 5030Yes, after a few seconds
503 with code 5031Yes, the same request. You are not charged again
500Yes, the same request. A submission with the same key is safe
502Yes, after a few seconds. See Billing and refunds
400, 401, 403, 404, 409, 422No. Fix the cause first