# Bank statement PDF to JSON API in 5 minutes

Send one text-based PDF bank or credit card statement to `POST /api/v1/convert` and get transactions back as JSON: date, description, signed amount and running balance, plus a balance check.

The call is synchronous. Typical statements take one to three seconds; the server gives up after 60 seconds. The API is available on every plan: a free account includes 30 API pages a month, the Pro plan 500 pages a month and the Business plan 5,000 pages a month. See [Authentication](https://www.extractivio.com/docs/authentication.md) and [Limits](https://www.extractivio.com/docs/limits.md).

Text-based PDFs only. A scan or photo returns `scanned_pdf`. The file must be 15 MB or smaller. Quota is counted in PDF pages and is shared with the hosted MCP server.

## 1. Get an API key

1. Sign in at https://www.extractivio.com/login.
2. Open https://www.extractivio.com/account and click "Create API key".
3. Copy the key. It starts with `ex_` and is shown only once.

```bash
export EXTRACTIVIO_KEY="ex_your_key"
```

Treat the key like a password. Do not put it in client-side code, a public repository or a logged prompt.

## 2. Convert a file

```bash
curl -X POST "https://www.extractivio.com/api/v1/convert?date_order=mdy" \
  -H "Authorization: Bearer $EXTRACTIVIO_KEY" \
  -F "file=@statement.pdf"
```

Pass `date_order=mdy` for United States statements and `date_order=dmy` elsewhere when you know the country. If a date in the PDF has a day greater than 12, the order is detected from the data and the parameter is ignored.

A public `https` URL works too (public IP, no login cookies; the download must finish within 15 seconds and be 15 MB or smaller):

```bash
curl -X POST "https://www.extractivio.com/api/v1/convert" \
  -H "Authorization: Bearer $EXTRACTIVIO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_url": "https://example.com/statement.pdf"}'
```

You can also send raw PDF bytes (`Content-Type: application/pdf`) or JSON `{"file_base64":"..."}`. The four request bodies are described in [Convert endpoint](https://www.extractivio.com/docs/convert.md).

## 3. Read the JSON

A successful call is HTTP 200. `id` is `null` unless you passed `store=true`.

```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 }
  ]
}
```

Check three things on every result:

1. `amount` is negative for money leaving the account and positive for money coming in, including on credit cards.
2. `balance_check.reconciled` should equal `balance_check.checkable`. If it is lower, treat the result as partly wrong. If `checkable` is 0, the statement had no running balance to verify.
3. `warnings` should be empty, or you should act on each one. See [Response and data model](https://www.extractivio.com/docs/response.md).

An empty `transactions` array is still HTTP 200. The layout was not understood; do not blindly retry the same input.

Response headers: `x-pages` (charged for this PDF), `x-pages-used` and `x-pages-included`.

Converted data should be reviewed by a person before it is used for accounting or tax.

## 4. Python

```python
import os, requests

BASE = "https://www.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)
```

## 5. Node.js

```js
import { readFile } from "node:fs/promises";

const BASE = "https://www.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}`);
```

## Errors, quota and other formats

Branch on `error.code`, not on the message. Common codes: `unauthorized` (401, missing or revoked key), `format_unavailable` (403, a format the plan does not include; Free includes JSON and CSV), `scanned_pdf` and `unreadable_pdf` (422), `too_large` (413), `rate_limited` and `quota_exceeded` (429). `quota_exceeded` means the monthly page quota is used up. Its message names the limit and links to /pricing. The full list is in [Errors](https://www.extractivio.com/docs/errors.md). The rate limit is 60 requests a minute per account, REST and hosted MCP combined.

Check remaining quota:

```bash
curl "https://www.extractivio.com/api/v1/usage" -H "Authorization: Bearer $EXTRACTIVIO_KEY"
```

The response looks like `{ "plan": "pro", "pages_used": 12, "pages_included": 500 }`. On Free, `pages_included` is 30.

To get a QuickBooks file instead of JSON (Pro and Business):

```bash
curl -X POST "https://www.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
```

`format` defaults to `json`. Other values: `csv`, `xero`, `qbo`, `ofx`, `qfx`, `qif`. Pass `store=true` only if you want the result kept for up to 30 days and listed at `GET /api/v1/conversions`. By default the PDF is processed in memory and discarded.

If the file must not leave the device, use the converter at https://www.extractivio.com/en. Text-based PDFs are read in the browser and are not uploaded. Excel and CSV exports are free.

## Next

- [Convert endpoint reference](https://www.extractivio.com/docs/convert.md)
- [Code examples](https://www.extractivio.com/docs/examples.md)
- [Parse bank statements in Claude or Cursor with MCP](https://www.extractivio.com/docs/tutorial-mcp.md)
- [OpenAPI description](https://www.extractivio.com/openapi.json)
