Structured Extraction From PDFs and Documents via Web URLs
Sending a URL and schema to an API beats downloading and parsing PDFs separately.

Structured extraction from PDFs and documents at web URLs does not have to start with a file upload. When a schema-aware API can read the source URL, the cleanest path is to send that URL and the desired JSON schema in one call. The API processes the document and returns structured fields, so the developer defines what the downstream system needs without having to build another ingestion pipeline.
Why document-at-a-URL is a different extraction problem than document-as-a-file
A developer needs structured fields from a regulatory filing PDF at a stable government URL. The filing is already available where an agent or pipeline can find it. Yet the familiar approach is to download it, upload it to a document parser, and reshape the result for the receiving system. That approach treats the URL as a place to collect a file.
The distinction matters because the source determines which work belongs in the application. Financial filings, government permits, vendor contracts, and research reports live at public or authenticated URLs. For this workflow, each is a web resource first and a document second. A file-oriented tool is a reasonable choice when the document exists only as a file, but a document already available at a URL gives the developer another path. Reaching for file upload by default adds a transfer and processing layer that a URL-first service can handle instead.
What the file-upload pipeline actually costs before a single field is extracted
After downloading the document, the application hands it to a parser or an OCR pipeline, then turns the output into the fields downstream systems expect. If retrieval is part of the workflow, the parsed content also needs chunking before it can be used effectively. Schema validation then becomes another responsibility. Before an agent gets a field it can use, the developer has built a chain of steps that must agree on what the document means.
Layout variation makes that agreement fragile. Column structures, header placement, and field density differ across documents, so an extractor tuned to one layout can misclassify fields when another arrives. Chunking introduces a different kind of break. A cut through a meaningful unit of content reduces retrieval precision for downstream queries, even when the text itself was read correctly.
Gaps in validation add more work because fields that go unchecked can pass into downstream systems without anyone noticing. The agent may then make an error far from the extraction step that caused it. The real cost of the file-upload approach in this case is the maintenance work needed to keep the ingestion path functioning. The application owns several failure boundaries before it can do anything useful with the extracted data.
How a schema-aware API collapses the pipeline into one call when the document is at a URL
The developer writes a JSON schema describing the wanted fields and sends it with the document URL in a single REST call. The API fetches and processes the document, applies extraction against that schema, and returns schema-valid JSON. For this extraction path, the developer does not separately download, chunk, or embed the document. The application also has no need for a separate validation stage just to make the response fit the declared schema.
The work has moved behind the API boundary. A service supporting this pattern handles fetching, including supported authenticated URLs and redirect chains. It renders the document into a form it can parse, using the native PDF text layer or OCR for scanned content. It then uses LLM-guided extraction to identify the fields described by the schema. The developer is no longer maintaining XPath expressions or field selectors tied to where information appears on a particular layout.
That shift makes the schema the stable part of the workflow. ExtractBench’s July 2026 benchmark demonstrates the use of a shared schema across layout variations, including an invoice schema across vendors and a permit schema across jurisdictions. The application describes the information it needs. A different header or column arrangement does not, by itself, call for a new output contract. This is why schema-guided extraction is more than a shorter way to upload a PDF.
The returned JSON can also include grounding metadata, which is source evidence for the extracted fields. That evidence gives downstream systems a way to trace values back to the document. A schema-valid response satisfies the field contract, but that alone does not establish that every value is correct or every repeated record is present. ExtractBench evaluates value accuracy, record completeness, and grounding separately, making those separate concerns explicit.
What the JSON schema should look like for common document types
Schema design starts with the receiving system. Schema design must answer which fields that system actually consumes. A narrow schema keeps the extraction task focused on that answer, while a broad schema asks the model to satisfy more requirements in the same response. Flat or shallow structures are preferable where they fit the task. Deep nesting increases the risk of truncation on long documents without necessarily giving the downstream system more useful information.
Types should express what each field means. Government permits and regulatory filings often need strings for identifiers, booleans for checkboxes, and nullable fields for optional sections. ExtractBench’s W-14 disposal permit example distinguishes a blank identifier from an unchecked box. Its output uses "api_no" with null when the field is blank and "reason_pressure" with false for the unchecked box.
For that reason, explicit null handling belongs in the schema. Optional fields need to allow for values that are missing from the source document. Numeric fields should use number types, while identifiers should be strings where the document type calls for them. Moderate nesting can preserve the sections of a permit or filing without trying to reproduce its page layout. The aim is a clear data contract.
Content that repeats needs an array with an element that describes each record. Invoice line items and holdings in a fund schedule fit this pattern. The schema also needs clear expectations for record completeness, because an array can contain well-formed entries while omitting later records. Truncation of long arrays is a common failure mode on long documents. Consequently, a valid array is not enough to establish that a full schedule has been captured.
Schema breadth is the harder limit. ExtractBench’s July 2026 benchmark found that results got much worse as the number of fields grew, with frontier models reaching zero valid output on a 369-field financial reporting schema. That result makes scope a practical accuracy decision. For multi-page contracts, which carry a high risk of truncation, the recommended approach is to extract a defined set of key clauses.
ExtractBench found that every commercial VLM scored below ten percent on huge tables with more than a thousand rows. For these documents, summary fields and key figures are a more suitable target than complete table extraction. The amount of repeated data requested in an array must stay within a task the extraction system can complete reliably.
When the URL-first pattern applies and when it does not
The first decision is whether the document’s location is a usable access path. A stable or predictable URL makes the pattern a natural fit, provided the API can retrieve it. The next decision is whether the required fields fit a schema of moderate breadth. The document population also needs enough consistency that one schema can describe what matters across it. When those conditions hold and the result goes straight into an agent or pipeline without a person checking every record, URL-first extraction does away with a separate ingestion workflow.
Authentication does not automatically rule it out. Many enterprise document stores have token-authenticated URLs that an API can use directly. This approach reaches its limit when access needs session management beyond what the URL can carry. In that case, a URL alone is not a sufficient input for the service.
The output requirements can also make another approach safer. A schema approaching hundreds of fields, or one with deep nesting, calls for a narrower scope or a specialized document-AI pipeline with human-in-the-loop validation. Enormous tables present a separate problem when completeness across thousands of rows is critical. ExtractBench found that every system it tested on that case struggled. Specialized batch processing with post-extraction validation is the more reliable choice for that requirement.
If a difference of one cent per page is material, the economics depend on schema complexity and document length. ExtractBench compares measured cost per page across fourteen extraction systems, which gives a basis for that comparison but does not show which is cheapest for every workload. A single application call can reduce integration work without proving that it is the cheapest option for every document workload. The strongest case for URL-first extraction is a good fit between access, scope, and downstream use.
Fitting URL-based document extraction into agentic pipelines and RAG systems
For an agent, a document URL can be both a discovery result and an extraction input. An agent that finds a regulatory filing, financial disclosure, or product specification can request its structured fields in the same tool call that fetches the content. It does not need to leave that process to create a separate file-ingestion workflow. Research agents that follow citation chains benefit because papers, filings, and technical reports link to more source documents at URLs.
Competitive intelligence agents can extract fields from earnings releases, regulatory submissions, and patent filings at known or discoverable URLs. Lead enrichment and company profiling agents can use annual reports, sustainability disclosures, and government registrations to populate structured company records. In each case, the schema defines what belongs in the record while the URL identifies the source. The extraction tool connects those two parts without asking the agent to manage document parsing.
For RAG systems, URL-based extraction also addresses a freshness problem. A corpus built from downloaded files reflects the documents available at its last index rebuild. When a source document changes, that stored copy can become stale. Query-time extraction from the source URL retrieves the current document. This gives the system a path to current structured fields without treating an index rebuild as a prerequisite for every source update.
The integration belongs in the tool layer. LangChain, LangGraph, and CrewAI integrate web and document extraction as tool calls within agent plans, while LlamaIndex provides a data and retrieval layer that orchestrators can call as a tool. A schema-defined URL extraction endpoint fits into that tool layer without the need for a separate document-AI integration. Its input is the source location and field contract. Its output is structured data the next step in the plan can consume.
Implementation follows directly from that contract. First, define the document schema using narrow scope, typed fields, explicit null handling, and arrays where records repeat. Then make the API call with the document URL and that schema. Finally, pass the typed JSON response into the downstream agent or database without a separate cleaning or normalization stage, and keep in mind the earlier limits on completeness. These steps can be completed in a single session without standing up parsing infrastructure.
For documents that change, the same call can run on a schedule or after a change-detection event. Regulatory filings and versioned product specifications can then produce updated structured output from their source URLs. In practice, extraction starts with one document type, the fields the receiving system needs, and a URL the API can access. When those fit, the document’s web location is already the entry point. There is no need to turn it into a file-upload project first.


