PDF to JSON: every field, table and line item

Turn a native or scanned PDF into a JSON record based on a template configured for your tenant. Extract the fields and table rows your integration needs, then check the values before sending them downstream.

Define a schema for each PDF type

Choose the fields and repeating rows for each document type. An invoice might contain an invoice number, a total and line items. A bank statement might contain an account identifier and movements. The extraction endpoint uses the matching template and places each named field directly under data.metadata. Repeating rows arrive as JSON arrays.

Send one PDF to POST /Document/extraction as multipart form data. The documented limit is 10 MB for this endpoint. Include representative scans and native PDFs in your evaluation. Templates determine which fields and tables the API attempts to extract.

Validate the parsed JSON before import

PDF parsing identifies text and layout. Template-based extraction maps selected values into named objects and row arrays. Use your application schema to check required fields and normalize values into business types. For example, parse an amount such as "125.50" into an exact decimal before checking totals. Check row counts and reconcile subtotals, tax and totals independently.

Use 0–100 confidence as one review signal. A field located on the source may include its page, bounding box and location confidence. Keep the PDF available to the reviewer and check the original when a value is uncertain or a document fails a business rule.

Example invoice response

curl --fail-with-body "$COGNERIS_BASE_URL/Document/extraction" \
  -H "Authorization: Bearer $COGNERIS_API_KEY" \
  -F "file=@./sample-invoice.pdf"

This synthetic excerpt shows a source location on two values, a string amount and one row. The tenant template controls the actual keys and row layout.

{
  "data": {
    "metadata": {
      "invoiceNumber": {
        "value": "DEMO-0451",
        "confidence": 98,
        "page": 1,
        "bbox": [
          0.62,
          0.11,
          0.83,
          0.14
        ],
        "bbox_confidence": 92
      },
      "total": {
        "value": "125.50",
        "confidence": 94
      },
      "lineItems": [
        {
          "description": {
            "value": "Sample service",
            "confidence": 96,
            "page": 1,
            "bbox": [
              0.08,
              0.41,
              0.35,
              0.44
            ],
            "bbox_confidence": 90
          },
          "amount": {
            "value": "125.50",
            "confidence": 95
          }
        }
      ]
    }
  }
}

Test with a sample PDF

Open the interactive demo and choose JSON to see a sample structured response. The 14-day Free plan includes 400 credits and requires no card. See the document extraction API overview for broader document inputs and production integrations.

Summarize this page with an AI assistant

Open this page in an assistant with the summary prompt already written. We publish the whole site as plain text at llms-full.txt, so an assistant can read what we actually wrote instead of inferring it.

Assistants summarize, and they get things wrong. Check anything that matters against this page, or ask us directly.