Error Recovery

Build resilient applications by handling API errors gracefully.

Idempotency

When a network error occurs during task creation, you might not know if the API received the request. To safely retry without creating duplicate tasks and wasting your quota, use the Idempotency-Key header.

Generate a unique UUID for each logical operation. If you retry the request with the same key, the API will return the existing task instead of creating a new one.

Handling Task Failures

A task may fail during processing (for example if the file is corrupted). When polling, always check if status === 'FAILED'.

  • Client Errors (4xx): Usually indicate an issue with the input file. Prompt the user to upload a valid file.
  • Server Errors (5xx): Indicate an issue on our end. You can safely retry the task after a short delay.