Tools

Invoice to JSON API

Submit an invoice PDF. Get back vendor, line items, totals, dates, and full text content as structured JSON. No templates, no training.

Try it below:

FILEDrop a file or click to upload

Production-ready

Private by design

Security-first

Scalable

Production-ready

Private by design

Security-first

Scalable

Production-ready

Private by design

Security-first

Scalable

Turn invoices into structured JSON

Upload an invoice PDF or submit a URL, get structured JSON back.

{
  "kind": "document",
  "name": "Invoice #1042",
  "state": "completed",
  "extraction": {
    "common": {
      "mimeType": "application/pdf",
      "size": 98304,
      "thumbnail": "https://cdn.exabase.io/...",
      "chunkCount": 8
    },
    "document": {
      "pages": 2,
      "author": "Acme Corp",
      "title": "Invoice #1042",
      "creationDate": "2025-05-28T00:00:00.000Z",
      "pdfRender": { "url": "https://cdn.exabase.io/..." },
      "documentType": "invoice",
      "structured": {
        "vendor": "Acme Corp",
        "invoiceNumber": "1042",
        "issueDate": "2025-05-28",
        "dueDate": "2025-06-28",
        "lineItems": [
          { "description": "API integration consulting", "quantity": 12, "unitPrice": 150.00, "amount": 1800.00 },
          { "description": "Infrastructure setup", "quantity": 1, "unitPrice": 2500.00, "amount": 2500.00 },
          { "description": "Monthly hosting (June)", "quantity": 1, "unitPrice": 320.00, "amount": 320.00 }
        ],
        "total": 4620.00
      }
    }
  }
}

What is Exabase's invoice to JSON API?

Submit an invoice PDF to the Exabase Extract API and get structured JSON back. The API detects the document type automatically and extracts invoice-specific fields: vendor name, invoice number, issue date, due date, line items with quantities and amounts, and total. You also get the full text content split into searchable chunks, page count, author, creation date, and a CDN-hosted thumbnail and rendered PDF.

This is the same POST /v2/extract endpoint used for all document types. When the API recognises an invoice, it sets extraction.document.documentType to invoice and populates extraction.document.structured with the extracted fields. No template configuration, no field mapping, no training step. Submit the PDF and read the output.

What you get back

The response includes the standard document metadata (page count, author, title, creation date, MIME type, file size) alongside the invoice-specific structured data. The structured object contains vendor, invoiceNumber, issueDate, dueDate, lineItems (each with description, quantity, unit price, and amount), and total. Full text content is split into searchable chunks with page numbers. You also get a CDN-hosted thumbnail and a rendered version of the PDF. The API reference has the complete response schema.

One multi-modal API

The same POST /v2/extract endpoint handles every content type Exabase supports. For PDFs, it returns page count, author, title, and structured field extraction when it recognises the document type. Invoices, contracts, and resumes each get their own set of extracted fields. For images, it runs OCR. For audio and video, it generates full transcripts with timestamps. For web pages, it renders JavaScript and extracts the content.

The submission flow is identical across all types: one endpoint, one SDK method, one webhook configuration. You learn the pattern once and use it for everything. The Extract docs cover each content type in detail.

What you can build with it

The structured invoice data maps directly to the fields your system needs. Build an accounts payable pipeline that extracts vendor, line items, and totals without manual data entry. Feed the structured output into your ERP or accounting system. Run spend analysis across a batch of invoices by querying the extracted fields. Flag invoices where the line item amounts don't sum to the stated total.

The text chunks work in RAG pipelines too. Store processed invoices as Resources in a Base and search across all of them through Deep Search at the paragraph level. Workers can process new invoices as they arrive, keeping your accounts payable data current without manual work.

Beyond invoice parsing

The Extract API returns more than structured fields. You get the full text as chunks, a CDN-hosted thumbnail, a rendered PDF, and standard document metadata. Store the output as a Resource and it's searchable through Deep Search immediately. Extract key details into Memory so your agent retains invoice history between sessions. The Submitting Jobs guide at https://exabase.io/docs/developer-guide/extraction/submitting-jobs walks through the full flow.

How do I use it?

  1. Get your API key

Free, no credit card:

Sign up at exabase.io and copy your API key from the dashboard.

  1. Submit an invoice PDF

Using the SDK (Node.js):

import { Exabase } from "@exabase/sdk";
import { createReadStream } from "fs";

const api = new Exabase({
  apiKey: process.env.EXABASE_API_KEY,
});

const job = await api.extract.createFromFile({
  file: createReadStream("./invoice-1042.pdf"),
  name: "Invoice #1042",
});

console.log(job.id);    // extraction job id
console.log(job.state); // "pending"
  1. Get the result

Poll the job until state reaches completed, or skip polling entirely with webhooks.

const result = await api.extract.get({ jobId: job.id });

if (result.state === "completed") {
  console.log(result.extraction?.document?.documentType); // "invoice"
  console.log(result.extraction?.document?.structured?.vendor);
  console.log(result.extraction?.document?.structured?.invoiceNumber);
  console.log(result.extraction?.document?.structured?.lineItems);
  console.log(result.extraction?.document?.structured?.total);
  console.log(result.extraction?.document?.pages);
  console.log(result.extraction?.common?.thumbnail);
}

One API call. No templates, no field mapping, no training.

What you get back

Field

Type

Description

state

string

completed or failed

kind

string

document

[...].mimeType

string

application/pdf

[...].size

number

File size in bytes

[...].thumbnail

string

CDN-hosted thumbnail URL

[...].chunkCount

number

Number of text chunks

[...].pages

number

Page count

[...].author

string

Document author

[...].title

string

Document title

[...].creationDate

string

Document creation date

[...].pdfRender.url

string

CDN-hosted rendered PDF URL

[...].documentType

string

invoice

[...].structured.vendor

string

Vendor name

[...].structured.invoiceNumber

string

Invoice number

[...].structured.issueDate

string

Issue date

[...].structured.dueDate

string

Due date

[...].structured.lineItems

array

Line items w/ description, qty, price, amount

[...].structured.total

number

Invoice total

Text chunks are retrieved separately via GET /v2/extract/{jobId}/chunks.

Each chunk includes a sequence number, the extracted text, and a page number.

API quick reference

Endpoint

Method

Description

/v2/extract

POST

Submit extraction job

/v2/extract

GET

List extraction jobs

/v2/extract/{jobId}

GET

Poll for result

/v2/extract/{jobId}/chunks

GET

Fetch text chunks

/v2/extract-settings

PUT

Configure webhook

Auth: X-Api-Key header on all requests.

File retention: Stored files are retained for 1 day from job creation. Download or copy anything you need before they expire.

Need file extraction or full page content?

Exabase offers a full set of tools to extract content from any media, document or website.

All your data extraction needs in one place.

Why Exabase

Comparisons

Use cases

FAQs

What is Exabase?

Exabase is infrastructure for AI agents. It gives your agents memory, versioned file storage, AI deep search, and context automation through a set of APIs. Store what your agent learns, search inside any content type, and keep knowledge bases current automatically. Built for production use. Give your agent precise context and cut your token spend by up to 81%.

Who uses Exabase?

Developers and teams building AI agents, copilots, and RAG applications. If your agent needs to remember things between sessions, store and retrieve files, search across documents and media, or stay up to date without manual maintenance, Exabase handles that infrastructure so you can focus on your product.

Do I need to configure templates for different invoice layouts?

No. The API detects invoices and extracts structured fields automatically. No template setup, no per-vendor configuration.

What fields does it extract?

Vendor name, invoice number, issue date, due date, line items (with description, quantity, unit price, and amount), and total. The exact fields depend on the document content. Treat the structured object as a free-form object and access only the keys you need.

Does it handle scanned invoices?

Yes. OCR is built in. Submit a scanned invoice the same way you'd submit a digital PDF. The API detects the content type and processes accordingly.

How accurate is the extraction?

Accuracy depends on the document quality and layout. Digital PDFs with clear formatting produce the most reliable output. The structured fields are best treated as a starting point: validate critical values (like totals) in your application logic before acting on them.

What if the API doesn't recognise the PDF as an invoice?

The documentType field will be set to other and the structured object may be absent or empty. You still get the full text as chunks, page count, author, creation date, thumbnail, and rendered PDF.

Can I submit a URL instead of uploading a file?

Yes. Pass a url field in the request body pointing to a publicly accessible PDF. Exabase fetches and processes it.

Do I have to poll for results?

No. You can configure a webhook URL and Exabase will POST the full result to your server when processing completes. The webhooks guide covers setup.

What happens if extraction fails?

The job state moves to failed. You can call the reprocess endpoint to retry without re-uploading the original file.

How long are files retained?

Stored files are retained for 1 day from job creation, then permanently deleted. Download or copy anything you need before the retention window expires.

Does it work with password-protected PDFs?

No. Password-protected PDFs cannot be processed. Remove the password before submitting.

Can I use the extracted content with other Exabase features?

Yes. Store processed invoices as a Resource in a Base and the content becomes searchable through Deep Search. Extract key details into Memory so your agent retains invoice history. Workers can process new invoices automatically as they arrive.

Is there an SDK?

Yes. The @exabase/sdk package for Node.js/TypeScript handles file streaming, job polling, and chunk retrieval. Install with npm install @exabase/sdk. Or call the REST API directly from any language.

What other document types does Extract recognise?

Contracts and resumes also get structured field extraction. See the Contract to JSON and Resume to JSON tool pages. General PDFs return text chunks and metadata without the structured object. The same endpoint also handles images, audio, video, and web pages.

Deciding?

Ask your favourite AI about Exabase:

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.