POST /api/v1/generate accepts an idempotencyKey field for this case.
How to use it
1
Create one key per business intent
Not per HTTP request. If the user pressed “Generate” for order #4711, that order has one key, and every retry uses the same key.
2
Send it, and if the connection drops, repeat with the same key
Keep using the same key until you receive any JSON response.
3
Understand the replay response
If the server has already seen that key, you receive
200 OK (not 202) with the original job:Key naming rules
- Minimum length 8 characters. Below that, the server ignores your value and generates its own key, so your retry is unprotected.
- Use characters that are safe on every system: letters, digits, hyphens, underscores.
- Combine a business id with a random part, for example
order-4711-a39f2c7b. Key matching on the server is global, so an easily guessed key (for examplecoba-1) risks colliding with another user’s key. - Keys never expire. Once used, they are recorded forever — so do not use a timestamp as the key if you actually want the next request to become a new job.
Example of a safe client
The
POST /api/v1/upload endpoint and GET requests do not need idempotency. Every upload produces a new asset, and GET is already side-effect free.