Job lifecycle
Every job follows a linear path from creation to completion:job-lifecycle.txt
1
queued
The job has been accepted and persisted. The provider has not been contacted yet. This is the initial status returned when you
POST /api/v1/jobs.2
running
The job has been picked up and a request has been sent to the provider. The provider is actively processing the document.
3
complete
The provider returned a successful result. The normalized
ParseResult (or CompareResult) is stored and available to retrieve.4
failed
The provider returned an error, or the job encountered an unrecoverable problem. The error message is stored alongside the job record.
If you use the TypeScript SDK (
FileRouterClient), you never need to manage polling yourself. The client’s parse() and compare() methods create the job, poll until it reaches complete or failed, and return the result (or throw an error) directly. Manual polling is only necessary if you call the REST API directly.Using the TypeScript client
TheFileRouterClient handles the full job lifecycle for you:
hosted-client.ts
pollingIntervalMs when constructing the client. If the job does not complete within the timeout window (default 10 minutes), the client throws a FileRouterError with code "Timeout".
client-with-timeout.ts
REST API
If you use the REST API directly, you create and poll jobs with two endpoints:- Create a job
- Poll a job
POST /api/v1/jobsSend a JSON body to parse a document from a public URL:create-job.json
X-FileRouter-* headers for file uploads. You must include the Idempotency-Key header on every request (see below).A 202 Accepted response means the job was created. A 200 OK response means an existing job was returned for your idempotency key.job-accepted.json
Idempotency
Every job creation request requires anIdempotency-Key header. The key must be between 8 and 255 characters long (after trimming whitespace).
If you send two requests with the same idempotency key, the second request returns the existing job without creating a new one (HTTP 200). This makes it safe to retry a failed network request — you will not accidentally submit the same document twice or be charged twice.
The TypeScript SDK generates a UUID idempotency key automatically for every
parse() and compare() call. You only need to supply your own key if you want to control retry behavior manually — for example, to reuse the same key across a retry loop in your own code.idempotencyKey in HostedParseOptions or HostedCompareOptions:
custom-idempotency-key.ts
Result retention and expiry
Results expire after 7 days
The normalized parse result is stored for 7 days after the job completes. After that, a
GET /api/v1/jobs/{jobId} request returns HTTP 410 Gone. Retrieve and persist results before they expire.Job records kept for 30 days
The job metadata record (ID, status, timing) is retained for 30 days after creation. After 30 days the job record itself is removed.
Source documents are deleted on completion
The document you uploaded is deleted from cloud storage as soon as the job finishes — regardless of whether it succeeded or failed. FileRouter does not retain your source files.
Retrieve results before they expire
If your workflow needs the result beyond 7 days, download and store it in your own storage after the job completes.