# How to extract data from invoices automatically

Pull the seller, tax ID, invoice number, line items, VAT, and total from a PDF or photo of an invoice into typed fields, each one read from the printed page.

Published 2026-12-02. Paxa Labs.

Invoice data extraction reads a PDF or a photo of an invoice and returns the facts printed on it as named fields. Those are the seller and its tax ID, the invoice number and date, each line item, the VAT, and the total. From there they can go into a spreadsheet or an accounting system with no one keying them in.

Plain OCR stops one step earlier. It returns the whole page as text, and someone still has to find the total in it. Extraction fills a list of fields you define. Paxa's Extract tool starts from a ready-made schema for a Thai tax invoice, and you edit it to fit other invoices.

## What data can you extract from an invoice?

Most invoices print the same facts in different places. These are the fields teams pull most often, with the type each one takes in an extraction schema.

| Field | On the page | Type |
| --- | --- | --- |
| Seller name and address | The business that issued the invoice | `string` |
| Seller and buyer tax IDs | Thirteen digits on a Thai invoice, often printed in spaced groups | `thai_id` |
| Buyer name and address | The business being billed | `string` |
| Invoice number and book number | Running numbers that can start with a zero | `string` |
| Issue date and due date | Often with a Buddhist-era year on a Thai invoice | `date` |
| Line items | A table of description, quantity, unit price, and amount | `array` of objects |
| Subtotal, VAT, and total | The VAT printed apart from the value it was charged on | `number` |
| Total in words | The total spelled out, as many Thai invoices print it | `amount_words` |
| Bank and account number | Where the buyer sends the payment | `bank`, `string` |

Thai practice keeps three documents apart. A ใบแจ้งหนี้ asks for payment, a ใบกำกับภาษี is the VAT document, and a ใบเสร็จรับเงิน records money received. One sheet often serves as two of them. Check which fields your own documents print before you write a schema, and see a Thai invoice field by field on [the invoice page](https://paxalabs.com/ocr/invoice).

## What must a Thai tax invoice include?

Section 86/4 of [the Revenue Code](https://www.rd.go.th/english/37741.html) lists the particulars a tax invoice must carry at least:

- The words tax invoice, in a prominent place.
- The name, address, and taxpayer identification number of the VAT registrant issuing it.
- The name and address of the buyer.
- The serial number of the tax invoice, and of its book if there is one.
- The description, type, category, quantity, and value of the goods or services.
- The VAT amount, clearly separated from the value of the goods or services.
- The date of issue.
- Any other particulars the Director-General prescribes.

The same section requires the particulars in Thai language and Thai currency, with Thai or Arabic numerals. A business that needs another language or currency issues its invoices that way with the Director-General's approval. Section 86/6 provides for a shorter form in retail business, the abbreviated tax invoice.

The Extract tool's Tax invoice preset names the seller and the buyer, each with a tax ID. Next come the book and invoice numbers, the issue date, and up to 9 line items. It ends on the subtotal, the VAT, the total, and the total in words. [The tax invoice page](https://paxalabs.com/ocr/tax-invoice) shows a specimen typeset from this list.

## Do you need OCR or data extraction for invoices?

OCR reads the page into text. [The Documents tool](https://paxalabs.com/app/documents) returns each page as Markdown, or as structured blocks for a program, at 6.5 credits per page. Use it to keep invoices as searchable text or to hand them to a language model.

Extraction returns only the fields you name, each typed and checked. Paxa Document Extraction reads the page and fills your schema, at 13 credits per page for a schema of up to 50 leaf fields. Use it when the values go into columns.

## How do you extract invoice data, step by step?

1. Drop in the invoice: Open [the Extract tool](https://paxalabs.com/app/extract) and drop in the invoice as one file (PDF, PNG, JPEG, WebP) of up to 20 pages and 10 MiB. A photo counts as one page.
2. Start from a preset: Under Start from, pick Tax invoice, Receipt, or Withholding certificate. Each opens a schema you can edit, and an edited schema shows as Custom.
3. Edit the fields: In the schema, add the fields your invoices print and remove the ones they never carry. Mark a field required when an invoice is no use without it, such as the total.
4. Turn on Evidence: Evidence returns the printed text each value was read from, and Reading returns each page as Markdown. Neither costs extra.
5. Check the price: Once the schema is checked, the tool shows the pages, the leaf count, and the credits. Nothing is charged until you press Extract.
6. Run, review, and copy: Read the status first, then each field against the document. Copy fields puts the result on your clipboard as JSON.

Invoices carry names, tax IDs, and bank details. Before you upload ones from suppliers or customers, read how the service handles what you send in [the Privacy Policy](https://paxalabs.com/privacy) and [the Terms](https://paxalabs.com/terms#content-and-output).

## How do you fit the schema to your own invoices?

A schema is a list of named fields, each with a type. A field can be marked required and can carry a short description, which is the one piece of your writing the model reads. Put a field's meaning there, for example which of two printed dates is the due date.

Objects group fields, such as the seller's name, address, and tax ID. Line items go in an array, which needs a `max_items`, the most rows it reads. Pick types for what is printed: `date` for a date in either era, `number` for an amount, `thai_id` for a 13-digit ID, and `amount_words` for a total in words.

A ใบแจ้งหนี้ asks for payment. It prints a due date, often a purchase order number, and the account to pay into, all of which the Tax invoice preset leaves out. Add them to `fields`:

Schema:

```json
{
  "due_date": {
    "type": "date",
    "description": "Payment due date"
  },
  "purchase_order": {
    "type": "string"
  },
  "bank": {
    "type": "bank"
  },
  "account_number": {
    "type": "string",
    "description": "Account to transfer the payment to"
  }
}
```

The account number is a `string`, which keeps a leading zero, and `bank` resolves the bank's name from the spellings documents print. Every leaf field counts once toward the price, and each field inside an array counts once per row the array is sized for.

The Tax invoice preset counts 49 leaves, with 9 rows of 4 fields among them. These 4 fields take it to 53, past the 50 that bill at the standard rate. Size the line items for 8 rows and it bills at the standard rate again. An invoice with more rows comes back with the first ones filled and the array marked as cut.

## How do you check the extracted data?

Paxa Document Extraction returns each value as text printed on the page, read as the field's type. A field the page does not print is null. One whose text fails its type's checks is null too, with a reason. Nothing is estimated or looked up elsewhere, and there is no confidence score.

- Read the status first. Complete means every required field has a value. Incomplete means at least one is missing, and the tool marks each one.
- A tax ID whose check digit does not hold comes back null with the reason. The check catches most misread digits, and a person corrects them from the page.
- A value that differs from its printed text comes back null too, and Evidence shows the text as printed.
- Compare the total with the total in words. They are two separate readings of one amount, and when they differ, a person checks the page.
- Check every date printed with a two-digit year. The tool marks each one and shows the digits as printed.

When most required fields come back missing, check that the file is the document the schema describes. A receipt sent through the Tax invoice preset comes back this way.

Keep a person on the fields that move money, such as the payee, the amount, and the account number, whichever tool reads them. The same person takes every Incomplete result.

## How do you get the data into accounting software?

Copy fields in the Extract tool gives you the result as JSON. A team that handles invoices every day sends them to [the extraction API](https://paxalabs.com/docs/api/extract), which returns the same fields. Its own code then maps each field to a column or an account in its system.

Store the fields beside the original file. When a figure is questioned later, the reviewer opens the page it came from. [PDF to JSON](https://paxalabs.com/pdf-to-json) shows a tax invoice, the schema it was read against, and the fields the API returned.

## What does invoice data extraction cost?

Paxa Document Extraction costs 13 credits per page for a schema of up to 50 leaf fields, and 19.5 credits per page above that, up to 100 leaf fields. Reading the page is included. Plain OCR in the Documents tool costs 6.5 credits per page.

| Job | Pages | Credits | Cost |
| --- | --- | --- | --- |
| 100 invoices, Tax invoice preset | 100 | 1,300 | $1.30 |
| 1,000 invoices in a month, Tax invoice preset | 1,000 | 13,000 | $13.00 |
| The same month, with the 4 added fields | 1,000 | 19,500 | $19.50 |

A new account's 100 free credits fill fields on 7 pages, with no card. They are for personal use and evaluation. Buy any plan or credit pack, and the account's results are yours to use commercially, including those made before the purchase. [The Terms](https://paxalabs.com/terms#content-and-output) set this out. [How much does OCR cost?](https://paxalabs.com/guides/how-much-does-ocr-cost) sets these rates beside other vendors'.

## What should you read or try next?

- Drop a tax invoice into [the Extract tool](https://paxalabs.com/app/extract) with the free credits.
- See a Thai tax invoice filled in field by field on [the Document Extraction page](https://paxalabs.com/document-extraction).
- Read the use case [Thai OCR for invoices and receipts](https://paxalabs.com/use-cases/invoices).
- Read [what OCR is](https://paxalabs.com/guides/what-is-ocr) and [which Thai OCR fits each job](https://paxalabs.com/guides/best-thai-ocr).
- Open [the extraction guide](https://paxalabs.com/docs/extraction) in the docs for every type, check, and limit.

## Common questions

### Can it read a photo of an invoice?

Yes. An image file (PNG, JPEG, WebP) is read as one page, and the format is detected from the file itself. Photograph the invoice flat and in even light, with every edge in the frame.

### Can I upload one PDF that holds many invoices?

Split it first. Each request reads one document and returns one set of fields. A file holding ten invoices comes back as a single set.

### What if an invoice has more line items than the schema expects?

The array keeps its first rows, up to its `max_items`, in reading order, and the response lists it as truncated. Raise `max_items` to read the rest. Each extra row adds its fields to the leaf count, and a schema counts at most 100 leaves.

### Is there a confidence score for each field?

No. A faithful copy of a misread digit is invisible to any score. Each field says whether it was read from print and whether it passed its type's checks, and the status says whether every required field is there.

### Which languages can it read?

Paxa Document Extraction reads invoices in many languages. Its types follow the conventions of Thai paperwork, such as 13-digit IDs with a check digit, Buddhist-era dates, banks, and amounts written in Thai words.

### What does a failed extraction cost?

Nothing. When extraction fails after the charge, the credits are refunded automatically. A file that cannot be read, or needs a password to open, is refused before any charge. A document that carries none of the fields is still read in full and is charged.
