@bunq-community/bunq-cli v0.4.0
bunq-cli
An unofficial and open source CLI tool to quickly test API requests with the bunq API.
Either test API requests interactively or use it directly in other command line tools and cronjobs.
Features
- Create and add funds to sandbox accounts within seconds
- Create a new monetary account from the command line
- Send API requests and output to console or files as JSON
Getting started
Install globally as a command yarn global add @bunq-community/bunq-cli or npm install -g @bunq-community/bunq-cli
Standard interactive mode while storing your keys at the default location:
bunq-cli --saveRoadmap
- Add a password option to allow for production API key storage
- Turn commands and actions into a module-like system
- Support for both regular API key and OAuth logins through QR codes.
- View current user, monetary accounts and other API data in interactive mode.
- Transfers between own accounts by ID and description for CLI mode and through the UI in interactive mode.
bunq-cli --cli --transfer --transfer-from Shopping --transfer-to Savings --amount 10bunq-cli --cli --transfer --transfer-from-id 1234 --transfer-to-id 4321 --amount='12.36' --description='Less shopping'
Options
bunq-cli will check for a .env in your working directory. Any environment variables starting with BUNQ_CLI_ will be parsed as input options. Some examples of this are:
BUNQ_CLI_API_KEY=some-key-valueinstead of--api-keyBUNQ_CLI_SAVE=falseinstead of--save=false
Make sure to use --help to view the specific options you can use for each sub command
Generic options
These are the most basic options that you'll need. If --memory is defined, the bunqJSClient will do everything in memory without writing data to a file. Subsequent API calls will be faster if you do not use this option since it won't have to setup a new API session with bunq the next time you use bunq-cli.
--save/-sLocation to store the API session info, defaults to$HOME/bunq-cli.json. Use the --memory option to ignore stored data.--memoryIgnores the stored session info and does everything in memory, useful for testing sandbox scripts without removing the stored key.--overwriteOverwrite the stored session info with the given options, by default this is false so parameters like--api-keyare ignored if session info already exists.--outputHow to output the API data. Choices arefile/ffor writing a new file to the output-location orconsole/cin CLI mode to output only the API data to the console.--output-locationDirectory location if--outputis set to file. Defaults to$HOME/bunq-cli-api-data.--apiKey/--apiKeyThe bunq API key, creates a sandbox key by default--deviceName/--device-nameDevice name to identify the API key--encryptionKey/--encryption-keyEncryption key for bunqJSClient, generates a random key by default--environmentbunq API environment to use
Optional parameters
--methodAPI method to use, defaults to "LIST".--dataA string with JSON which is the data that well be sent in POST/PUT requests.--count,--older-idand--newer-idfor filtering LIST requests like described in the bunq docs.--accountTo define which MonetaryAccount should be used by account description.--accountId/--account-idTo define which MonetaryAccount should be used by account ID.--accountTo define which MonetaryAccount should be used by account description.--eventId/--event-idTo define which object should be fetched, required for most GET endpoints.--prettyWhether to prettify the JSON output or not. You can give it a string to use as spacer, defaults to 2 spaces, use '\t' to format with tabs for example--cleanWill attempt to cleanup some of the wrappers for the bunq API. For example Arrays with a single value or the Response object.
Sub commands
By default the --output mode is set to console when using sub commands.
Basic commands
bunq-cli userFetches the User info.bunq-cli accountsFetches all monetary accounts for the current User.bunq-cli eventsFetches all events using the/user/{userId}/eventendpoint.bunq-cli create-keyCreates a new Sandbox environment API key and outputs it.
Advanced commands
These commands require more knowledge of the API but supply a few useful ways to make using the correct endpoints and accounts easier.
bunq-cli endpoint <endpoint-name>A specific endpoint you want to call. Only a few basic LIST and GET endpoints are supported by this, run it without a value to view the list of supported shorthand endpointsbunq-cli url <url>A specific URL you wish to call. This is the more advanced option compared to endpoint since you have to define the entire URL yourself. Some helpers when using this command are the following:
Using UserID in the url will automatically be replaced by the current user's ID. For example /user/UserID becomes /user/1234.
Next you can use Account=<account description> to reference a specific account. Account=<description> Will be replaced by the first account who's description matches the value. If you have a account named 'Shopping' with id 15 and your user ID is 1234 the following url: /user/UserID/monetary-account/Account=Shopping/payment will turn into /user/1234/monetary-account/15/payment.
Contact
We have a public Telegram chat group and a topic on bunq together.
Feel free to create a new issue for any suggestions, bugs or general ideas you have on Github or contact us through one of the above.