apyhub
Back
▣ INGESTION KIT · DOCUMENT INTELLIGENCE KIT

Extract Invoice Data API

What it does

The invoice extraction API reads an invoice file and returns its data as JSON. Send the file as file_base64 with its file_name. You get back the supplier, invoice number, issue date and due date. You also get the currency, net total, VAT total and total.

Line items come back by default, each with a description, SKU, quantity, unit price and total. Set include_line_items to false to skip them. To pull other data, list up to 30 names in fields, such as buyer_name or supplier_vat_number. Fields not found on the invoice come back as null.

Scanned and photographed invoices work as well as digital PDFs. Supported files are PDF, PNG, JPG, TIFF, WEBP, BMP and GIF, up to 20 MB. Each request can contain 1 page, so split multi-page invoices and send each page separately.

Every result has a review_required flag and a warnings list, so your app can send unclear invoices to a person.

Teams use the invoice extraction API for accounts payable intake, expense processing and indexing supplier invoices without manual data entry.

Next, check the supplier's EU VAT number with the VAT Validation API. For invoices in other languages, translate the extracted text with the Text Translation API.

POST
Extract Invoice Data
https://api.eu.apyhub.com/skavio/extract-invoice

QUICKSTART

GUIDE

Quickstart

Extract the data from a one-page invoice PDF.

curl -X POST "https://api.eu.apyhub.com/skavio/extract-invoice" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "file_name": "invoice.pdf",
    "file_base64": "JVBERi0xLjMK...",
    "include_line_items": true
  }'

What you'll get back

A real response for a one-page invoice from ACME Supplies Ltd:

{
  "documents": [
    {
      "fields": {
        "supplier": "ACME Supplies Ltd",
        "invoice_number": "INV-2026-0042",
        "issue_date": "2026-11-15",
        "due_date": "2026-12-15",
        "currency": "GBP",
        "net_total": "410.00",
        "vat_total": "82.00",
        "total": "492.00"
      },
      "line_items": [
        { "description": "Printer paper A4 box", "sku": null, "quantity": "10", "unit_price": "25.00", "total": "250.00" },
        { "description": "Black toner cartridge", "sku": null, "quantity": "2", "unit_price": "80.00", "total": "160.00" }
      ],
      "review_required": true,
      "warnings": []
    }
  ],
  "pages": 1,
  "status": "completed",
  "usage": { "atoms": 2000, "units": 1, "unit": "page" },
  "request_id": "39c49f52-4997-4bf8-8c48-cb3c62be16a6-73378aba"
}

To pick your own fields, add "fields": ["invoice_number", "total", "buyer_name", "supplier_vat_number"].

TRY ITLIVE · 2000 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
File name with extension (pdf, png, jpg, jpeg, tif, tiff, webp, bmp, gif, txt).
Base64-encoded file (max 20 MB decoded).
fields

About this endpoint

What it does

Extracts structured data from one invoice page. Send a PDF or image and get back the supplier, invoice number, dates, currency, totals and line items as JSON.

Limits

  • Maximum 1 page per request. A PDF with more pages returns 413 with input_too_large. Split multi-page invoices and send each page separately.
  • Maximum file size is 20 MB.
  • Supported files: PDF, PNG, JPG, JPEG, TIF, TIFF, WEBP, BMP, GIF, TXT.

Request Body

ParameterTypeMandatoryDescription
file_base64StringYesThe file, base64-encoded. Maximum decoded size is 20 MB.
file_nameStringYesFile name with extension, e.g. invoice.pdf. The extension tells the API how to read the file.
include_line_itemsBooleanNoReturn the line items. Default: true.
fieldsString ArrayNoUp to 30 field names to extract instead of the defaults, e.g. ["invoice_number", "total", "buyer_name", "supplier_vat_number"]. Fields not on the invoice come back as null. An empty list uses the defaults.

Response

ParameterTypeDescription
documentsObject ArrayOne object per invoice found.
documents[].fieldsObjectExtracted values as strings. Default keys: supplier, invoice_number, issue_date, due_date, currency, net_total, vat_total, total. With fields, the keys you asked for.
documents[].line_itemsObject Array or nullEach item has description, sku, quantity, unit_price, total. null when include_line_items is false.
documents[].review_requiredBooleantrue when a person should check the result.
documents[].warningsString ArrayNotes on anything unclear in the extraction.
pagesIntegerPages processed.
statusStringcompleted on success.
usageObjectunits and unit (page) counted for the request, plus atoms.
request_idStringID for support requests.

Errors

StatusCodeWhen
400missing_filefile_base64 is empty or missing.
400invalid_base64file_base64 is not valid base64.
413file_too_largeThe decoded file is over 20 MB.
422unprocessable_fileThe file cannot be read, e.g. a corrupt PDF or a file whose content does not match its extension.
422processing_failedThe file was read but could not be processed.
429busyToo many requests are in progress. Retry after a short wait.
413input_too_largeThe file has more than 1 page.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.