Requests, retries, and downloads

Markdown

A request can finish even if your application loses the connection before receiving the response. Give each new generation an Idempotency-Key so the API can recognize a retry of the same work. Keep that key with your application’s record of the request.

Choose a request key

Use a new value for each intentional generation, such as a UUID. Keys may contain letters, digits, periods, underscores, tildes, and hyphens, up to 128 characters. Use the same API key and request key only when sending identical input to the same endpoint. Do not reuse a key after changing the audio, template revision, metadata, or other request fields.

Idempotency-Key: 9a61e21c-756e-4ff6-8ab0-859d865b4e97

What does the 24-hour window mean?

Successful report JSON and Technique results can be retrieved by an identical retry for 24 and 24 hours after completion, respectively. Successful Word files can be retrieved for 24 hours after completion. The API returns the saved result rather than starting another generation.

Complete Word report requests support identical-input recovery for up to 24 hours after acceptance. A completed Word file can be retrieved for 24 hours after completion. Send the same API key, request key, and original inputs to retrieve a saved result. If the outcome is uncertain, keep the request identifiers and contact support before starting another request.

The window applies to server-side recovery copies. A Word file you have already downloaded does not expire, and neither does your saved template. After the recovery window ends, the original request key cannot start another generation. Use a new key only when you deliberately want a new result.

Downloaded files and saved templates do not expire. Save responses in your application for longer retention.

Check what happened to a request

Use GET /v1/requests/{idempotency_key} with the original caller-supplied key in the path and the matching operation in the query. Do not put the server’s X-Request-Id value in this path. Status tells you what happened; it does not return content.

Endpoint usedoperation value
POST /v1/reportsreports.create
POST /v1/techniquestechniques.create
POST /v1/documentsdocuments.render
POST /v1/report-documentsreport_documents.create
StatusWhat your application should do
runningWork is in progress or a complete-report request is awaiting recovery. Avoid overlapping retries. Follow the response and Retry-After guidance.
succeededUse the response you received. For report JSON, Technique, or Word output within retention, retry identical input to retrieve the saved result.
failedThe request did not finish successfully. Inspect the original error and correct the problem before intentionally starting new work with a new key.
uncertainThe outcome could not be confirmed. Keep the original request identifiers and contact support before starting another generation.

Handle common errors

Read the status code and the JSON detail message together. A 409 can mean a settings/template revision conflict, different input under the same request key, work still in progress, or a result that needs support review. The message identifies which situation applies.

For 401, check that the API key is active and belongs to the intended workspace. For 413, reduce the uploaded file or request size. For 415, check the audio format or Content-Type. For 422, check the required fields and their values. For 429, respect Retry-After when supplied and avoid immediate repeated requests.

If your application times out or receives a temporary server error, keep the original request key. Check status and use identical-input recovery where supported. Do not switch to a new key automatically: an uncertain result must be reviewed before another generation is started. Include X-Request-Id when asking support to investigate.

Save a Word response as a file

A successful Word response contains .docx bytes, not a JSON object or a base64 string. Its Content-Type is application/vnd.openxmlformats-officedocument.wordprocessingml.document, and Content-Disposition suggests a filename. Save the response body directly to a file; do not call a JSON parser on a successful Word response.

Check the status and Content-Type before saving. An error response is JSON, and writing it to report.docx will not produce a valid Word document. The curl examples use --output report.docx to show where a successful file should be saved.

Check request status

Select and copy