A python script to upload BUNQ transactions to YNAB
- Install Python 3, Requests and pyOpenSSL. (This worked for me on Debian:
sudo pip3 install requests pyopenssl
.) - Create a BUNQ "API key" in the BUNQ mobile app. Click your picture, then Security, API keys, then add a key using the plus on the top right. Choose to "Reveal" the API key and share it. Store the API key in "api_token.txt".
- Verify that the link with BUNQ works by requesting the list of users and accounts:
python3 list_user.py
- Create a YNAB "Personal Access Token" in the YNAB website https://app.youneedabudget.com/settings/developer. Store the token in "personal_access_token.txt". If you don't see the developer section, request it here.
- Verify that the link with YNAB works by requesting the list of budgets:
python3 list_budget.py
- You're all set to upload transactions! Pick a BUNQ user and account from
python3 list_user.py
, and a YNAB budget and account frompython3 list_budget.py
, and run:
python3 bunq2ynab.py <bunq user> <bunq account> <ynab budget> <ynab account>
- Follow steps 1-5 above
- Run
auto_sync.py
to set up a callback and start listening for push notifications. Make sure the port is open in the firewall, and if you're behind a router, that the port is properly forwarded:
python3 auto_sync.py <bunq user> <bunq account> <ynab budget> <ynab account>
- Steps 1, 4, 5 from above
- Pick a YNAB budget and account from
python3 list_budget.py
, and run:
python3 csv2ynab.py <csv filename> <ynab budget> <ynab account>
- Generate a public/private keypair
- Register the keypair with BUNQ through the "v1/installation" endpoint. Store the returned installation token and the server's public key
- Register your IP with BUNQ through the "v1/device-server" endpoint
- Get a session token through the "v1/session-server" endpoint. Store the returned session token
- Translate user names using the "v1/user" endpoint
- Translate account names through the "v1/user/xxx/monetary-account" endpoint
- Retrieve transactions from the "v1/user/xxx/monetary-account/xxx/payment" endpoint
- Translate budget name using the "v1/budgets" endpoint
- Translate account name using the "v1/budgets/xxx/accounts" endpoint
- Post the transactions to the "v1/budgets/xxx/transactions/bulk" endpoint
- BUNQ API documentation: https://doc.bunq.com/
- YNAB API documentation: https://api.youneedabudget.com/
- YNAB API endpoints: https://api.youneedabudget.com/v1
- Request YNAB API access here: https://github.com/ynab/ynab-sdk-js