Metadata-Version: 2.4
Name: bankstatementconverter
Version: 1.0.0
Summary: Convert PDF bank statements to CSV or JSON from the command line, using the Bank Statement Converter API
License: MIT
Project-URL: Homepage, https://bankstatementconverter.com
Keywords: bank statement,pdf,csv,json,converter,cli
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# bankstatementconverter (Python)

Convert PDF bank statements to CSV or JSON from the command line, using the
[Bank Statement Converter](https://bankstatementconverter.com) API.

Requires Python 3.9 or later and a Bank Statement Converter API key, which you can find at
https://bankstatementconverter.com/settings.

## Install

```sh
pip install bankstatementconverter
```

This installs the `bsc` command (also available as `bankstatementconverter`). To run it without
installing, use `pipx run --spec bankstatementconverter bsc <command>`.

## Quick start

```sh
bsc set-api-key                     # asks for your API key and saves it
bsc convert statement.pdf           # writes ./statement.csv
```

`convert` uploads the PDF, asks for the password if the PDF is protected, waits while scanned
PDFs are processed, then writes the result to the current directory.

```sh
bsc convert a.pdf b.pdf             # writes both statements to ./statements.csv
bsc convert a.pdf b.pdf --split     # writes ./a.csv and ./b.csv
bsc convert statement.pdf -f JSON   # writes ./statement.json
bsc convert statement.pdf -o -      # prints to stdout
bsc credits                         # shows your remaining credits
```

Existing files are never overwritten: if `statement.csv` already exists, the result is written to
`statement (1).csv`, then `statement (2).csv`, and so on. Passing `-o <file>` writes to exactly
that file.

## Commands

| Command | Description |
|---|---|
| `set-api-key [key]` | Save your API key (asks for it if not given) |
| `convert <pdf...>` | Upload, unlock, wait for and convert PDF statements |
| `convert <uuid...>` | Convert statements that were already uploaded |
| `upload <pdf...>` | Upload PDF statements and print their status |
| `status <uuid...>` | Print the status of uploaded statements |
| `set-password <uuid> <password>...` | Provide passwords for protected PDFs |
| `credits` | Show your account and remaining credits |

## Options

| Option | Description |
|---|---|
| `-k, --api-key <key>` | API key. Defaults to `$BSC_API_KEY`, then the key saved by `set-api-key` |
| `-f, --format <format>` | `CSV` (default) or `JSON` |
| `--raw` | Return all columns instead of normalised records |
| `-o, --output <file>` | File to write to, or `-` for stdout |
| `--split` | Write each statement to its own file instead of combining them |
| `-p, --password <pw>` | Password to try for protected PDFs. Without it you are asked per file |
| `--base-url <url>` | API base URL. Defaults to `$BSC_API_URL` or the production API |
| `-h, --help` | Show help |

The API key is saved to `~/.config/bsc/config.json` (or `$XDG_CONFIG_HOME/bsc/config.json`),
readable only by you.
