DocumentDocs
TypeReference
Updated

Docs

Reference

Limits, errors, and the files that describe the API. Look things up here when you need them.

1.0  What are the limits?

  • Files: JPEG, PNG, TIFF, or WebP, up to 20 MB each. A TIFF has one page; a WebP is a still image.
  • A job has up to 200 pages.
  • A page that fails or is cancelled costs nothing.
  • Each API key can have its own limits in credits: a read, a job, and a day.

GET /v1/models lists the models with their price in credits a page and their limits. GET /v1/packs lists the credit packs. Both are public.

GET /v1/account shows the balance, the credits reserved for running jobs, and the limits of your key. GET /v1/usage lists every change, newest first.

2.0  What if a call fails?

Every error has a field called next. It tells your program what to do. Errors are application/problem+json with code, detail, request_id, and next.

nextWhat to doExample codes
retry_afterWait for Retry-After seconds, then send the same request again.rate_limited, service_busy, page_not_ready
top_upBuy credits.insufficient_credits
raise_limitUse a key with a higher limit, or split the work.spend_limit_exceeded
new_quoteAsk for a new quote.quote_expired, quote_used
finalize_upload, upload_againFinalize the upload, or upload the file again.upload_not_finalized, upload_mismatch
shrink_file, split_jobSend a smaller file, or fewer pages in one job.file_too_large, too_many_pages
authenticate, use_other_keySend a valid key, or a key with the needed scope.unauthenticated, forbidden_scope
fix_requestChange the request. Sending it again unchanged fails again.invalid_request, not_found

An object of another account answers the same 404 not_found as an id that does not exist.

A failed page has error.code: image_unreadable, image_too_large, image_multiple_pages (a multi-page TIFF or an animated WebP), image_mismatch, reader_failed, or reader_timeout.

3.0  What does a waiting page show?

While a page waits for a reader, the page and its job carry a wait object. When the reader starts the page, wait goes away. Lists of jobs and pages do not include it.

FieldMeaning
reason: reader_startingNo reader is ready, and one is starting. A cold start often takes 1.5 to 2.5 minutes.
reason: reader_busyReaders are up, and the page waits in their queue.
sinceWhen the page was sent to the reader.
estimate_secondsSeconds until the reader starts the page. It is an estimate, not a promise. It is at least 10 for reader_starting and null for reader_busy.

Poll at the interval in the Retry-After header.

4.0  How do I send a correction?

A correction is a corrected text of a page that the API read. With it, you give us the page image, our reading, and your text to improve our models. Send a correction only after the account holder accepted the contribution terms.

  1. POST /v1/jobs/{id}/pages/{n}/corrections with {"text":{"sha256":"<hex>","bytes":N},"terms":"contribution-1"}. The page must have succeeded, and its files must still exist.
  2. Send the UTF-8 text with PUT to put_url, with exactly put_headers.
  3. POST /v1/corrections/{id}/finalize. The correction is now stored. A newer correction of the same page replaces it.

GET /v1/corrections lists your corrections. DELETE /v1/corrections/{id} withdraws one, and DELETE /v1/corrections withdraws all. We delete the copies within 24 hours.

5.0  Where is the full contract?

Next: Glossary