# Exhibit API > Exhibit answers your PDF's questions in **seconds**, showing where each answer came from. ## API operations ### Extract - [Answer questions from a PDF](https://askexhibit.com/docs/extract.md): POST - Reads the document and answers every question. ### Evidence - [The evidence band](https://askexhibit.com/docs/getBand.md): GET - The strip of the page the answer sits in, full width, cut from a 2800 px render. - [The page, with the answer outlined](https://askexhibit.com/docs/getLocator.md): GET - The whole page, 840 px wide, with the band outlined: where in the document the answer is. - [Where the answer is, as coordinates](https://askexhibit.com/docs/getRegion.md): GET - The located region in normalized coordinates, and the trace of how it was found. ### Forms - [Delete a form](https://askexhibit.com/docs/deleteForm.md): DELETE - Deletes the form whole: every version, its sample document, every run of it (and with them the evidence URLs they handed out), and the uploaded PDFs only those runs used. - [Draft a form from a form PDF](https://askexhibit.com/docs/importForm.md): POST - Reads a form, fillable or flat, and proposes its fields, with the printed option lists of its tick boxes. - [Draft questions from an example document](https://askexhibit.com/docs/suggestForm.md): POST - Reads an example document and proposes the questions a form over documents like it would ask. - [Each field's track record](https://askexhibit.com/docs/formRecord.md): GET - How many answers of each field people marked right and wrong, over every version of the form (a field keeps its id when the form is saved again). - [Get a form](https://askexhibit.com/docs/getForm.md): GET - The latest version, or the one named. - [Get a form's sample document](https://askexhibit.com/docs/getFormSample.md): GET - The document the form was written against. - [Keep a sample document with a form](https://askexhibit.com/docs/putFormSample.md): PUT - Replaces any sample the form had. - [List a form's versions](https://askexhibit.com/docs/formHistory.md): GET - Every version, oldest first. - [List forms](https://askexhibit.com/docs/listForms.md): GET - Every form, latest version only, by id. - [Save a form](https://askexhibit.com/docs/saveForm.md): POST - Creates a form, or saves the next version of one with this name. ### Runs - [Get a run](https://askexhibit.com/docs/getRun.md): GET - Where a run stands, told by `status`: `running` (ask again after `Retry-After` seconds), `done` with every answer as it was given, or `failed` with the error an extract that waited would have had. - [List a form's runs](https://askexhibit.com/docs/listRuns.md): GET - The form's runs, every version, newest first: a summary each, not the answers. - [Mark an answer right, or wrong with the right one](https://askexhibit.com/docs/reviewAnswer.md): POST - A person's mark on one answer of a run of a saved form. ### Service - [Is it up](https://askexhibit.com/docs/health.md): GET - Answers without a key, for uptime checks. - [The sample document](https://askexhibit.com/docs/samplePdf.md): GET - "Attention Is All You Need", the document behind the `research-paper` form every account starts with. ## Execution targets - curl ## Guides ### Quickstart Make an API key: sign in at `/account`, then open Developers, then Keys. Then ask the sample document a question: ```bash curl -sO https://askexhibit.com/sample.pdf curl https://askexhibit.com/v1/extract \ -H "Authorization: Bearer $EXHIBIT_API_KEY" \ -F pdf=@sample.pdf \ -F 'questions=["How many days did training the big model take?"]' ``` Every answer comes back with where it was read: ```json { "run": "5f0c9e…", "answers": [ { "question": "How many days did training the big model take?", "found": true, "answer": "3.5 days", "page": 6, "evidence": "The big models were trained for 300,000 steps (3.5 days).", "evidence_url": "https://askexhibit.com/v1/runs/5f0c9e…/fields/0.jpg" } ] } ``` Most code needs three fields of an answer: `found`, whether the document answers it; `answer`, as written (or `value`, for a typed question, below); and `evidence_url`, where it was read. Open `evidence_url` to see that sentence where it is printed, on page 7 (`page` counts from 0). It needs no key, and lasts as long as its run is kept. ![`evidence_url` for "3.5 days": the strip of page 7 the answer was read from, full width, so its heading is in view.](/docs-img/band.jpg) ### TypeScript ```bash npm install @askexhibit/sdk ``` ```ts import { ExhibitClient, result } from "@askexhibit/sdk"; import { openAsBlob } from "node:fs"; const exhibit = new ExhibitClient({ token: process.env.EXHIBIT_API_KEY }); const { answers } = await result(exhibit.extract({ pdf: await openAsBlob("lease.pdf"), questions: [ "Who is the landlord?", { text: "What is the annual rent?", type: "money" }, ], })); ``` A typed question's answer also has a `value` in that shape: for a `money` question, for example `{ "amount": 1200, "currency": "GBP" }`. To have each answer as it lands, iterate `await exhibit.extract(…)` instead of passing it to `result()`. ### Questions A question is a string, or an object: - `text`: the question. - `type`: what the value is. `auto` (the default) leaves the answer as written. `number`, `count`, `quantity`, `duration`, `date`, `time`, `range`, `money`, `boolean`, `choice`, `multi`, `list`, `record`, `identifier`, `entity`, `presence` and `region` also give a `value`: numbers, whole numbers of things (never a percentage), numbers with their unit, lengths of time, ISO dates, times of day and date ranges, amounts with their currency, true or false, one or several of the `options`, a list of items, an identifier as printed, a name. See `AnswerType`. - `options`: the choices, for `choice` and `multi`; a `record`'s fields. - `fidelity: "verbatim"`: copy the answer off the page, never reason it. - `id`: your own key for the answer, on every question or none. It comes back as `field_id`. If a question can't be answered from the document, `found` is `false`. Nothing is made up to fill the gap. ### Evidence Each found answer has three links: - `evidence_url`: the strip of the page the answer is on. - `locator_url`: the whole page, with that strip outlined. - `region_url`: where it is, as coordinates from 0 to 1000. Add `?highlight=true` to any of them to mark the answer itself with a box. Evidence is located the first time it is opened, then kept. ![With `?highlight=true`: the answer boxed on its page. Here, the paper's title.](/docs-img/highlight.jpg) ![`locator_url`: the whole page, the strip outlined, for where in a long document the answer is.](/docs-img/locator.jpg) ### Forms Asking the same questions of many documents? Save them once as a form, with your own id for each field, and send `form=lease-review` instead of the questions. A form's versions never change, and each run records the version it used. `POST /v1/forms/import` drafts a form from a form PDF; `POST /v1/forms/suggest` drafts questions from an example document. ### Streaming By default the reply comes once the run ends. With `Accept: text/event-stream` each answer arrives as it is read, as server-sent events: `meta`, `answer`, `value`, `evidence` (the same answer found on other pages, after the answers), then `result` (or `error`). The SDK streams this way. Send `trace=true` to see the steps it took, and their timings, as well. ### Without holding a connection Send `wait=false` and the reply is a 202 at once, naming the run: `{"run": "5f0c9e…", "status": "running"}`. Ask `GET /v1/runs/{run}` for it: `"status": "running"` while it is still going (wait the seconds `Retry-After` says), then `"status": "done"` with the answers, or `"status": "failed"` with the `error` and `code` a waiting request would have had. For queues, serverless functions, and documents that take a while. A request sent twice by a retry (a timeout on your side, say) need not run twice: send an `Idempotency-Key` header, a UUID of yours, and the same request with the same key within a day answers with the first request's run, read and billed once. ### Without uploading A document online need not pass through you: send `pdf_url`, an https link Exhibit fetches it from (a storage bucket's signed URL, for one). With nothing to upload, the body can be JSON: ```bash curl https://askexhibit.com/v1/extract \ -H "Authorization: Bearer $EXHIBIT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"pdf_url": "https://askexhibit.com/sample.pdf", "questions": ["How many days did training the big model take?"]}' ``` ### Errors, limits and billing - An error is `{"error": "…", "code": "…"}`. Show the `error` to people; branch on the `code` in your code. See `Error` for the codes. - A document is at most 64 MB and 1,000 pages. A request asks at most 192 questions. - A 503 (`unavailable`) is Exhibit not reached at all: nothing was read or billed. Send it again, after its `Retry-After` when it has one. A 502 (`read_failed`) is a run that began and failed. - A 429 has `Retry-After`: the seconds until asking again will be let through (for `concurrency_limit`, a short wait for one of your documents being read to finish). - Some limits go by the address a request comes from, since there is no key to count against: evidence links, 60 in any 10 s; and requests with a key that is not one we know, 10 in any 10 s, past which that address's keyed requests are refused for the rest of the 10 s (429, `rate_limited`). - Each plan's limits, for the whole account a month and per key a minute: - Free: 200 pages and 1,000 questions a month; 12 documents read (extract, import, suggest) and 120 requests a minute per key; 1 read at a time per key, 2 per account. - Pay as you go: $0.01 a page and $0.002 a question; 100,000 pages and 1,000,000 questions a month; 30 documents read (extract, import, suggest) and 120 requests a minute per key; 4 read at a time per key, 16 per account. A spend limit of your own is set under Developers, then Usage. - Lists (`GET /v1/forms`, a form's runs) come a page at a time: pass a page's `next` as `after` for the one after it, until `next` is null. - You pay for what was read: the result's `billable` says how many pages and questions. The same questions asked again of the same document come back at once and cost nothing (`cached_from` names the earlier run, when it was your account's). Send `cache=false` to run it afresh. ### Where it runs Exhibit runs in US East (Ashburn, Virginia). Called from a server near it, such as one in AWS `us-east-1`, a round trip takes a few milliseconds; from Europe about a tenth of a second, from Asia about a quarter. A run's `timing` is Exhibit's own time, from your request arriving to its result, without your connection. A document your account sent before, or one of its forms holds, need not be uploaded again: send its SHA-256 as `pdf_sha256` instead of the file, and only on a 404 `pdf_not_kept` send the file itself. The SDK and the CLI do this for you. ### Your documents Exhibit reads documents with AI models run by third-party providers, so the documents you upload and the questions you ask are sent to them for processing. Their own data-retention terms apply, and Exhibit does not control them. Do not upload what you may not share with third parties. Exhibit also keeps what you send: the PDF, each run's answers and evidence stay until you delete the form or the account. A delete leaves Exhibit's server within minutes and its nightly backups within 15 days. The whole API as OpenAPI: https://askexhibit.com/openapi.json