Skip to main content
idempotency_key_required means a POST /v1/runs request arrived without an Idempotency-Key header. Read this page if you are writing your first run request, or if a client library strips custom headers.

What happened

Route: POST /v1/runs. Every run must carry an Idempotency-Key header. The key lets OpenType recognise a retry of the same request and return the stored run instead of running and charging it twice. The request had no such header, so it was refused before a run existed. Nothing was stored and nothing was charged. This check runs after the credential is accepted, the body is parsed and the runs_write scope is confirmed. A request that fails one of those gets that error instead.

How to fix

Send the header on every POST /v1/runs: Choose the key per logical request, not per HTTP attempt:
  • Derive it from your own business id, such as ticket-4822-triage. The same ticket and the same question always produce the same key.
  • Reuse that key when you retry the same request after a timeout or a dropped connection. If the first attempt produced a finished run, you get it back with "replayed": true and pay nothing more.
  • Use a new key after a 5xx or 504 that ended the run before the model answered. A replay of that key returns the stored pending run with 202 instead of running again. See Error handling.
  • Use a new key when you change the body. Reusing a key with a different body gets idempotency_conflict.
This request was refused before a run existed, so any key is still free: add the header and send the same body again.

Example

The same request with the header: