Invoice Json
by Agent Extraction API in Markets & finance
Invoice or receipt (PDF, PNG/JPEG/WebP image, or plain text) to structured JSON with a fixed schema: vendor (name, address, VAT ID, email, phone, IBAN), customer, invoice number, order number, issue/due date, currency (ISO 4217), subtotal, VAT total, total, amount due, VAT breakdown and line items. Every field has value, the verbatim source quote and a confidence score (0-1: quote found in the document, value matches quote, totals add up). Arithmetic checks included. $0.0075 per page (max 10 ...
https://freetier-agent-api.pages.dev/api/invoice-json- Price
- $0.0075
- per call in USDC
- Uptime
- 98.0%
- last 30 days
- Response time
- 288 ms
- 575 ms slowest 5%
- Last check
- Passed
- 4 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://freetier-agent-api.pages.dev/api/invoice-json
Each call costs $0.0075 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://freetier-agent-api.pages.dev/api/invoice-json
content-type: application/json
{
"url": "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/AzureInterior.pdf"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_base64 | string | No | POST JSON only: base64 file content |
mime_type | string | No | POST JSON only: application/pdf, image/png, image/jpeg, image/webp or text/plain |
text | string | No | invoice text instead of a file (max 40,000 chars) |
url | string | No | public http(s) URL of a PDF, PNG, JPEG or WebP invoice/receipt (max 8 MB) |
Example response
The provider's example. We can't check it without paying.
Example response, 63 lines
{
"billed_usd": 0.003,
"checks": {
"due_date_not_before_issue_date": true,
"line_items_sum_equals_subtotal_or_total": true,
"subtotal_plus_vat_equals_total": true,
"vat_breakdown_sum_equals_vat_total": true
},
"confidence_method": "Per field: 0.6 if the quote is found verbatim in the document text (+0.3 if the value matches the quote; 0.35 base if the quote is not verbatim), then +0.08/...",
"currency": "USD",
"customer": {
"address": "93B Sai Yu Chung Yuen Long, N.T., 0000, HK",
"name": "iViveLabs Limited"
},
"document_type": "invoice",
"due_date": "2014-08-03",
"input": "pdf",
"invoice_number": "42183017",
"issue_date": "2014-08-03",
"limits": "LLM extraction can misread layouts; check important values (quotes make that quick). Scanned PDFs need image input. Documents are not stored.",
"line_items": [
{
"amount": 0.01,
"confidence": 0.85,
"description": "AWS Data Transfer",
"quote": "AWS Data Transfer $0.01",
"vat_rate": 0
}
],
"missing": [
"vendor_vat_id"
],
"model": "@cf/mistralai/mistral-small-3.1-24b-instruct",
"overall_confidence": 0.94,
"pages": 1,
"sources": [
{
"name": "Cloudflare Workers AI: toMarkdown (PDF text layer), Mistral Small 3.1 24B (OCR of images + field extraction; fallback Llama 3.3 70B / Llama 4 Scout / Gemma 3...",
"note": "Documents are processed in memory and not stored or logged. No third-party LLM API.",
"url": "https://developers.cloudflare.com/workers-ai/"
}
],
"text_chars": 1839,
"totals": {
"amount_due": 4.11,
"subtotal": 4.11,
"total": 4.11,
"vat_total": 0
},
"vat_breakdown": [
{
"amount": 0,
"base": 0.01,
"confidence": 0.85,
"quote": "VAT ** $0.00",
"rate": 0
}
],
"vendor": {
"address": "410 Terry Ave North Seattle, WA 98109-5210, US",
"name": "Amazon Web Services, Inc."
}
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.0075.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://freetier-agent-api.pages.dev/api/invoice-json' \
-H 'content-type: application/json' \
--data-raw '{"url":"https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/AzureInterior.pdf"}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://freetier-agent-api.pages.dev/api/invoice-json' \
-H 'content-type: application/json' \
--data-raw '{"url":"https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/AzureInterior.pdf"}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.0075 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.0075" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.0075 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Ffreetier-agent-api.pages.dev%2Fapi%2Finvoice-json&method=POST
const res = await pay("https://freetier-agent-api.pages.dev/api/invoice-json", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"url": "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/AzureInterior.pdf"
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.0075 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.0075"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://freetier-agent-api.pages.dev/api/invoice-json",
json={
"url": "https://raw.githubusercontent.com/invoice-x/invoice2data/master/tests/compare/AzureInterior.pdf",
},
)
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 4 h ago | Passed | 402 | 381 ms | $0.0075 |
| 22 h ago | Timed out | - | - | - |
| 3 days ago | Timed out | - | - | - |
| 4 days ago | Passed | 402 | 235 ms | $0.0075 |
| 4 days ago | Passed | 402 | 1.2 s | $0.0075 |
Show 10 older checks
| 5 days ago | Passed | 402 | 334 ms | $0.0075 |
| 5 days ago | Passed | 402 | 329 ms | $0.0075 |
| 6 days ago | Passed | 402 | 1.8 s | $0.0075 |
| 6 days ago | Passed | 402 | 350 ms | $0.0075 |
| 6 days ago | Passed | 402 | 391 ms | $0.0075 |
| 7 days ago | Passed | 402 | 264 ms | $0.0075 |
| 7 days ago | Passed | 402 | 399 ms | $0.0075 |
| 7 days ago | Passed | 402 | 289 ms | $0.0075 |
| 7 days ago | Passed | 402 | 344 ms | $0.0075 |
| 8 days ago | Passed | 402 | 324 ms | $0.0075 |