agentsvc.io

services / invoice-extract

dataoperational · 330 ms

Invoice Data Extraction (EU e-invoice)

Invoice data extraction for accounting agents: PDF, photo or XRechnung / ZUGFeRD / Factur-X XML to JSON (number, dates, seller and buyer with VAT ID, line items, tax per rate, totals, IBAN, payment terms). E-invoices are read exactly from the embedded XML, without AI; plain PDFs and photos by Claude Haiku 5.5. Every result is checked: totals add up, seller VAT ID in EU VIES, IBAN and BIC. Says whether the file is a real EN 16931 e-invoice. Up to 15 MB.

Run free trial ↗3 free calls per day with the example input. Paid: $0.020 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/invoice-extract", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"pdf_url":"https://agentsvc.io/samples/zugferd-invoice.pdf"}),
});
const { data, payment } = await res.json();  // payment.status "settling"; header X-Payment-Settle: sync returns payment.transaction

Input

FieldTypeDescription
pdf_urlstringPDF URL; or send one of the other inputs
pdf_base64stringPDF as base64
xmlstringXRechnung/ZUGFeRD XML text
xml_urlstringXML URL
image_urlstringPhoto or scan URL
image_base64stringPhoto as base64
validateboolean = trueCheck VAT ID and IBAN

Output

FieldTypeDescription
sourcestring
e_invoiceobject
invoice_numberstring
typestring
type_codestring
issue_datestring
due_datestring
delivery_datestring
service_periodany
currencystring
order_referenceany
buyer_referencestring
sellerobject
buyerobject
linesarray
tax_breakdownarray
totalsobject
paymentobject
notesarray
checksobject
warningsarray
modelany
extracted_atstring

Example response (data)

{
  "source": "pdf_embedded_xml",
  "e_invoice": {
    "is_e_invoice": true,
    "format": "ZUGFeRD / Factur-X EN 16931",
    "specification": "urn:cen.eu:en16931:2017",
    "note": "Structured e-invoice (EN 16931). Amounts were read exactly from the XML, no AI involved."
  },
  "invoice_number": "RE-2026-0001",
  "type": "invoice",
  "type_code": "380",
  "issue_date": "2026-10-10",
  "due_date": "2026-10-24",
  "delivery_date": "2026-10-08",
  "service_period": null,
  "currency": "EUR",
  "order_reference": null,
  "buyer_reference": "RE-2026-0001",
  "seller": {
    "name": "Malerbetrieb Muster GmbH",
    "street": "Hauptstraße 12",
    "postal_code": "20095",
    "city": "Hamburg",
    "country": "DE",
    "vat_id": "DE123456789",
    "tax_number": "22/815/08150",
    "email": "rechnung@maler-muster.de"
  },
  "buyer": {
    "name": "Bauträger Nord GmbH & Co. KG",
    "street": "Am Hafen 5",
    "postal_code": "28195",
    "city": "Bremen",
    "country": "DE",
    "vat_id": "DE987654321",
    "tax_number": null,
    "email": "buchhaltung@bautraeger-nord.de"
  },
  "lines": [
    {
      "description": "Malerarbeiten Treppenhaus: Wände und Decken, 2x gestrichen",
      "quantity": 12.5,
      "unit": "HUR",
      "unit_price": 58,
      "net_amount": 725,
      "tax_rate": 19,
      "tax_category": "S"
    },
    {
      "description": "Wandfarbe weiß 10 l",
      "quantity": 3,
      "unit": "C62",
      "unit_price": 49.99,
      "net_amount": 149.97,
      "tax_rate": 19,
      "tax_category": "S"
    },
    {
      "description": "Fachbuch Farbenlehre",
      "quantity": 1,
      "unit": "C62",
      "unit_price": 24.3,
      "net_amount": 24.3,
      "tax_rate": 7,
      "tax_category": "S"
    }
  ],
  "tax_breakdown": [
    {
      "rate": 19,
      "base": 874.97,
      "amount": 166.24,
      "category": "S",
      "exemption_reason": null
    },
    {
      "rate": 7,
      "base": 24.3,
      "amount": 1.7,
      "category": "S",
      "exemption_reason": null
    }
  ],
  "totals": {
    "net": 899.27,
    "tax": 167.94,
    "gross": 1067.21,
    "prepaid": null,
    "payable": 1067.21
  },
  "payment": {
    "iban": "DE02120300000000202051",
    "bic": "BYLADEM1001",
    "account_name": "Malerbetrieb Muster GmbH",
    "reference": "Rechnung RE-2026-0001",
    "terms": "Zahlbar innerhalb von 14 Tagen ohne Abzug.",
    "means": "SEPA credit transfer"
  },
  "notes": [
    "Vielen Dank für Ihren Auftrag & die gute Zusammenarbeit <3"
  ],
  "checks": {
    "arithmetic": {
      "ok": true,
      "issues": []
    },
    "seller_vat_id": {
      "checked": true,
      "valid": false,
      "registered_name": null,
      "source": "EU VIES"
    },
    "iban": {
      "checked": true,
      "valid": true,
      "bank": "Deutsche Kreditbank Berlin",
      "bic_matches": true,
      "reason": null
    }
  },
  "warnings": [
    "Seller VAT ID is not valid in VIES"
  ],
  "model": null,
  "extracted_at": "2026-10-10T19:59:48.740Z"
}