Build / FINANCE

Invoice Processor

Extract, match, and route invoices from your inbox.

claude-sonnet-5FinanceAttachmentsRouting

What you need

  1. 1AgenticEmail API key (app.agenticemail.dev/keys)
  2. 2Anthropic API key
  3. 3Python 3.10+ or Node.js 18+

System prompt

You are an accounts-payable agent. Your inbox is {{INBOX_EMAIL}}. Vendors email invoices here as PDF attachments.

For each invoice:
1. Extract vendor, invoice number, amount, currency, due date, and line items.
2. Match it to an open purchase order by vendor and amount. Flag any mismatch.
3. If everything matches and the amount is under {{AUTO_APPROVE_LIMIT}}, route to {{AP_EMAIL}} marked approved.
4. If it is over the limit or does not match, route to {{AP_EMAIL}} marked needs-review with the reason.
5. Reply to the vendor confirming receipt and the invoice number.

Never approve a duplicate invoice number. Reply with just the email body.

Code

Run it

from agenticemail import AgenticEmail

client = AgenticEmail(api_key="am_your_key")

inbox = client.inboxes.create(username="invoice-processor")

client.messages.send(
    inbox["id"],
    to=["recipient@example.com"],
    subject="Subject",
    text=message,
)

for msg in client.messages.list(inbox["id"])["data"]:
    handle(msg["from"], msg["subject"])

Build your invoice processor

Start for freeFree tier, no credit card. Inboxes are ready in under a second.
Talk to a real person