Skip to main content
A shared inbox receives invoices and receipts, and they need different fields. One workflow handles both: Parse reads the file, Classify labels it as an invoice or a receipt, and the edge branch sends it to the Extract node built for that kind. The document only pays for the Extract it reaches.
The file from the inbox
INVOICE
What comes back
category100%
invoice_number98%
total_amount99%
due_date97%
NodesCredits52 per pageYou get

The workflow

The edge that leaves Classify carries branch, the category id. The API rejects an edge out of Classify without one.

Run it and read the result

The run for a one-page invoice, trimmed. classifications[].category is the category name, and only the Extract on the taken branch produces fields:
Response
Runs and results has the full envelope, section by section.

When it goes wrong

Everything comes back as the same kind. Classify picks the closest category it was given, so a thin description lets one category swallow the rest. Write each description the way a reader would tell the two apart, not as a label. “Proof of a completed payment” beats “receipt”. A document that belongs to neither kind still gets a label. Classify always picks one; it never returns nothing. Add an explicit “Other” category with its own description and leave its branch without an Extract. The document is then labelled, and no extraction is billed for it. Nothing reaches your Extract node. The edge that leaves Classify carries the category id (invoice), not the category’s display name (Invoice). The response reports the name in classifications[].category, so the two are easy to confuse. Check the branch on every edge against the id in categories. A scan comes back with poor text. Parse runs on the Flash tier here. Flash reads the PDF’s own text layer and makes no model call, which is enough for born-digital PDFs and keeps the workflow at 52 credits per page. Set "mode": "standard" on the Parse node when scans arrive, at 25 credits per page instead of 7. You are about to add a third Extract node. Two categories can share one Extract when they need the same fields: point both branches at it. Add a node only where the fields differ.

Next