Files and intake
Process an invoice email into a spreadsheet.
Capture invoice mail, store the source record, and append extracted invoice fields to a spreadsheet for finance review.
Token first
Make sure the agent has these scopes.
Create a new token or update the agent's current token before trying the calls below.
Required token scopes
Outcome
What this gives you.
Invoice details become structured rows with source-message provenance instead of another manual data-entry step.
Use when
The operational shape.
- Vendor invoices arrive by email and should feed an invoice register or finance sheet.
- Your app or parser already has invoice fields and needs to write them into Gent's spreadsheet file.
- Invoice details are present in the message text and can be extracted by an workflow rule with LLM consent enabled.
API sequence
The calls to make.
Create the invoice register
Create a spreadsheet file with persistent instructions for the invoice fields finance cares about.
{
"name": "Vendor invoice register",
"file_type": "spreadsheet",
"scope": "inbox",
"inbox_id": "inb_finance",
"instructions": "Track vendor name, invoice number, invoice date, due date, amount, currency, payment terms, purchase order, and review status."
}
Append extracted invoice fields
Use this direct write when your app, parser, or operator has already extracted the invoice values.
{
"source_message_id": "msg_123",
"rows": [
{
"vendor": "Acme Supply",
"invoice_number": "INV-1042",
"invoice_date": "2026-06-14",
"due_date": "2026-07-14",
"amount": "980.00",
"currency": "USD",
"payment_terms": "Net 30",
"purchase_order": "PO-7731",
"review_status": "needs_review"
}
]
}
{
"source_message_id": "msg_123",
"rows": [
{
"vendor": "Acme Supply",
"invoice_number": "INV-1042",
"amount": "980.00",
"currency": "USD",
"review_status": "needs_review"
}
]
}
{
"source_message_id": "msg_123",
"rows": [
{
"vendor": "Acme Supply",
"invoice_number": "INV-1042",
"amount": "980.00",
"currency": "USD",
"line_items_summary": "Printer paper: 12 cases; Toner: 4 cartridges",
"review_status": "needs_review"
}
]
}
Automate rows from extracted fields
Extract invoice fields, map them to spreadsheet columns, then append a row when required fields pass validation.
{
"name": "Extract invoice rows from finance mail",
"trigger": "email_received",
"conditions": [
{"field": "to_address", "op": "eq", "value": "invoices@mail.example.com"},
{"op": "ai", "value": "The message text contains invoice details or a payment request."}
],
"writes": [
{
"source": {
"from": "trigger.attachment",
"extract": {"task": "extract_invoice", "engine": "ocr+llm"},
"map": {
"mode": "auto",
"fallback": {
"Vendor": "vendor_name",
"Invoice #": "invoice_number",
"Amount": "total_amount",
"Currency": "currency",
"Due Date": "due_date"
}
}
},
"target": {"type": "file.spreadsheet.rows", "file_id": "file_invoice_register"},
"contract": {"required": ["Vendor", "Invoice #", "Amount"]},
"policy": {"on_missing": "hold_for_review", "on_invalid": "hold_for_review"}
}
]
}
{
"name": "Send invoice attachments to parser",
"trigger": "email_received",
"conditions": [
{"field": "to_address", "op": "eq", "value": "invoices@mail.example.com"},
{"field": "has_attachments", "op": "eq", "value": true}
],
"writes": [
{
"source": {"from": "event.payload"},
"target": {"type": "webhook", "url": "https://example.com/webhooks/invoice-parser", "event_type": "workflow.invoice_candidate"}
}
]
}
Route exceptions for review
Send missing, high-value, or exception invoices to finance before payment or downstream sync.
{
"creator_inbox_id": "inb_finance",
"title": "Review invoice INV-1042",
"request_type": "approval",
"routing_mode": "parallel",
"completion": "required",
"failure_mode": "block",
"due_at": "2026-06-18T12:00:00Z",
"start": true,
"source": {
"type": "email",
"message_id": "msg_123",
"thread_id": "thr_123",
"subject": "Invoice INV-1042"
},
"recipients": [
{"kind": "email", "email": "finance@example.com"}
]
}
Controls
Review points.
- No new Gent feature is needed when invoice fields are supplied directly to the rows endpoint.
- Attachment-only PDF or image invoices need an extraction/OCR step before this can be fully automatic; until that lands, extract externally and append rows directly.
Related