Generate expense report
generate_expense_reportUse this when the user wants an expense report or reimbursement form from their receipts: read the receipts, e-mails or chosen charges yourself and send lines as objects, one per business expense, {date, merchant, amount, currency, category}, plus payment method, receipt yes/no, notes, or miles for mileage; for a stay of several nights send {merchant, amount (the stay total), quantity} or {merchant, quantity, unit_price}. Free text is only a fallback: clear lines are read from it, and any line that is ambiguous (several amounts, a breakdown that does not match its total, an unclear multiplier) is not counted and is returned under "Not counted, check these" for you to send again as structured lines. Phrases: "make an expense report from my receipts", "expense reimbursement form", "mileage reimbursement". Send each receipt once at its total; do not add subtotal, tax-included, cash tendered, change or card payment lines. A bank or card statement is not an expense report: ask the user which charges are business expenses and send only those. When free text has a Total that does not match its lines, the Total is used and the line is flagged for a check. Returns a PDF report (employee, department, period, purpose, line table, category subtotals, advances, total due, signature block), an Excel file, and policy flags (missing receipts, duplicates, weekends and holidays, outside the period, alcohol in meals, per-line cap) as warnings. Lines in another currency without a rate stay out of the total. Does not read images itself, look up exchange rates, or submit anything to an employer system.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | Yes | Expense lines, best as objects converted from what the user pasted or photographed: a list like [{"date":"2026-10-02","merchant":"Delta Air Lines","category":"Airfare","amount":412.30,"receipt":true}], or, as a fallback, text with one expense per line, e.g. "10/02/2026 Delta Air Lines, Airfare, 412.30". Mileage: {"date":"2026-10-03","merchant":"Office to client","miles":42}. | |
| period | No | Optional: report period, e.g. "October 2026" or "2026-10-01 to 2026-10-15". Lines outside it are flagged. Default: first to last line date (no period flags). | |
| advance | No | Optional: cash advance already received, subtracted from the total due, e.g. 200 or "$200". | |
| purpose | No | Optional: business purpose of the trip or period, e.g. Client visit to Acme in Denver. | |
| approver | No | Optional: manager who approves the report, e.g. Sam Patel. | |
| currency | No | Optional: currency of the report total, e.g. USD (default), EUR, GBP. | |
| line_cap | No | Optional: flag any single line above this amount, e.g. 500. Default: no cap. | |
| timezone | No | Optional: the user's IANA timezone for the default report date, e.g. Asia/Ho_Chi_Minh or America/New_York. | |
| date_order | No | Optional: MDY (US) or DMY for dates like 03/10/2026. Default: decided once for the whole list (a day above 12 decides it; otherwise day first for GBP, EUR, AUD, NZD and INR reports, month first for others). | |
| department | No | Optional: department or cost center, e.g. Sales West. | |
| report_date | No | Optional: date printed on the report, e.g. 2026-10-25. Default: today in the timezone you pass, else today in UTC. | |
| mileage_rate | No | Optional: mileage rate in the report currency or in cents, e.g. 0.70, "70 cents" or "0.30 per km". A rate with no unit is per km for km distances and per mile for mile distances. Default for USD reports: the IRS business rate for the line date (2025: 70 cents; 2026: 72.5 cents to June 30, 76 cents from July 1). | |
| employee_name | No | Optional: name printed on the report, e.g. Jordan Lee. Left blank for handwriting when not given. | |
| flag_weekends | No | Optional: flag Saturday and Sunday expenses (default true). | |
| exchange_rates | No | Optional: rates into the report currency, e.g. {"EUR": 1.08, "GBP": 1.27} (1 EUR = 1.08 USD). A line's own rate or converted amount wins. | |
| holiday_country | No | Optional: country whose public holidays are flagged, e.g. US (default), GB, CA, or none. | |
| receipt_required_over | No | Optional: receipts are required for items of this amount or more, e.g. 75 (default 75). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flags | Yes | ||
| notes | Yes | ||
| policy | Yes | ||
| report | Yes | ||
| totals | Yes | ||
| excluded | Yes | ||
| downloads | Yes | ||
| categories | Yes | ||
| lines_preview | Yes |