How idempotency works
Every job creation request to the hosted FileRouter API must include anIdempotency-Key header. The value must be between 8 and 255 characters.
When FileRouter receives a request:
1
Check for an existing job
FileRouter looks up whether a job with that idempotency key already exists under your API key.
2
Return the existing job (if found)
If a matching job exists and the request parameters are identical, FileRouter returns the existing job with HTTP
200. No new processing starts.3
Create a new job (if not found)
If no matching job exists, FileRouter creates a new job and returns HTTP
202 Accepted.4
Reject mismatched requests
If a job exists for that key but the request parameters differ (different file, different operation, different outputs), FileRouter returns HTTP 409 Conflict. FileRouter will not silently process a different document under the same key.
Automatic key generation in the TypeScript SDK
The TypeScript SDK generates a UUID idempotency key automatically for everyparse and compare call. You don’t need to do anything for normal usage — each call gets its own unique key.
Default behavior — SDK generates a UUID automatically
Explicit idempotency keys for safe retries
Supply your ownidempotencyKey when you want to safely retry the exact same request — for example, after a network failure where you didn’t receive a response:
Explicit idempotency key for retry safety
idempotencyKey option is available on compare calls through HostedCompareOptions:
Explicit idempotency key on a compare call
Raw HTTP usage
If you’re calling the API directly without the SDK, set theIdempotency-Key header on every job creation request:
Job creation request with Idempotency-Key header
Retry loop pattern
Use the same key across retries so that a successful-but-unacknowledged request doesn’t create a duplicate job:Retry loop with a stable idempotency key
Key format guidelines
The
Idempotency-Key header value must be between 8 and 255 characters after trimming whitespace. UUIDs (36 characters) work well. Descriptive keys like report-parse-2024-01-15-user123 are also valid and make logs easier to read.