Skip to main content
cURL
Try it live: AI Invoice Parser → API Tester — send a real request from your browser.
This method extracts data from your PDF invoices and returns a well-structured JSON format for your use.
Important
  • Only invoices will be parsed. For all other documents, please use our existing Document Parser.
  • To ensure accurate processing, each invoice must be clearly separated. If an invoice contains multiple pages, we recommend splitting it into individual PDFs using the PDF Split API.
  • While AI Invoice Parser supports multi-page invoices, the total page count for a single PDF must not exceed 100 pages. Submitting large PDFs containing multiple invoices is not recommended.

POST /ai-invoice-parser

The AI Invoice parser automatically detects invoice layouts without the manual effort previously required to supply document parsing templates for reference.

Quick start

A request containing only url is enough to start parsing an invoice.
Request body
To see the request size limits, please refer to the Request Size Limits.

Asynchronous only

This endpoint has no synchronous mode and no async parameter. Every request runs in the background, and the first response returns a jobId rather than the parsed invoice data.
An accepted job follows these stages unless invoice processing fails:
  1. You submit the request, and PDF.co accepts the job and returns its jobId.
  2. AI Invoice Parser detects the invoice layout.
  3. The invoice data is extracted into the structured JSON format.
  4. The job is finalized, and the parsed invoice result becomes available.
Retrieve the final result by polling the Background Job Check endpoint with the jobId, or by supplying a callback URL. See Webhooks & Callbacks.

Request body

Attributes are case-sensitive and should be inside JSON for POST request. for example: { "url": "https://example.com/file1.pdf" }
string
required
URL to the source file url attribute
string
JSON string containing custom field names to extract. Use camelCase for field names (e.g., storeNumber, deliveryDate). Multiple fields should be comma-separated.
AI Invoice Parser with custom fields support automatically detects invoice layouts and extracts both standard schema data and user-specified custom fields without requiring manual templates.The customField parameter allows you to specify additional fields to extract beyond the standard schema. Some examples include:
  • storeNumber - Store or branch identifier
  • deliveryDate - Expected delivery date
  • financialCharges - Additional financial charges
  • lineTotal - Total amount for line items
  • purchaseOrderRef - Purchase order reference number
  • customerReference - Customer reference number
  • departmentCode - Department or cost center code
If a custom field returns an empty value, please contact our support team to help improve the extraction accuracy.
object
Defines a custom structure for line items in the response. See Line Item Structure for more information.
The lineItemStructure attribute lets you define a custom schema for line items. Each key is a field name you choose (in camelCase) and each value is the expected data type — either "string" or "number".When provided, every object inside the lineItems array will contain exactly the fields you specified. If a value cannot be extracted from the invoice, the field will still be present with an empty or default value instead of being omitted.

Example

With the structure above, every line item in the response will include all four fields:
Use camelCase for field names (e.g., unitPrice, totalPrice). The field names you define will be used as-is in the response, giving you full control over the output keys.
string
The callback URL (or Webhook) used to receive the POST data. see Webhooks & Callbacks.
object
See Profiles for more information.
string
Controls the encryption algorithm used for data encryption. See User-Controlled Encryption for more information. The available algorithms are: AES128, AES192, AES256.
string
Controls the encryption key used for data encryption. See User-Controlled Encryption for more information.
string
Controls the encryption IV used for data encryption. See User-Controlled Encryption for more information.
string
Controls the decryption algorithm used for data decryption. See User-Controlled Encryption for more information. The available algorithms are: AES128, AES192, AES256.
string
Controls the decryption key used for data decryption. See User-Controlled Encryption for more information.
string
Controls the decryption IV used for data decryption. See User-Controlled Encryption for more information.

Responses

The initial response confirms that the job was accepted and returns its jobId. It does not contain the parsed invoice data.
Submission response
You can use jobId to identify the corresponding callback response. Use the Job Check API to poll the job status.
When invoice parsing completes, poll Background Job Check to retrieve the final result, or receive the final callback payload shown below.
Final callback response
To see the main response codes, please refer to the Response Codes.

Invoice Schema

The body object contains all the metadata needed to understand your invoice content and includes the following attributes:

Sections


The vendor Object

An object containing vendor details.

The customer Object

An object containing customer details.

customer.billTo

customer.shipTo


The invoice Object

An object containing the invoice details.

The paymentDetails Object

An object containing payment details.

paymentDetails.bankingInformation


The others Object

An object containing additional notes.

The lineItems Object

An object detailing the line items in an invoice.
Note: there is no common structure due to significant variability between invoices! To define your own custom structure, use the lineItemStructure attribute in your request.
A typical invoice might list purchase items with details such as name, quantity or price of each individual item.

Common Objects

There are a couble of objects which are commonly used in the schema in a few places, these are as follows.

address object

contactInformation object

Setting up the Callback URL

The callback URL should be a webhook which listens to responses from the parsing results. You can setup your own webhook or use one from a provider.
If you are unsure about webhooks or callbacks, please read this Wikipedia article to get started.

Supported Languages

  • Albanian (Shqip)
  • Bosnian (Bosanski)
  • Bulgarian (Български)
  • Croatian (Hrvatski)
  • Czech (Čeština)
  • Danish (Dansk)
  • Dutch (Nederlands)
  • English
  • Estonian (Eesti)
  • Finnish (Suomi)
  • French (Français)
  • German (Deutsch)
  • Greek (Ελληνικά)
  • Hungarian (Magyar)
  • Icelandic (Íslenska)
  • Italian (Italiano)
  • Latvian (Latviešu)
  • Lithuanian (Lietuvių)
  • Norwegian (Norsk)
  • Polish (Polski)
  • Portuguese (Português)
  • Romanian (Română)
  • Russian (Русский)
  • Serbian (Српски)
  • Slovak (Slovenčina)
  • Slovenian (Slovenščina)
  • Spanish (Español)
  • Swedish (Svenska)
  • Turkish (Türkçe)
  • Ukrainian (Українська)
Inconsistent URL Encoding in cURL Output: When using cURL to make API requests, the output JSON may show URL characters encoded as Unicode escape sequences. For example, the ampersand character (&) may appear as \u0026 in the cURL output. This is normal JSON encoding behavior and does not affect the validity of the URL. The URL will function correctly when used, as JSON parsers automatically decode these escape sequences. If you’re parsing the response programmatically, your JSON parser will handle this conversion automatically.