# invoices.filesExtract

Read an uploaded invoice file and return extracted invoice candidates with suggested customers. For CSV files, first call without csvMapping to get headers, then call again with the confirmed column mapping.

`GET | POST /api/v1/accounting/invoices.filesExtract`

Permissions: `accounting:read` · Roles: admin, finance

MCP tool: `accounting_invoices_files_extract`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `sha256` | string | Yes | The SHA-256 hash of the file's exact bytes, as 64 lowercase hex characters. SHA-256 hash as 64 lowercase hex characters. |
| `filename` | string | Yes | The file's name, including its extension. 1–200 characters. |
| `mimeType` | string | Yes | The file's type, such as image/jpeg or application/pdf. at most 150 characters. |
| `csvMapping` | object or null |  |  |
| `csvMapping.number` | string | Yes | 1–200 characters. |
| `csvMapping.issueDate` | string | Yes | The date the document was issued, as YYYY-MM-DD. 1–200 characters. |
| `csvMapping.dueDate` | string or null | Yes | The date payment is due, as YYYY-MM-DD. |
| `csvMapping.customer` | string | Yes | 1–200 characters. |
| `csvMapping.total` | string | Yes | 1–200 characters. |
| `csvMapping.currency` | string or null | Yes | Three-letter currency code, such as CAD or USD. |
| `csvMapping.status` | string or null | Yes | Only include records with this status. |
| `csvMapping.description` | string or null | Yes | A short description. |

## Example request

```bash
curl -G https://app.getoatmilk.com/api/v1/accounting/invoices.filesExtract \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  --data-urlencode 'sha256=9f2b5c1d7e3a4b6c8d0e2f4a6b8c0d2e4f6a8b0c2d4e6f8a0b2c4d6e8f0a2b4c' \
  --data-urlencode 'filename=receipt.pdf' \
  --data-urlencode 'mimeType=example'
```

Reference page: https://app.getoatmilk.com/docs/api/invoices.filesExtract
