Documentation /docs/invoice-extraction-mcp

Extract invoice fields and line items with source evidence

For an invoice PDF or scan, Docspeed can return structured fields and line-item rows together with the source regions supporting them. Use this when a number alone is insufficient: you need to check the supplier, tax, total, or each line item against the original page.

Connect from your terminal client

After obtaining a Docspeed API key and setting DOCSPEED_API_KEY privately in the terminal used to launch your client, install the connection in one line:

codex mcp add docspeed --url https://api.docspeed.ai/mcp/ --bearer-token-env-var DOCSPEED_API_KEY

For Claude Code:

claude mcp add --transport http --scope project docspeed https://api.docspeed.ai/mcp/ --header 'Authorization: Bearer ${DOCSPEED_API_KEY}'

The single quotes preserve the environment variable name in the saved configuration. Do not put the key in chat or a shared file. The setup guide includes the hidden key prompt, companion skill, client timeouts, and connection checks. Start a new session and approve the connection through your client's normal controls. This is direct installation; it does not imply a public marketplace listing.

Ask for a result you can review

“Extract the supplier, invoice number, currency, tax, total, and every line item from this invoice. Include the supporting source regions. Return null for fields absent from the source.”

Use the direct streaming upload helper for your authorized local invoice; it reads DOCSPEED_API_KEY privately and returns a file_id. Reserve files_upload for tiny inputs at most 4 KiB. Then call schema_auto → extract with grounding enabled. schema_auto returns the Docspeed schema format (doc_class, fields, tables), not JSON Schema. Reuse the uploaded file_id. Keep each value's region_ids alongside grounding_regions and page_dimensions; use region text to inspect source text. A region ID without its source geometry is insufficient for a visual review.

Inspect a recorded example

The recorded synthetic invoice includes the original PDF, the saved Extract result, and an interactive source overlay. Its provenance explains the October 11, 2026 recording, supplied context, and limitations. It is one historical synthetic run, not a general accuracy benchmark or a customer result. Viewing it makes no new processing call.

Limits and next steps

Uploads send your document to Docspeed. Processing uses your account's balance and quotas. Supported inputs are PDF, PNG, JPEG/JPG, TIFF/TIF (including multiple pages), WebP, BMP, and GIF. Native DOCX/XLSX requires separately arranged beta API access. An extraction can fail; report the failure rather than inventing values or silently dropping evidence.

Use cited document questions for prose answers, or document reconciliation to compare two or three uploaded documents. See grounding, privacy, and support.