Extracting Structured Data From Legal Documents
Deterministic structure recovery comes first when you extract metadata and structured fields from legal filings. The Apryse Server SDK rebuilds headers, footers, paragraphs, lists and images from the PDF, and the same file returns the same structure on every run. Purpose-built AI in Smart Data Extraction then reads key-value pairs and classifies pages on top of that structure. Each key-value pair and each page classification returns a confidence score, with page numbers and bounding boxes attached. Processing happens on your own servers, so filings never leave your environment. Apryse extracts and locates data. It does not analyze contracts, score clauses or advise on them. Your application owns that logic and every decision made from the data.
The table below lists what the Server SDK needs before the first extraction call.
What Makes Legal Documents Hard
Legal documents break the assumption that a page reads from top to bottom. A footnote sits at the foot of one page while the sentence it qualifies continues on the next, so flat text extraction splices the two together. A merger agreement carries defined terms, numbered sections and schedules, and the meaning of each paragraph depends on where it sits in that hierarchy.
Filings add their own noise. Dockets pack dense tables with merged cells and multi-row headers. Exhibit stamps and page labels overprint body text. Scanned inserts arrive as images with no text layer, and a signature page can carry handwritten annotations.
Formatting also differs between firms. Two contracts with the same terms use different heading styles, numbering schemes and table layouts, so a template written for one breaks on the next. Documents that break across pages compound the problem, because a table or a clause that starts on one page ends on another.
The failure is quiet. A pipeline that reads text without structure still returns text, with the footnote inside the sentence and the stamp inside the clause. Nobody sees the error until a field comes back wrong.
Structure First, Then Clauses and Fields
Apryse recovers structure before it interprets anything. Document structure recovery parses a PDF into its logical parts: headers, footers, paragraphs, lists, images and styling. The output is deterministic, so the same file yields the same structure every time. Deterministic describes this foundation only. The interpretation layer that follows is AI, which is why it returns confidence scores instead of guarantees.
In a contract, structure tells your code which paragraph sits under which heading and which list item belongs to which section. Key-value extraction then reads labeled terms, such as an effective date or a governing law line, with no template to configure. Your code decides which of those terms count as clauses in your product. Footnotes get the same treatment. Paragraph, styling and bounding-box data let your code tell footnote text from body text by position and style, so a footnote stops landing in the middle of a sentence.
In a filing, structure separates headers and footers from body text, so your code can ignore a running footer instead of parsing it as part of a field. Table extraction reads docket tables, including merged cells and multi-row headers, and exports JSON or Excel. It detects row and column structure across pages, so a docket table that breaks across pages comes back as one table. Classification sorts pages by category before you extract from them.
Which Results Carry a Confidence Score
The distinction is a product fact, so the table states it directly.
Table results carry no confidence score, so validate table output in your own code. A check that row totals match the stated total is a typical start.
These are building blocks for the intelligent document processing workflow you build. Apryse supplies extraction and structure. Your application supplies routing, review, storage and every decision made from the data. It is not a turnkey IDP platform.
Contracts and Clause-Level Fields
Contracts that state terms as labeled lines give key-value extraction its cleanest input: an order form, a summary page or a schedule of terms. The engine identifies key-value relationships in documents with no explicit form layout, and it needs no template setup. Clause prose without labels is a job for the structure output, where your code reads the paragraph under its heading.
This example uses the Apryse Server SDK with Java on Windows and Linux. This feature requires the Smart Data Extraction add-on module, which is a separate download from the base Server SDK. See the modules documentation for download and installation instructions. Set APRYSE_LICENSE_KEY to your trial key before you run it.
Run it with the native library on the Java library path:
The output file has this shape, trimmed here to one page and one pair. Your coordinates and scores depend on your document.
Read the file from the top. The pages array holds one entry per page, and pageNumber is 1-based. Each item in keyValueElements carries a confidence between 0.0 and 1.0, a rect of left, top, right and bottom in PDF points, and the key and value words with their own positions. The full file also holds document-level properties for the coordinate system, the producer and the schema version. The JSON specification for generic key-value extraction lists every field.
The score reflects how likely the box holds a real pair and how accurate the bounding box is. A 0.94 on the governing law line says the engine is highly confident in the extraction. It says nothing about whether the clause is acceptable. That judgment stays in your application.
Read the key-value extraction docs for optional settings such as page ranges, regions of interest and password-protected PDFs.
Filings, Dockets and Exhibits
Filings hold metadata in a different shape: a case number, a filing date, a docket entry number, scattered across caption areas, headers and stamps. The same engine reads them. The string overload suits a pipeline that hands the result straight to the next step and never writes to disk.
Run it the same way as the first example. The returned string has the same shape as the file, trimmed here to the case number and the filing date:
The second pair scored 0.58. In this example a clerk stamp overprints the filing date, so the engine reports low confidence instead of hiding the doubt. Your code sets the threshold. Pairs above it flow on, and pairs below it go wherever your application sends uncertain data, such as a correction screen your team builds. Choose the threshold from a sample of your own filings.
Docket tables and exhibit lists go through table extraction, which handles merged cells and multi-row headers, follows a table that breaks across pages, and exports JSON or Excel. See the table extraction docs for the call. Remember that table results carry no confidence score.
Scanned inserts and handwritten annotations are image content. The OCR Module turns image-based pages into searchable text, and the Handwriting ICR Module reads handwriting. Both are separate add-on modules on the Server SDK, and this page treats them as inputs to your pipeline rather than topics.
Sorting a Discovery Set
Classify pages before you extract from them. Document classification assigns each page one of 24 predefined categories and returns a confidence score with the result. Your code reads the label and routes the page: key-value extraction for one category, table extraction for another, and nothing for pages you skip.
The categories are predefined, so classification does not sort a set into your own taxonomy. Your labels live in your code. Review the category list in the classification documentation before you design routing around it.
A discovery set can run to thousands of files, and the SDK holds no state between documents. Apryse does not ship a work queue, a job scheduler or batch orchestration, so your code owns the loop: which files run, in what order, and what happens when one fails. Initialize PDFNet once at process start. Then run one document per thread or spread processes across your own servers.
Apryse also does not ship a review interface or an e-discovery platform. Your application owns review, privilege calls and production.
Privilege, Confidentiality and Where Documents Are Processed
In legal work, where a document is processed is a requirement rather than a preference. Privileged material often has to stay inside your own boundary, and a cloud extraction API sends every page to a third party. The Apryse Server SDK is a self-hosted library. It runs in infrastructure you control, and no document content is transmitted to Apryse or any other third party.
By default the SDK sends limited usage metadata: API call names and counts, page counts, SDK version and SDK language. Document content is never part of it. If your policy bars even that, a no-tracking key is available on request through the no-tracking key form. Air-gapped environments need a license key configured for fully offline operation, so raise that requirement with Apryse early in your evaluation.
When a filing must lose content before it moves on, redaction is a separate add-on capability on the Server SDK with its own page.
For your security reviewer, the ownership split is short. Apryse owns extraction, structure recovery and the confidence scores. Your application and your legal team own privilege calls, retention, access control and production decisions.
For the buyer-side view of these workflows, see legal document workflows.
Frequently Asked Questions
Yes. The Apryse Server SDK runs inside your own infrastructure and processes documents locally, with no document content transmitted to Apryse or any third party. Smart Data Extraction runs on Windows and Linux x64 servers you control. Fully offline operation needs a license key configured for it.
Structured JSON. Key-value extraction returns each pair with its key words, value words, bounding boxes, page number and confidence score. Document structure output is JSON too, so your code can read the paragraph beneath a clause heading. The SDK returns data, and your application decides what counts as a clause.
Yes, at the page level. Document classification assigns each page one of 24 predefined categories with a confidence score, and your code routes pages from there. Check the category list first, because the categories are fixed. Your code also owns the loop across files, since the SDK ships no batch orchestration.
A scanned page is an image with no text layer, so it needs recognition. OCR in the Server SDK converts image-based pages into searchable text, and the Handwriting ICR Module reads handwritten annotations. Both are separate add-on modules. Check the extraction docs for how each mode treats image-based pages.
No. Apryse extracts structure, key-value pairs and page classifications from contracts. It does not review, analyze, score or advise on clauses, and it ships no review interface. Your application owns those decisions.