Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

stroohm-monta-api

Fetch your own EV charging sessions from a Stroohm charge card, as JSON or CSV, so you can build your own import, dashboard or expense overview on top of them.

Stroohm runs on Monta's platform, and this uses Monta's Public API, so it works for any Monta account, Stroohm or otherwise. It is one Python file that uses only the standard library: nothing to install.

1. Get an API key

  1. Log in to Monta Hub (https://hub.monta.app) with your Stroohm account.
  2. Go to Profile → Applications (https://hub.monta.app/profile/applications) and click + Add Application. Give it a name and save.
  3. Copy the client ID and client secret. The secret is shown only once; if you lose it, use Reset to get a new one.

Treat the secret like a password. The key gives full access to your Monta account, including starting and stopping charges. This tool only reads, but anyone who has the key could do more.

These credentials are for the Public API (public-api.monta.com). Monta also has a Partner API for charge point operators (partner-api.monta.com), which rejects them with CONSUMER_NOT_FOUND.

2. Run it

Requires Python 3.11 or newer.

curl -O https://raw.githubusercontent.com/puijken/stroohm-monta-api/main/stroohm_monta_api.py

export MONTA_CLIENT_ID=...        # Windows PowerShell: $env:MONTA_CLIENT_ID = "..."
export MONTA_CLIENT_SECRET=...

python3 stroohm_monta_api.py                          # all completed sessions, JSON
python3 stroohm_monta_api.py --format csv > sessions.csv
python3 stroohm_monta_api.py --from 2026-11-01        # created on or after this date (UTC)
python3 stroohm_monta_api.py --from 2026-11-01 --to 2026-11-30
python3 stroohm_monta_api.py --raw                    # JSON incl. Monta's full session object
python3 stroohm_monta_api.py --all-states             # also sessions that are still running
python3 stroohm_monta_api.py --vat 0.25               # VAT rate for price_excl_vat (default 0.21)
MONTA_API_URL=https://... python3 stroohm_monta_api.py  # another API base URL (e.g. Monta's sandbox)

Or use it from your own Python code:

import stroohm_monta_api

client = stroohm_monta_api.Monta(client_id, client_secret)
for s in client.sessions(from_date="2026-11-01"):
    print(s["started_at"], s["charge_point_id"], s["energy_kwh"], s["price_excl_vat"])

client.charges() yields Monta's raw objects instead, with the same filters.

What you get

One record per completed session:

Field Meaning
id Monta's session ID ("Laad-ID" on the receipt). Unique, so use it to deduplicate when you import repeatedly
human_readable_id Monta's short reference, e.g. 0S5F-XF9X-CXBB5
charge_point_id Monta's charger ID ("Laadpaal-ID" on the receipt)
started_at, stopped_at Start and end of charging, UTC (the times on the receipt, in local time)
energy_kwh Energy delivered
price_incl_vat What the session cost, incl. VAT (Monta's price)
price_excl_vat price_incl_vat / (1 + vat_rate), rounded to cents
vat_rate The rate used for that, from --vat (default 0.21: Belgium and the Netherlands)
price_per_kwh_incl_vat price_incl_vat / energy_kwh
currency e.g. EUR
state completed, unless --all-states

Things to know

  • Prices. Monta's price includes VAT. On a receipt where VAT is reverse-charged to an employer ("BTW verlegd"), the total shown is the excl.-VAT amount, which is price_excl_vat here. For example, a receipt total of €5.10 excl. VAT came back as price 6.17 (= 5.10 × 1.21). Monta's cost field is not what you paid, so it only appears with --raw.
  • No location. A session only carries the numeric charge_point_id. Monta refuses to look up chargers you don't own (HTTP 403), so the API can't tell you the address. The receipt shows both the address and the Laadpaal-ID, and the ID is stable. Keep your own small table of charge_point_id → place and you only need to name each charger once.
  • Dates. --from/--to filter on when Monta created the session (UTC), not when it ended. To pick up corrections, simply re-fetch a wider range and upsert on id.
  • Rate limit. 10 requests per minute, shared by all of your applications. One request fetches 100 sessions; the client paces itself and waits if Monta says it's going too fast.

Used by

  • docker-energy-monitor fetches sessions twice a day into a TimescaleDB table for Grafana dashboards (ENABLE_MONTA).

Development

python3 -m unittest -v          # runs against an in-process fake of the API, no key needed

License

Modified MIT, non-commercial use only. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages