All articles
invoiceaccounts-payableapiautomationfinance

How to Automate Invoice Data Extraction with an API

Arthur Sterling

Arthur Sterling

Lead Developer Advocate, Parse

How to Automate Invoice Data Extraction with an API

Accounts payable teams, finance automation platforms, and ERP integrations all share the same bottleneck: someone has to read a PDF invoice and type the numbers into a system. At any volume, that process becomes a major operational cost and a source of errors.

The Parse Invoice Parser API eliminates this entirely. Send a PDF invoice, get back a clean JSON object with every field extracted, ready to push into QuickBooks, Xero, NetSuite, or any other downstream system.

What Gets Extracted

A single API call returns:

  • Vendor: Name and full address
  • Buyer: Name and full address
  • Invoice meta: Invoice number, issue date, due date, payment terms, PO number
  • Financials: Subtotal, total, tax amount, discount, currency (ISO code)
  • Line items: Description, quantity, unit, unit price, line total, SKU, tax rate

The items array gives you full line-item detail, so you can push individual items into your inventory or cost-accounting system rather than just a top-level total.

Getting Started

Sign up at cparse.com/dashboard and grab your API key. New accounts include free credit with no credit card required.

The base URL is https://api.cparse.com/invoice/v1.

Extract an Invoice: Python

import requests

url = "https://api.cparse.com/invoice/v1/extract-invoice"
headers = {"X-API-Key": "YOUR_API_KEY"}

with open("invoice.pdf", "rb") as f:
    response = requests.post(url, files={"file": f}, headers=headers)

data = response.json()["data"]
print(data["vendor_name"])      # "Acme Corporation"
print(data["total_amount"])     # 1250.00
print(data["currency"])         # "USD"

for item in data.get("items", []):
    print(item["description"], item["quantity"], item["amount"])

Extract an Invoice: JavaScript

import FormData from 'form-data';
import fs from 'fs';
import axios from 'axios';

const form = new FormData();
form.append('file', fs.createReadStream('invoice.pdf'));

const response = await axios.post('https://api.cparse.com/invoice/v1/extract-invoice', form, {
  headers: {
    ...form.getHeaders(),
    'X-API-Key': 'YOUR_API_KEY',
  },
});

const { vendor_name, total_amount, items } = response.data.data;
console.log(vendor_name, total_amount);

Extracting Only Specific Fields

The /extract-invoice endpoint supports a fields query parameter so you can request only what you need:

curl --request POST \
  --url 'https://api.cparse.com/invoice/v1/extract-invoice?fields=invoice_number&fields=total_amount&fields=vendor_name&fields=due_date' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --form 'file=@invoice.pdf'

Scoping fields reduces token usage and speeds up response time at scale. Use the /fields endpoint to see the full list of available field names.

Discovering Available Fields

curl https://api.cparse.com/invoice/v1/fields

Returns a complete list of invoice-level and line-item-level fields you can request.

Integration Patterns

AP automation: Extract every field on receipt and immediately create a draft bill in your accounting platform via their API.

ERP sync: Pull line items and push them to purchase order matching workflows in SAP or Oracle.

Audit archiving: Store the structured JSON alongside the original PDF for compliance and auditability.

Duplicate detection: Use invoice_number and vendor_name as a composite key to detect duplicate invoices before payment.

Supported Formats

The API accepts PDF and image-based invoices (JPEG, PNG). ZIP archives containing a single invoice file are also supported.

Next Steps

See the complete field reference and code examples in the Invoice Parser documentation. Get your API key from cparse.com/dashboard.


Arthur Sterling is the Lead Developer Advocate at Parse.