# Extractivio documentation Source: https://extractivio.com/docs. Each section below is also available at https://extractivio.com/docs/.md. # Quickstart Extractivio turns a PDF bank or credit card statement into a list of transactions: date, description, signed amount and running balance, plus a check that the balances add up. There are three ways to call it. Pick the one that matches where the statement is and what is calling. | You are | The statement is | Use | | --- | --- | --- | | Writing code | A file or a URL | [REST API](https://extractivio.com/docs/convert.md) | | An AI agent with MCP support | Online (a URL) or small enough to send as base64 | [Hosted MCP server](https://extractivio.com/docs/mcp.md) | | An AI agent on the user's own computer | A local file | [Local MCP server](https://extractivio.com/docs/mcp-local.md), free, no account | ## 1. Get an API key The REST API and the hosted MCP server need a key. Keys are available on the Pro plan (500 pages a month) and the Business plan (5,000 pages a month). 1. Sign in at https://extractivio.com/login. 2. Open https://extractivio.com/account and click "Create API key". 3. Copy the key. It starts with `ex_` and is shown only once. ## 2. Convert a statement ```bash curl -X POST "https://extractivio.com/api/v1/convert" \ -H "Authorization: Bearer ex_your_key" \ -F "file=@statement.pdf" ``` Or point at a PDF that is already online: ```bash curl -X POST "https://extractivio.com/api/v1/convert" \ -H "Authorization: Bearer ex_your_key" \ -H "Content-Type: application/json" \ -d '{"file_url": "https://example.com/statement.pdf"}' ``` ## 3. Read the result ```json { "id": null, "filename": "statement.pdf", "pages": 3, "currency": "USD", "balance_check": { "checkable": 41, "reconciled": 41 }, "warnings": [], "transactions": [ { "date": "2026-03-01", "description": "CARD GREENFIELD MARKET", "amount": -42.18, "balance": 2845.30 } ] } ``` Three things to check on every result: 1. `amount` is negative for money leaving the account and positive for money coming in. 2. `balance_check.reconciled` should equal `balance_check.checkable`. If it is lower, some rows are probably wrong. 3. `warnings` should be empty, or you should act on each one. See [Response and data model](https://extractivio.com/docs/response.md). ## Next - [Convert endpoint reference](https://extractivio.com/docs/convert.md) - [Guide for AI agents](https://extractivio.com/docs/agent-guide.md) - [Errors](https://extractivio.com/docs/errors.md) and [Limits](https://extractivio.com/docs/limits.md) --- # Authentication Every request to the REST API and to the hosted MCP server carries an API key in the `Authorization` header. ``` Authorization: Bearer ex_your_key ``` ## Keys - Created and revoked at https://extractivio.com/account. - Start with `ex_`. The full key is shown once, at creation. Only a hash is stored, so a lost key cannot be recovered: revoke it and create a new one. - An account can have up to 10 active keys. - A key gives access to the account's quota and stored conversions. Treat it like a password. Do not put it in client-side code, in a public repository or in a prompt that is logged. ## Plans | Plan | API and hosted MCP | Pages per month | | --- | --- | --- | | Free | No | 0 | | Pro | Yes | 500 | | Business | Yes | 5,000 | The quota is shared between the REST API, the hosted MCP server and (on Business) email imports. It resets on the first day of each calendar month, UTC. The local MCP server and the converter on the website need no key and use no quota. ## Failures | HTTP status | Code | Meaning | | --- | --- | --- | | 401 | `unauthorized` | The header is missing, malformed, or the key was revoked. | | 403 | `plan_required` | The key belongs to an account on the Free plan. | If a key stops working after a plan change, check the plan on the account page: downgrading to Free disables API access but does not delete the keys. --- # Convert endpoint ``` POST https://extractivio.com/api/v1/convert ``` Converts one PDF statement per request. The call is synchronous: the response contains the transactions. Typical statements take one to three seconds; the server gives up after 60 seconds. ## Request body Send the PDF in one of four ways. | Content-Type | Body | When to use | | --- | --- | --- | | `multipart/form-data` | A form field named `file` | You have the file on disk. | | `application/pdf` | The raw PDF bytes | You have the bytes in memory. | | `application/json` | `{"file_url": "https://..."}` | The PDF is online. | | `application/json` | `{"file_base64": "..."}` | No file system and no URL (for example inside a sandboxed agent). | JSON bodies may also include `"filename"`, used as the name of stored results and downloaded files. Rules for `file_url`: - `https` only, default port only, no username or password in the URL. - The host must resolve to a public IP address. Private, loopback, link-local and cloud metadata addresses are refused. - Up to 3 redirects are followed, each one checked the same way. - The download must finish within 15 seconds and be 15 MB or smaller. - The server sends no cookies or credentials. Links that need a login will fail with `download_failed`. Use a pre-signed or public link. ## Query parameters | Name | Values | Default | Meaning | | --- | --- | --- | --- | | `format` | `json`, `csv`, `xero`, `qbo`, `ofx`, `qfx`, `qif` | `json` | Response format. Anything but `json` returns the file content itself. See [Output formats](https://extractivio.com/docs/formats.md). | | `date_order` | `dmy`, `mdy` | auto | How to read ambiguous numeric dates such as `03/04`. See below. | | `bank` | a bank slug | auto | Forces that bank's parsing rules. See [Bank rules](https://extractivio.com/docs/banks.md). | | `store` | `true` | `false` | Keeps the result in the account so it appears in `GET /api/v1/conversions`. | ### Date order Dates are returned as ISO `YYYY-MM-DD`. Reading them from the PDF can be ambiguous: `03/04/2026` is 3 April in most of the world and 4 March in the United States. 1. If any date in the statement has a part greater than 12 (for example `25/03`), the order is detected from the data and `date_order` is ignored. 2. Otherwise `date_order` decides, if you passed it. 3. Otherwise the statement is read day-first, unless its text identifies a bank with a month-first rule (Bank of America, Capital One, Chase). Pass `date_order=mdy` for United States statements and `date_order=dmy` elsewhere whenever you know the country. It removes the only silent failure mode of this API. ## Response, format=json Status 200, `Content-Type: application/json`. ```json { "id": "c0ffee", "filename": "statement.pdf", "pages": 3, "currency": "USD", "balance_check": { "checkable": 41, "reconciled": 41 }, "warnings": [], "transactions": [ { "date": "2026-03-01", "description": "CARD GREENFIELD MARKET", "amount": -42.18, "balance": 2845.30 }, { "date": "2026-03-02", "description": "PAYROLL NORTHWIND LOGISTICS", "amount": 3200.00, "balance": 6045.30 } ] } ``` `id` is `null` unless `store=true`. Every field is described in [Response and data model](https://extractivio.com/docs/response.md). ## Response, other formats Status 200 with the file as the body, the matching `Content-Type`, and `Content-Disposition: attachment` with a file name derived from the input. ## Response headers | Header | Meaning | | --- | --- | | `x-pages` | Pages in this PDF, the amount charged to the quota. | | `x-pages-used` | Pages used this month, including this call. | | `x-pages-included` | Monthly quota of the plan. | ## What counts against the quota - A successful conversion: its page count. - A scanned PDF (`scanned_pdf`): its page count, because the file was read before the problem was known. - Not counted: requests rejected before the PDF was parsed (`unauthorized`, `not_pdf`, `too_large`, `download_failed`, `quota_exceeded`, `rate_limited`) and PDFs that could not be opened (`unreadable_pdf`). ## One statement per call A request converts one PDF. To process several, send several requests. Stay under 60 requests a minute per account; see [Limits](https://extractivio.com/docs/limits.md). --- # Response and data model The same result object is returned by the REST API (`format=json`), by the hosted MCP tool `convert_statement` (as `structuredContent`) and by the local MCP server. ## Result | Field | Type | Meaning | | --- | --- | --- | | `id` | string or null | Identifier of the stored result. `null` unless you asked for storage. | | `filename` | string | Name of the input file. `statement.pdf` when unknown. | | `pages` | integer | Pages in the PDF. This is what the call cost. | | `currency` | string or null | ISO 4217 code found in the statement text (for example `EUR`). `null` when the statement only shows an ambiguous symbol such as `$`, or no currency at all. | | `balance_check` | object | See below. | | `warnings` | array of strings | Conditions that reduce confidence. See below. | | `transactions` | array | In the order they appear in the statement. | ## Transaction | Field | Type | Meaning | | --- | --- | --- | | `date` | string | ISO date, `YYYY-MM-DD`. The posting or transaction date printed first on the row. | | `description` | string | The row's text without the date and amounts. Continuation lines are appended, separated by a space. | | `amount` | number | Signed, two decimals at most. Negative: money left the account. Positive: money came in. | | `balance` | number or null | The running balance printed on that row. `null` when the statement has no balance column. | ### Sign convention The sign always describes the account holder's point of view. - Bank account: a card payment, withdrawal or fee is negative. A salary or deposit is positive. - Credit card: a purchase is negative. A payment to the card or a refund is positive. This holds even though card statements usually print purchases as positive numbers. How the sign is determined, in order of reliability: 1. Separate columns (debit and credit, withdrawals and deposits, paid out and paid in), identified from the column headers. 2. An explicit sign or marker on the amount: a minus sign, brackets, `CR` or `DR`. 3. The running balance: if the balance went down by the amount, it was money out. 4. Conventions: on a statement where most amounts are unsigned and a few are negative, it is read as a credit card (see the `card-convention` warning). If none of these apply, signs cannot be known. Amounts are then returned as negative and the `unsigned-amounts` warning is set. ## balance_check ```json "balance_check": { "checkable": 41, "reconciled": 41 } ``` | Field | Meaning | | --- | --- | | `checkable` | Number of rows that have a printed balance and a previous balance to compare with. | | `reconciled` | Number of those rows where previous balance + amount = printed balance, to the cent. | How to read it: - `reconciled == checkable` and `checkable > 0`: every checked row is arithmetically consistent with the statement. This is strong evidence that amounts, signs and row order are right. It does not prove dates or descriptions. - `reconciled < checkable`: `checkable - reconciled` rows do not add up. Common causes: a row was missed, a multi-line row was split, or the statement contains several accounts (the balance jumps where one account ends and the next begins, which costs exactly one row per boundary). - `checkable == 0`: the statement prints no running balance, so nothing could be verified. The result may still be right, but it is unverified. ## warnings | Value | Meaning | What to do | | --- | --- | --- | | `year-inferred` | Dates on the statement have no year (for example `12 Jan`). The year was taken from the most frequent year in the statement text, or the current year if none was found. | Confirm the year. Statements that span December and January get the same year on both sides. | | `unsigned-amounts` | No columns, signs or balance tell money in from money out. All amounts were returned as negative. | Do not trust the signs. Ask the user, or classify rows yourself from the descriptions and say so. | | `card-convention` | Read as a credit card statement: unsigned charges became negative, and payments or credits became positive. | Usually correct. Mention that it was treated as a card statement. | ## Things the result does not contain - Account numbers, account holder names, statement period, opening and closing balances. Opening balance lines are used for the balance check and then dropped. - Categories, merchants or counterparties as separate fields. The description is the raw text. - Per-row confidence. Use `balance_check` and `warnings`. - Totals and summary lines printed on the statement. They are filtered out on purpose. ## Several accounts in one PDF All rows are returned in one list, in document order. There is no account field. Expect one failed balance check at each account boundary. --- # Output formats Select a format with `?format=` on the REST API or the `format` argument of the MCP tool. JSON is the default and the only format that carries `balance_check` and `warnings`. If you need those and a file, call once with `json` and build the file yourself, or call twice. | Format | For | Content-Type | | --- | --- | --- | | `json` | Code and agents | `application/json` | | `csv` | Spreadsheets, most accounting tools | `text/csv; charset=utf-8` | | `xero` | Xero bank statement import | `text/csv; charset=utf-8` | | `qbo` | QuickBooks (Web Connect) | `application/vnd.intu.qbo` | | `ofx` | Generic OFX importers | `application/x-ofx` | | `qfx` | Quicken | `application/vnd.intu.qfx` | | `qif` | Older tools | `application/qif` | Excel (`.xlsx`) is available in the web app only. ## csv - UTF-8 with a byte order mark, CRLF line endings, comma separated. - Columns: `Date`, `Description`, `Amount`, and `Balance` when the statement has one. - Dates are ISO. Amounts use a dot as decimal separator, no thousands separators, two decimals. - Descriptions that start with `=`, `+`, `-` or `@` are prefixed with an apostrophe so spreadsheets do not run them as formulas. ## xero A CSV with the header `*Date,*Amount,Payee,Description,Reference`. `Payee` and `Reference` are empty; the statement text goes in `Description`. ## qbo, ofx, qfx OFX 1.02 in SGML form. `qbo` and `qfx` are the same file with an `INTU.BID` element, which QuickBooks and Quicken require. Fixed values to be aware of: - `INTU.BID` is `3000`, a widely used generic bank id. QuickBooks may ask the user to pick the bank. - `BANKID` is `000000000`, `ACCTID` is `0000` and `ACCTTYPE` is `CHECKING`. The statement's real account details are not read. - `CURDEF` is the detected currency, or `USD` when none was detected. - `FITID` is derived from the row's position, date, amount and description, so the same PDF always produces the same ids. - `NAME` is the description cut to 32 characters; the full text is in `MEMO`. - Characters outside ASCII are replaced, because the header declares US-ASCII. - `LEDGERBAL` is the last printed balance, or `0.00` when the statement has none. Check a file before importing it with the `validate_ofx` MCP tool or the validator at https://extractivio.com/tools/qbo-validator. ## qif `!Type:Bank`, one record per transaction with `D` (date as `MM/DD/YYYY`), `T` (amount) and `P` (description). ## json See [Response and data model](https://extractivio.com/docs/response.md). --- # Errors REST errors are JSON with an HTTP status: ```json { "error": { "code": "not_pdf", "message": "The file is not a PDF." } } ``` Branch on `code`, not on `message`. Messages may change. | Status | Code | Cause | Retry? | | --- | --- | --- | --- | | 400 | `missing_file` | No file in the request: empty body, no `file` field, or JSON without `file_url` or `file_base64`. | No. Fix the request. | | 400 | `not_pdf` | The bytes do not start with a PDF header. Often an HTML error page or login page downloaded instead of the PDF. | No. | | 400 | `bad_format` | `format` is not one of the supported values. | No. | | 400 | `bad_json` | `Content-Type` is JSON but the body does not parse. | No. | | 400 | `download_failed` | `file_url` could not be fetched: not https, private address, timeout, HTTP error, too many redirects or too large. The message says which. | Only after fixing the URL. | | 401 | `unauthorized` | Missing, malformed or revoked key. | No. | | 403 | `plan_required` | The account is on the Free plan. | No. | | 413 | `too_large` | The PDF is over 15 MB. | No. Split the PDF. | | 422 | `scanned_pdf` | The PDF has no text layer (it is a scan or photo). | No. Run OCR first, or use the web app's AI extraction. | | 422 | `unreadable_pdf` | The PDF is encrypted, password protected or damaged. | No. Remove the password and resend. | | 429 | `rate_limited` | More than 60 requests in a minute for this account. | Yes, after 60 seconds. | | 429 | `quota_exceeded` | The monthly page quota is used up. | Next month, or after upgrading. | | 501 | `not_configured` | The deployment has no database configured. | No. Contact support. | A 5xx without a JSON body is a platform error. Retry once after a few seconds. ## A 200 that is still a problem A successful response can contain zero transactions or a failed balance check. These are not errors in the HTTP sense, so check them: - `transactions` is empty: the layout was not understood. Do not retry with the same input. Try the other `date_order` only if dates are the issue; otherwise report that the statement could not be read. - `balance_check.reconciled < balance_check.checkable`: treat the result as partly wrong. - `warnings` is not empty: see [Response and data model](https://extractivio.com/docs/response.md). ## MCP The hosted MCP server reports tool problems inside a normal tool result with `isError: true` and a text of the form `code: message`, using the same codes as above. Authentication and plan problems are HTTP errors (401, 403, 429) with a JSON-RPC error body, before any tool runs. --- # Limits and data handling ## Limits | Limit | Value | | --- | --- | | Monthly quota, Pro | 500 pages | | Monthly quota, Business | 5,000 pages | | Rate | 60 requests per minute per account, REST and MCP combined | | File size | 15 MB | | Files per request | 1 | | Processing time | 60 seconds | | `file_url` download | 15 seconds, 3 redirects | | API keys per account | 10 | | MCP batch | 20 JSON-RPC messages per POST | | `validate_ofx` input | 5 MB of text | | Stored results per list call | 100 (REST), 50 (MCP) | The quota is counted in PDF pages, not in requests or transactions. A one-page statement costs 1, a twelve-page statement costs 12. It resets on the first day of each month, UTC. `GET /api/v1/usage` and the `get_usage` tool report where you stand. ## What is supported - Text-based PDFs: statements downloaded from online banking. - Not supported by the API: scanned or photographed statements, password-protected PDFs, images, and other file types. - Languages and formats: dates with month names in English, French, Spanish, German, Portuguese, Italian, Dutch and Polish; numeric dates; Japanese dates; decimal commas and decimal points; currencies without decimals. ## Data handling - The PDF is processed in memory and discarded when the request ends. It is not written to disk or kept. - The result is not stored unless you pass `store=true` (REST) or `store: true` (MCP). - Stored results contain the transactions, the file name and the balance check. They are kept for up to 30 days and are visible only to the account that created them. - A PDF fetched from `file_url` is downloaded by our server. The URL itself is not stored. - Usage is recorded as a page count and a timestamp. No statement content is logged. ## When the file must not leave the device Use the [local MCP server](https://extractivio.com/docs/mcp-local.md) or the converter at https://extractivio.com/en. Both read the PDF on the user's machine and send nothing to Extractivio. ## Accuracy There is no accuracy guarantee. The parser uses general rules about where dates, descriptions and amounts sit on a page, plus specific rules for some banks. It is tested on synthetic statements and on layout samples for 14 banks, not on live statements from every bank. Always use the balance check, and have a person review the data before it is used for accounting or tax. --- # Hosted MCP server The hosted server exposes the conversion as tools that any MCP client can call. | | | | --- | --- | | Endpoint | `https://extractivio.com/api/mcp` | | Transport | Streamable HTTP, stateless. `POST` only. | | Authentication | `Authorization: Bearer ex_your_key` on every request | | Plans | Pro and Business | | Protocol versions | 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 | | Capabilities | `tools`, `resources` (this documentation) | There are no sessions and no server-sent streams: each POST gets a JSON response. `GET` and `DELETE` answer 405. Clients that can only authenticate through an OAuth sign-in screen cannot connect yet. Clients that let you set a header can. ## Connect Claude Code: ```bash claude mcp add --transport http extractivio https://extractivio.com/api/mcp \ --header "Authorization: Bearer ex_your_key" ``` Cursor, VS Code, Windsurf and other clients that read an `mcp.json`: ```json { "mcpServers": { "extractivio": { "url": "https://extractivio.com/api/mcp", "headers": { "Authorization": "Bearer ex_your_key" } } } } ``` From code, with the official TypeScript SDK: ```ts import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; const client = new Client({ name: "my-agent", version: "1.0.0" }); await client.connect( new StreamableHTTPClientTransport(new URL("https://extractivio.com/api/mcp"), { requestInit: { headers: { Authorization: "Bearer " + process.env.EXTRACTIVIO_KEY } }, }), ); const result = await client.callTool({ name: "convert_statement", arguments: { file_url: "https://example.com/statement.pdf", date_order: "mdy" }, }); console.log(result.structuredContent.transactions.length); ``` Raw JSON-RPC, for clients without an SDK: ```bash curl -X POST "https://extractivio.com/api/mcp" \ -H "Authorization: Bearer ex_your_key" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_usage","arguments":{}}}' ``` ## Tools ### convert_statement Extracts the transactions from one PDF statement. Uses quota (one unit per page). | Argument | Type | Required | Meaning | | --- | --- | --- | --- | | `file_url` | string | one of the two | Public https URL of the PDF. | | `file_base64` | string | one of the two | The PDF bytes, base64-encoded. A `data:` URL prefix is accepted. | | `filename` | string | no | Name for stored results. | | `format` | string | no | `json` (default), `csv`, `xero`, `qbo`, `ofx`, `qfx`, `qif`. | | `date_order` | string | no | `dmy` or `mdy`. Pass it whenever you know the country. | | `bank` | string | no | Bank slug to force that bank's rules. | | `store` | boolean | no | Keep the result. Default false. | Result with `format: "json"`: - `content[0].text`: a one-line summary, a blank line, then the result as JSON. - `structuredContent`: the result object described in [Response and data model](https://extractivio.com/docs/response.md). Summary line example: ``` 42 transactions, 1 page(s), currency USD, balance check 42/42, warnings: year-inferred. Quota: 12/500 pages this month. ``` Result with any other format: `content[0].text` is the summary, a blank line, then the file content. There is no `structuredContent`. Failure: `isError: true` and a text such as `scanned_pdf: The PDF has no text layer...`. Codes are listed in [Errors](https://extractivio.com/docs/errors.md). Choosing between `file_url` and `file_base64`: prefer `file_url`. Base64 puts the whole file in the model's context, which is slow and expensive above a few hundred kilobytes. If the file is on the user's disk, the [local server](https://extractivio.com/docs/mcp-local.md) is the better tool. ### validate_ofx Checks the text of an OFX, QFX or QBO file. Uses no quota. | Argument | Type | Required | Meaning | | --- | --- | --- | --- | | `content` | string | yes | Full text of the file, up to 5 MB. | | `filename` | string | no | Name with extension. `.qbo` and `.qfx` make a missing `INTU.BID` an error instead of a note. | `structuredContent`: ```json { "valid": false, "issues": [ { "level": "error", "message": "1 FITID value(s) are used more than once. Duplicates are silently skipped on import." } ], "statements": [ { "kind": "bank", "currency": "USD", "account_type": "CHECKING", "start": "2026-03-01", "end": "2026-03-31", "transactions": 42, "ledger_balance": 1820.55 } ] } ``` `valid` is true when there are no issues of level `error`. Levels are `error`, `warning` and `info`. ### list_conversions Lists results stored in the account, newest first: email imports and conversions made with `store: true`. Uses no quota. | Argument | Type | Default | Meaning | | --- | --- | --- | --- | | `limit` | integer, 1 to 50 | 10 | How many to return. | | `include_transactions` | boolean | false | Include every transaction instead of the summary only. | ### get_usage No arguments. Returns `{ "plan": "pro", "pages_used": 12, "pages_included": 500 }`. Call it before a large batch to see whether the quota is enough. ## Resources The server lists this documentation as MCP resources with URIs of the form `extractivio://docs/`, in Markdown. Clients that support resources can read them without leaving the session. ## Errors at the transport level | HTTP status | When | | --- | --- | | 401 | Missing or invalid key. The response has a `WWW-Authenticate: Bearer` header. | | 403 | The account is on the Free plan. | | 429 | Over 60 requests a minute. | | 405 | `GET` or `DELETE`. | | 501 | The deployment is not configured. | --- # Local MCP server The local server is an open-source program that runs on the user's machine and talks to the agent over stdio. It needs no account and no key, uses no quota, and never uploads the file. Use it when the statement is a file on disk, or when the file must not leave the device. ## Install ```json { "mcpServers": { "extractivio": { "command": "npx", "args": ["-y", "@extractivio/mcp-server"] } } } ``` Claude Code: `claude mcp add extractivio -- npx -y @extractivio/mcp-server` Requires Node.js 18 or later. If the package is not yet on npm, build it from `packages/mcp-server` in the source repository and point the command at `node /path/to/dist/index.js`. ## Tools | Tool | Arguments | Returns | | --- | --- | --- | | `convert_statement` | `path` (local PDF), `format` (`json`, `csv`, `xero`, `ofx`, `qbo`, `qif`), `date_order` (`dmy`, `mdy`) | A summary line, then the transactions in the chosen format. | | `validate_ofx_file` | `path` (local `.ofx`, `.qfx` or `.qbo`) | One line per statement, then one line per issue. | | `reconcile_statements` | `path_a`, `path_b` (two local PDFs), `window_days` (default 3) | Matched count, the rows found only in A, the rows found only in B, and the totals. | Results are text. The JSON format of `convert_statement` contains the same fields as the hosted server's result: `currency`, `balance_check`, `warnings` and `transactions`. ## Differences from the hosted server | | Local | Hosted | | --- | --- | --- | | Input | A file path | A URL or base64 | | Account | None | Pro or Business key | | Quota | None | Pages per month | | File leaves the device | No | Yes | | Stored results, email imports, usage | No | Yes | | Reconcile two statements | Yes | No | | File size limit | 25 MB | 15 MB | The parser is the same in both. --- # Guide for AI agents This page is written for the agent. It describes the workflow that gives correct results and the checks to run before telling a user that a statement was converted. ## 1. Choose the path | Situation | Use | | --- | --- | | The PDF is a file on the user's machine and you can run local MCP servers | Local server, `convert_statement` with `path` | | The PDF is at a URL you can share | Hosted server or REST API with `file_url` | | You hold the bytes and have no URL | REST API with multipart, or `file_base64` for small files | | The user said the file is confidential or must stay local | Local server only. Do not send it to the hosted API. | Sending a statement to the hosted API uploads the user's financial data to Extractivio's servers. If the user has not clearly asked for the conversion, confirm before sending. ## 2. Call with the right arguments - Pass `date_order`. Use `mdy` for statements from the United States and `dmy` for other countries. If you do not know the country, infer it from the bank name or the currency, and otherwise leave it out. - Leave `format` as `json` unless the user asked for a specific file. JSON is the only format that includes the balance check and warnings. - Use `store: true` only if the user wants to retrieve the result later. - One PDF per call. For several statements, call once per file and keep the results separate. ## 3. Check the result before using it Run these checks in order. 1. **Error?** If the call failed, read the code. `scanned_pdf`: tell the user the PDF is a scan and needs OCR, or suggest the AI extraction option in the web app. `unreadable_pdf`: ask for a version without a password. `download_failed`: the link is not publicly reachable. Do not retry the same input. 2. **Empty?** If `transactions` is empty, the layout was not understood. Say so. Do not invent rows from your own reading of the PDF and present them as the tool's output. 3. **Balance check.** Compare `balance_check.reconciled` with `balance_check.checkable`. - Equal and greater than zero: amounts and signs are consistent with the statement. - Lower: some rows are wrong. Report how many. One failure in a statement with several accounts is expected at the account boundary. - `checkable` is zero: nothing could be verified. Say that the result is unverified. 4. **Warnings.** - `year-inferred`: check that the year fits the statement period. For a statement covering December and January, fix the year on one side yourself and tell the user. - `unsigned-amounts`: the signs are not reliable. All amounts are negative. Either ask the user which rows are income, or classify them from the descriptions and state clearly that you did. - `card-convention`: purchases are negative and payments positive. Mention it. 5. **Sanity.** Dates should fall in one statement period. If months look swapped (for example everything is on the 1st to the 12th of different months), call again with the other `date_order`. ## 4. Report to the user Always include, in plain words: - How many transactions were extracted and the date range. - The balance check result, for example "all 41 balances reconcile" or "no running balance on this statement, so the amounts could not be verified". - Any warning and what you did about it. - A reminder to review the data before using it for accounting or tax. Example: > I extracted 42 transactions from 1 to 31 March 2026 (USD). All 42 running balances reconcile, so the amounts and signs match the statement. The statement prints dates without a year; I used 2026, which matches the statement period. Please review before importing. ## 5. Working with the data - Amounts are already signed. Sum them directly: the total is the net change of the account. Do not flip signs for credit card statements. - The opening balance is the first row's `balance` minus its `amount`. The closing balance is the last row's `balance`. - `currency` can be `null`. Do not assume USD; ask or infer from the bank. - Descriptions are raw statement text. If you categorise or clean them, keep the original available. - The result has no account number, holder name or statement period. If you need them, read them from the PDF yourself and label them as your own reading. ## 6. Producing files for accounting software - QuickBooks: `format: "qbo"`. Xero: `format: "xero"`. Quicken: `format: "qfx"`. Anything else: `csv`. - Before giving a `.qbo`, `.qfx` or `.ofx` file to a user, run `validate_ofx` on it, and on any such file the user says will not import. - QBO and QFX files use placeholder account details and a generic bank id. Tell the user they may be asked to choose the bank and account during import. ## 7. Quota and pacing - Each page costs one unit of the monthly quota. Call `get_usage` before converting a large batch, and tell the user if the batch will not fit. - Stay under 60 calls a minute. On `rate_limited`, wait 60 seconds. - On `quota_exceeded`, stop. Do not loop. ## Do not - Do not present a result with a failed or absent balance check as verified. - Do not fill gaps with guessed transactions. - Do not send statements the user did not ask you to process, and do not send them to the hosted API when they asked for local processing. - Do not put the API key in code you show the user, in files you commit or in messages. - Do not give tax or accounting advice on the basis of an unreviewed extraction. ## System prompt snippet Paste this into an agent's instructions when it has the Extractivio tools: ``` You can convert PDF bank and credit card statements with the Extractivio tools. - Prefer the local tool (path) for files on disk; use the hosted tool (file_url) for files online. - Pass date_order="mdy" for US statements and "dmy" otherwise when you know the country. - Amounts are negative for money out and positive for money in, including on credit cards. - After every conversion, compare balance_check.reconciled to balance_check.checkable and read warnings. Tell the user the transaction count, date range, balance check result and any warning. If the balance check fails or is absent, say the result is not verified. - Never invent transactions. If nothing is extracted or the PDF is a scan, say so. - Remind the user to review the data before using it for accounting or tax. ``` --- # Function calling without MCP If your agent framework uses function calling instead of MCP, define a tool and execute it against the REST API. Ready-made definitions are served at https://extractivio.com/agent-tools.json. ## Tool definition, Anthropic format ```json { "name": "convert_statement", "description": "Extract transactions from a text-based PDF bank or credit card statement. Returns date (ISO), description, signed amount (negative = money out) and running balance per transaction, plus a balance check. Provide a public https URL. Scanned PDFs are not supported.", "input_schema": { "type": "object", "properties": { "file_url": { "type": "string", "description": "Public https URL of the PDF." }, "date_order": { "type": "string", "enum": ["dmy", "mdy"], "description": "mdy for US statements, dmy elsewhere. Omit to auto-detect." }, "format": { "type": "string", "enum": ["json", "csv", "xero", "qbo", "ofx", "qfx", "qif"], "description": "json unless the user asked for a file." } }, "required": ["file_url"] } } ``` ## Tool definition, OpenAI format ```json { "type": "function", "function": { "name": "convert_statement", "description": "Extract transactions from a text-based PDF bank or credit card statement. Returns date (ISO), description, signed amount (negative = money out) and running balance per transaction, plus a balance check. Provide a public https URL. Scanned PDFs are not supported.", "parameters": { "type": "object", "properties": { "file_url": { "type": "string", "description": "Public https URL of the PDF." }, "date_order": { "type": "string", "enum": ["dmy", "mdy"], "description": "mdy for US statements, dmy elsewhere. Omit to auto-detect." }, "format": { "type": "string", "enum": ["json", "csv", "xero", "qbo", "ofx", "qfx", "qif"], "description": "json unless the user asked for a file." } }, "required": ["file_url"] } } } ``` ## Executing the call When the model calls the tool, your code makes the HTTP request and returns the body to the model. ```python import os, requests def convert_statement(file_url, date_order=None, format="json"): params = {"format": format} if date_order: params["date_order"] = date_order r = requests.post( "https://extractivio.com/api/v1/convert", params=params, headers={"Authorization": f"Bearer {os.environ['EXTRACTIVIO_KEY']}"}, json={"file_url": file_url}, timeout=90, ) if r.status_code != 200: # Return the error to the model so it can explain it; do not raise. return r.text return r.text # JSON for format=json, file content otherwise ``` Return errors to the model as text instead of raising. The error body has a `code` the model can act on; see [Errors](https://extractivio.com/docs/errors.md). Keep the API key in your code's environment. Never include it in the tool definition or the prompt. ## If the file is not at a URL Have your code read the file and send it as multipart or raw bytes; expose a tool that takes a local path or an attachment id that your code resolves. Do not ask the model to produce base64. ## OpenAPI The full API is described at https://extractivio.com/openapi.json (OpenAPI 3.1). Frameworks that build tools from an OpenAPI document can load it directly; the operation ids are `convertStatement`, `getUsage` and `listConversions`. --- # Code examples All examples read the key from the `EXTRACTIVIO_KEY` environment variable. ## curl ```bash # A file on disk curl -X POST "https://extractivio.com/api/v1/convert?date_order=mdy" \ -H "Authorization: Bearer $EXTRACTIVIO_KEY" \ -F "file=@statement.pdf" # Raw bytes curl -X POST "https://extractivio.com/api/v1/convert" \ -H "Authorization: Bearer $EXTRACTIVIO_KEY" \ -H "Content-Type: application/pdf" \ --data-binary @statement.pdf # A URL, returned as a QuickBooks file curl -X POST "https://extractivio.com/api/v1/convert?format=qbo" \ -H "Authorization: Bearer $EXTRACTIVIO_KEY" \ -H "Content-Type: application/json" \ -d '{"file_url": "https://example.com/statement.pdf"}' \ -o statement.qbo # Usage curl "https://extractivio.com/api/v1/usage" -H "Authorization: Bearer $EXTRACTIVIO_KEY" ``` ## Python ```python import os, requests BASE = "https://extractivio.com" HEADERS = {"Authorization": f"Bearer {os.environ['EXTRACTIVIO_KEY']}"} def convert(path, date_order=None): with open(path, "rb") as f: r = requests.post( f"{BASE}/api/v1/convert", params={"date_order": date_order} if date_order else {}, headers=HEADERS, files={"file": (os.path.basename(path), f, "application/pdf")}, timeout=90, ) if r.status_code != 200: err = r.json()["error"] raise RuntimeError(f"{err['code']}: {err['message']}") return r.json() result = convert("statement.pdf", date_order="mdy") check = result["balance_check"] print(len(result["transactions"]), "transactions") if check["checkable"] == 0: print("No running balance: result is unverified") elif check["reconciled"] < check["checkable"]: print(check["checkable"] - check["reconciled"], "rows do not reconcile") for w in result["warnings"]: print("warning:", w) net = sum(t["amount"] for t in result["transactions"]) print("net change:", round(net, 2), result["currency"] or "") ``` ## Node.js ```js import { readFile } from "node:fs/promises"; const BASE = "https://extractivio.com"; async function convert(path, dateOrder) { const url = new URL("/api/v1/convert", BASE); if (dateOrder) url.searchParams.set("date_order", dateOrder); const res = await fetch(url, { method: "POST", headers: { Authorization: `Bearer ${process.env.EXTRACTIVIO_KEY}`, "Content-Type": "application/pdf" }, body: await readFile(path), }); const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); return body; } const result = await convert("statement.pdf", "mdy"); const { checkable, reconciled } = result.balance_check; console.log(`${result.transactions.length} transactions, balance check ${reconciled}/${checkable}`); ``` ## A folder of statements, with pacing ```python import glob, time for path in sorted(glob.glob("statements/*.pdf")): try: result = convert(path) except RuntimeError as e: code = str(e).split(":")[0] if code == "rate_limited": time.sleep(60) result = convert(path) elif code == "quota_exceeded": print("Quota used up, stopping") break else: print(path, "failed:", e) continue print(path, len(result["transactions"]), result["balance_check"]) time.sleep(1.1) # stays under 60 requests a minute ``` ## Stored results ```bash # Convert and keep the result curl -X POST "https://extractivio.com/api/v1/convert?store=true" \ -H "Authorization: Bearer $EXTRACTIVIO_KEY" -F "file=@statement.pdf" # List what is stored, summaries only curl "https://extractivio.com/api/v1/conversions?summary=true&limit=10" \ -H "Authorization: Bearer $EXTRACTIVIO_KEY" ``` --- # Usage and stored results ## GET /api/v1/usage Pages used in the current calendar month (UTC). ```json { "plan": "pro", "pages_used": 12, "pages_included": 500 } ``` ## GET /api/v1/conversions Stored results, newest first. A result is stored when a conversion was made with `store=true`, or when a statement arrived through email import (Business plan). | Query parameter | Default | Meaning | | --- | --- | --- | | `limit` | 20 | 1 to 100. | | `since` | none | ISO timestamp. Only results created after it. Use the `created_at` of the newest result you have seen to poll for new ones. | | `summary` | `false` | `true` leaves out the transactions. | ```json { "conversions": [ { "id": "c0ffee", "created_at": "2026-03-01T10:00:00.000Z", "source": "email", "filename": "statement.pdf", "currency": "USD", "transaction_count": 42, "balance_check": { "checkable": 42, "reconciled": 42 }, "transactions": [ { "date": "2026-03-01", "description": "CARD GREENFIELD MARKET", "amount": -42.18, "balance": 2845.30 } ] } ] } ``` `source` is `email` or `api`. Stored results are kept for up to 30 days. There is no endpoint to fetch a single result by id or to delete one; list and filter instead. ## Polling for email imports To react to statements that arrive by email, poll `GET /api/v1/conversions?since=` every few minutes. This is what the Zapier trigger does. --- # Bank rules The parser works without knowing the bank. For some banks it also has specific rules, such as which date order they use or how a currency sign is encoded in their PDFs. ## Automatic detection Each rule set is matched against the statement text (usually the bank's name). When one matches it is applied. You do not need to do anything. ## Forcing a bank Pass `bank=` (REST) or `bank: ""` (MCP) to apply a rule set even when the bank's name is not in the text, for example on a cropped or sanitised PDF. Slugs with specific rules: - `american-express` - `bank-of-america` - `capital-one` - `chase` - `citibank` - `dbs` - `hdfc` - `hsbc-mexico` - `hsbc-uk` - `ocbc` - `uob` - `zkb` An unknown slug is ignored: the request succeeds and the general rules apply. ## What the rules do today | Bank | Rule | | --- | --- | | Bank of America, Capital One, Chase | Ambiguous numeric dates are read month-first. | | HDFC | A rupee sign that the PDF encodes as the letter C is restored; dates are read day-first. | | Others in the list | Detection only; the general rules already read their layouts. | ## Coverage, stated plainly The rules were validated against layout samples of these banks with fictional data, not against live customer statements. Banks change layouts. Whatever the bank, rely on `balance_check` and `warnings` for each individual result. A bank that is not in the list is not unsupported. Most statements are read by the general rules. --- # Troubleshooting | Symptom | Likely cause | Fix | | --- | --- | --- | | Days and months are swapped | The statement's dates are all ambiguous and the default order was wrong. | Pass `date_order=mdy` (US) or `dmy`. | | All dates are in the wrong year | Dates have no year and the statement text mentions another year more often. | Correct the year after conversion. The `year-inferred` warning marks these results. | | All amounts are negative | The statement gives no way to tell money in from money out. | See the `unsigned-amounts` warning. Classify rows yourself. | | Credit card payments are positive, purchases negative | This is the sign convention, not a bug. | Nothing. See [Response and data model](https://extractivio.com/docs/response.md). | | `balance_check` fails on exactly one row | The PDF contains two accounts. | Expected. Split the rows where the balance jumps. | | `balance_check` fails on many rows | Rows were missed or split, or the layout is unusual. | Do not use the result as is. Report the statement through the web app's "Problem with this file?" form. | | `transactions` is empty, no error | The layout was not understood. | Not retryable. Use the web app's AI extraction, or report the file. | | `scanned_pdf` | The PDF is an image. | Run OCR to add a text layer, then resend. | | `unreadable_pdf` | The PDF is password protected or damaged. | Open it, save an unprotected copy, resend. | | `not_pdf` with a `file_url` | The link returned a login or error page. | Use a direct, public link to the file. | | `download_failed: That address is not reachable from this service.` | The URL resolves to a private or internal address. | Host the file on a public URL, or send the bytes. | | `currency` is `null` | The statement shows only `$` or no currency. | Set the currency from context. | | A description contains text from a page footer | The footer overlaps the row in the PDF. | Clean the description. Amounts and dates are unaffected. | | QuickBooks rejects the `.qbo` file | QuickBooks does not accept the generic bank id for the user's region, or the file is too old or too large. | Run `validate_ofx`. If it passes, import the CSV instead, or use the direct QuickBooks export in the web app. | | 401 with a key that used to work | The key was revoked. | Create a new key. | | 403 `plan_required` | The account is on Free. | Upgrade to Pro or Business. | | MCP client shows no tools | The Authorization header is not being sent, or the client needs OAuth. | Check the client's header configuration. OAuth-only clients are not supported yet. |