Klaus' Log

Fr 07 Februar 2020

Python script for the comdirect REST API

Posted by Klaus Eisentraut in scripts   

I'm a customer of the German bank comdirect. Recently I logged into my online banking and found that there is a new button named "developer options". I was surprised that they have added a REST API which can be used to view your balances and transactions or to purchase or sell stocks.

The REST API is a bit cumbersome to start with because the login process is kind of convoluted. First, you need to enter your username and password, then they will return a "Photo-TAN" which you need to scan with your second factor (smartphone or dedicated device) in order to get an additional, temporary six-digit authentication code. Also the documentation (German only) is sometimes a little vague and I had to resort to try & error. After some fiddling I was able to see my current balances with a Python script.

For now, it is a proof-of-concept only, but I plan on improving it in the future. Maybe I might make an actual Python module out of this, therefore I named it python-comdirect-api. Feel free to use it, but be careful because currently it has no error handling whatsoever and comdirect might block your account after three wrong or five incomplete authentication attempts.