Spoolis docs
Invoice audit
Compare mapped invoice lines with a record and return measured differences.
What it does
Invoice audit compares mapped invoice rows with mapped record rows and returns totals, findings, discrepancy drafts, and a period statement. It reports measured differences and does not approve or reject an invoice.
When to use it
Use it when an invoice and the record you trust share match columns and you want a deterministic comparison before a person decides what to do.
Authentication and scope
Send a full-scope API key. Missing keys return 401, keys without full scope return 403, and the route allows 20 requests per minute per key.
Request
Send JSON to POST /api/v1/invoice-audit. Supply exactly one of invoice_csv or bare standard-base64 invoice_pdf_base64, plus record_csv and a mapping. Invoice mapping requires key and amount; date and quantity are optional. Record mapping requires key; amount and date are optional.
{
"invoice_csv": "id,amount\nA-1,10.00",
"record_csv": "id,amount\nA-1,10.00",
"mapping": {
"invoice": {
"key": [
"id"
],
"amount": "amount"
},
"record": {
"key": [
"id"
],
"amount": "amount"
}
}
}Response
run_id identifies the run. report contains as_of, currency, optional period, totals, findings, discrepancy drafts, and a digest. statement is the period statement. PDF requests also return page, line, header, reconciliation, and dropped-line metadata.
not_in_record: an invoice key has no record row.duplicate_line: an invoice key occurs more than once.ambiguous_match: more than one record row matches the key.amount_mismatch: mapped amounts differ beyond tolerance.outside_period: the invoice date is outside the requested period.unreadable_date: the mapped date cannot be parsed.unreadable_amount: the mapped amount cannot be parsed.in_record_not_billed: a record key has no invoice line.
Limits
- Request body: 4,300,000 bytes.
- Characters in each CSV: 2,000,000.
- Rows: 5,000.
- Columns: 60.
- Characters in a cell or mapped column name: 500.
- Match-key columns: 1 through 8.
- PDF size: 3,000,000 bytes.
- PDF reads: 200 per key per day.
- Requests: 20 per minute per key.
Errors
Input reasons are file_too_large, too_many_rows, too_many_columns, cell_too_long, missing_column, empty_file, key_length_mismatch, invalid_period, invalid_tolerance, html_content, json_content, binary_content, unsupported_delimiter, header_too_long, and malformed_table. Correct the named file, field, mapping, period, tolerance, or table shape and retry.
Transport and PDF reasons are content_length_too_large, body_too_large, invalid_json, audit_failed, pdf_daily_limit, not_a_pdf, encrypted, too_many_pages, no_text_layer, no_table_found, ambiguous, read_failed, pdf_too_large, and invalid_base64. Follow the response message and remediation, send CSV or export a usable digital PDF when directed, and honor Retry-After.
Privacy
CSV and PDF inputs are read in memory for the request and are not stored. The handler records aggregate run metrics and source format, not cell values, amounts, column names, or file contents.