# Document Metadata Extraction: Fields, Sources, and JSON Examples

> Document metadata extraction explained: embedded file properties versus content-derived fields, PDF tooling, and a normalized JSON record for search.

Canonical: https://reducto.ai/guides/metadata-extraction

## The short answer

Metadata extraction is the process of pulling descriptive attributes about a document, such as its title, date, parties, type, author, and format, into structured fields that systems can store, filter, and search. Document metadata comes from two different places. **Embedded metadata** is stored inside the file by the software that created it: PDF Info or XMP properties, Office core properties, or EXIF tags in images. **Content-derived metadata** is what the document actually says: the title printed on page one, the effective date in the first paragraph, the names in the signature block.

The two often disagree. A contract exported from a template can carry the template’s title and a creation date from when the PDF was generated. A reliable pipeline reads both, keeps them separate in the record, and chooses which source each field trusts.

## Embedded versus content-derived metadata

<Table html={"<table>\n  <thead>\n    <tr><th scope=\"col\">Source</th><th scope=\"col\">Typical fields</th><th scope=\"col\">How you get it</th><th scope=\"col\">Watch out for</th></tr>\n  </thead>\n  <tbody>\n    <tr><td>Filesystem or storage</td><td>File name, size, MIME type, upload time, hash, storage path</td><td>Your own code or storage API</td><td>Describes the copy you received, not the document</td></tr>\n    <tr><td>Embedded file properties</td><td>Title, author, subject, keywords, creator application, created and modified dates</td><td>File parsers that read PDF Info/XMP, Office core properties, or EXIF</td><td>Often blank, stale, stripped, or inherited from a template</td></tr>\n    <tr><td>Content-derived fields</td><td>Printed title, document type, effective or invoice date, parties, reference numbers, jurisdiction</td><td>OCR, layout parsing, and schema-based extraction</td><td>Needs a schema and validation; scanned files have no text layer to read</td></tr>\n  </tbody>\n</table>"} />

Metadata is also often grouped as descriptive (what the document is about), structural (pages, sections, ordering), and administrative (dates, format, rights). For pipelines, the source split above is more useful: it tells you which tool produces each field and how far to trust it.

## Typical document metadata fields

Most document records combine a small fixed core with fields that depend on document type:

- **Core:** document ID, file name, MIME type, page count, hash, ingestion time.
- **Descriptive:** title, document type, language, summary, keywords.
- **Business dates:** effective, signature, invoice, due, or filing date.
- **Parties:** organizations and people with their roles, such as buyer, provider, insured, or borrower.
- **References:** contract, policy, invoice, or account numbers.
- **Governance:** source system, retention class, access group, and the version of the extraction schema.

Keep type-specific fields in a schema per document family rather than one global record.

## File parsers versus OCR and extraction

For PDF metadata extraction, a file parser is the right tool for embedded properties. Libraries such as [pypdf](https://pypdf.readthedocs.io/en/stable/user/metadata.html) read the PDF Info dictionary, [ExifTool](https://exiftool.org/) reads and writes metadata across many image and document formats, and [Apache Tika](https://tika.apache.org/) detects and extracts metadata and text from a wide range of file types. They are fast and deterministic but only return what the authoring software wrote.

Content-derived fields require reading the document: text and layout parsing for digital PDFs, plus OCR for scans and photos. A schema then decides which values to keep, separating signed, effective, and expiration dates and giving parties their roles. A properties reader cannot do this.

## Example: one contract, two kinds of metadata

The following is a **synthetic** one-page master services agreement generated for this guide. Its embedded title is `MSA_template_v3`, and its author is `jlee`. The printed content names two parties and an effective date of March 3, 2026.

File attributes and embedded properties come from local tooling (Python 3, pypdf 5.1.0):

```python
import hashlib, json, mimetypes, os
from pypdf import PdfReader

path = "msa-northwind-contoso.pdf"
info = PdfReader(path).metadata
record = {
    "file_name": os.path.basename(path),
    "mime_type": mimetypes.guess_type(path)[0],
    "size_bytes": os.path.getsize(path),
    "sha256": hashlib.sha256(open(path, "rb").read()).hexdigest(),
    "pdf_info": {"title": info.title, "author": info.author, "creator": info.creator},
}
print(json.dumps(record, indent=2))
```

Content-derived fields come from [Reducto Extract](https://docs.reducto.ai/extract/overview) with a JSON schema (reductoai Python SDK 0.27.0). The `enum` keeps `document_type` in a fixed vocabulary:

```python
from pathlib import Path
from reducto import Reducto

client = Reducto()
upload = client.upload(file=Path("msa-northwind-contoso.pdf"))
schema = {
    "type": "object",
    "properties": {
        "document_title": {"type": "string", "description": "Title printed at the top of the first page"},
        "document_type": {"type": "string", "enum": ["master_services_agreement", "nda", "statement_of_work", "invoice", "other"]},
        "effective_date": {"type": "string", "description": "Date the agreement takes effect, as written"},
        "parties": {"type": "array", "description": "Contracting parties named in the opening paragraph",
                    "items": {"type": "object", "properties": {"name": {"type": "string"}, "role": {"type": "string"}}}},
        "governing_law": {"type": "string", "description": "Jurisdiction in the governing law clause"},
    },
}
result = client.extract.run(
    input=upload.file_id,
    instructions={"schema": schema, "system_prompt": "This is a commercial contract."},
)
print(result.result)
```

## Normalize a metadata record

Merge both outputs into one metadata extraction JSON record with the sources kept apart. The values below are the real outputs of the two scripts on the synthetic file:

```json
{
  "file": {
    "file_name": "msa-northwind-contoso.pdf",
    "mime_type": "application/pdf",
    "size_bytes": 2142,
    "sha256": "a9e9b231b3dbcb02d88f92a9abb85e4031d2b407772d9c71a1b6b2d7b2358d0f"
  },
  "embedded": {
    "title": "MSA_template_v3",
    "author": "jlee",
    "creator": "Microsoft Word",
    "created_at": "2026-11-24T19:00:48+00:00"
  },
  "extracted": {
    "document_title": "MASTER SERVICES AGREEMENT",
    "document_type": "master_services_agreement",
    "effective_date": "March 3, 2026",
    "parties": [
      { "name": "Northwind Analytics, Inc.", "role": "Provider" },
      { "name": "Contoso Freight LLC", "role": "Customer" }
    ],
    "governing_law": "State of New York"
  },
  "normalized": {
    "title": "Master Services Agreement",
    "effective_date": "2026-03-03"
  }
}
```

The embedded title and creation date would mislabel this contract in search, so the display title and business date come from `extracted`. Convert dates to ISO 8601 in your own code after extraction, and record the schema version so older documents can be re-run when fields change.

## Use records in search or downstream systems

Index `normalized` and `extracted` values as filterable keyword or date fields, and use `file.sha256` for deduplication. In retrieval, attach the document record to every chunk so a query like “MSAs with Contoso effective in 2026” can filter before semantic ranking. The [Elasticsearch semantic search walkthrough](https://reducto.ai/blog/how-to-reducto-parsing-elasticsearch-semantic-search) shows how parsed chunks and their metadata go into an index, and the [data ingestion guide](https://reducto.ai/guides/data-ingestion-unstructured-content) covers where this step sits in a broader pipeline. For designing the schema itself, see [schema-based document extraction](https://reducto.ai/guides/schema-based-document-extraction).

## Where Reducto fits

[Reducto Extract](https://reducto.ai/extract) handles the content-derived side: it parses the document, including OCR for scans, and returns the fields in your schema as JSON. With [citations](https://docs.reducto.ai/extract/response-format) enabled, each value includes its page, bounding box, and a confidence signal, so reviewers can check a date or party name against the source. Parse can also return a fixed set of embedded properties (title, author, subject, keywords, creator, producer, last modified by, and created and modified dates) for PDF, DOCX, XLSX, and PPTX files when `extract_document_properties` is enabled. Storage attributes such as hashes and paths, image EXIF, and other file-system metadata still come from your own file tooling. You can [try Extract in Studio](https://studio.reducto.ai) on your own documents.

## Frequently asked questions

### What is the difference between document metadata extraction and data extraction?

Metadata extraction targets fields that describe the whole document, such as type, title, date, and parties. Data extraction also covers the body, such as line items or tables. The same schema-based tooling can do both.

### Can I trust PDF metadata like author and creation date?

Treat it as a hint. Authoring or export software writes it, so it may be blank, inherited from a template, or show when the file was generated rather than signed. Use content-derived dates for business logic.

### What format should a metadata record use?

JSON holds nested parties and arrays and maps directly onto search indexes and databases. Keep file, embedded, and extracted values in separate objects so each field’s source is clear.
