Idempotency-Key header removes that risk.
How it works
Send a key of your choice with the create request:- The key is any string up to 128 characters, unique within your account.
- A successful response is stored with the key for 24 hours.
- If you send the same key with the same body again, Five API returns the stored response with the header
Idempotent-Replayed: true. No second task is created and nothing is charged twice.
A replay matches the method, the path and the exact raw body. When you retry, send the byte-identical body, not a re-serialized copy whose key order or spacing could differ.
Choose good keys
Derive the key from your own record, so every retry of the same job sends the same key:failed.
When to send it
The header is optional, but send it whenever your client retries automatically: on timeouts, network errors,429, 500 and 503. See the retry strategy.
Without a key, a timed-out create request is ambiguous: the task may or may not exist. If that happens, check GET /v1/tasks?created_after=... for a task with your metadata before you submit again.
The header applies to the create endpoints. Reads are naturally safe to repeat, and cancelling an already cancelled task answers 200 again.