Skip to main content
Have an agent build it. Copy the brief below into Claude Code, Cursor, or any coding agent with access to your project. It states the calls, the questions worth asking you first, and the mistakes to avoid.
Research lives in PDFs. So do filings, manuals, datasheets, and half the useful pages on a government site. Most scrapers hand you an empty string for all of them. There is no separate document endpoint. Send the URL to scrape and it comes back as Markdown like anything else.

The pipeline

1. Scrape the document like a page

Tables come back as Markdown tables rather than as a column of stray numbers, which is the difference between a document you can query and a wall of text.

2. Do a set of them at once

Documents are slower to read than web pages. Send a list to batch and collect the results when they land, instead of holding a request open per file.

3. Type the contents when you need fields

For a set of filings or datasheets where you want the same fields from each, follow with extract and a schema. Same pipeline as any other page.

Finding the documents in the first place

Usually the PDFs are not the input, they are linked from somewhere. map lists a site’s URLs including the documents, so a filter for .pdf turns a site into a document list for 1 credit. On sites that link documents from pages rather than listing them, scrape the index page with the links format and filter that. search works too when the documents are spread across the web rather than one site, and a domain filter narrows it to the source you trust.

Telling a scan from a document

A PDF that is really a photograph of a page will come back with almost no text, and it will do so without failing. Compare metadata.wordCount against what the document should plausibly hold. A ninety page report that extracted to 200 words is a scanned image, not a short report, and it will sit in your index contributing nothing while looking like a success. Set a floor and route anything under it somewhere a human can see. Whether that means running it through OCR yourself, flagging it, or excluding it is a product decision, but it should be a decision rather than a silent pass. Check the quality object as well. A document reported as incomplete is worth another attempt before you conclude it has nothing in it.

Keeping the provenance

A number pulled out of a filing is worth very little if nobody can find where it came from, and documents are exactly where people want to check. Keep the source URL on every record and every chunk. For a long document, keep the heading the passage sat under too, since “page 40” is not something a reader can search for but a heading is. Store the extracted Markdown, not only what you derived from it. Documents are slower and heavier to fetch than pages, so re-deriving from stored text is meaningfully cheaper than re-fetching a set of large files.

Scale and patience

Documents take longer to read than web pages, and a large one takes noticeably longer. Use batch past a handful of files rather than a loop of single calls, so nothing is waiting on a synchronous response and the work runs in parallel on our side. Expect a wider spread of times than you would with pages. A batch of a hundred documents will have a tail of large ones finishing well after the rest, which is an argument for a webhook over a polling loop with a short timeout. Fetch once and reuse. Where the same document is referenced by several of your records, fetch it once and point them all at the stored text.

What it costs

A document is 1 credit, the same as a page. It costs the same whether the file was two pages or two hundred.

What to watch for

A very large document takes real time to read. Prefer batch over a single call when you have more than a handful, so nothing is waiting on a synchronous response. Check the word count that comes back. A 90 page report that extracted to 200 words is a scanned image of text rather than text, and that is worth knowing before it reaches your index. Keep the source URL and the page it came from. A number pulled out of a filing is worth very little if nobody can find where it came from.