Skip to main content

Pull charging sessions into your BI

The most common integration: a scheduled job that pulls finished charging sessions into a warehouse or BI tool. Scope needed: charging-sessions:read (an Accountant-role key is enough).

Page through yesterday's sessions

Filter by the day, sort deterministically, and page until TotalCount is exhausted:

GATEWAY="https://<gateway-host>"
KEY="wsk_..."

DSQUERY='{
"Pager": { "Skip": 0, "Take": 100 },
"Filter": { "Logic": "And", "Filters": [
{ "Field": "StartedAtUtc", "Operator": "Gte", "Value": "2026-08-28T00:00:00" },
{ "Field": "StartedAtUtc", "Operator": "Lt", "Value": "2026-08-29T00:00:00" }
]},
"Sort": { "Sorts": [ { "Field": "Id", "Dir": "Asc" } ] }
}'

curl -s "$GATEWAY/api/charging-sessions/v1" \
-H "API-KEY: $KEY" \
--get --data-urlencode "dsquery=$DSQUERY"

Loop by advancing Skip by Take until you've read TotalCount rows. Three habits that keep the job correct:

  • Sort by Id while paging — a stable sort key means rows can't slip between pages while sessions keep ending.
  • Filter on StartedAtUtc with an exclusive upper bound (Lt next midnight) so days never overlap. Remember: timestamps are UTC without a marker.
  • Re-pull a trailing window (e.g. the last 3 days) rather than assuming rows never change: prices can be corrected after the fact — such corrections are visible in the platform's audit trail.

Status values you'll meet include active, suspended, finished, expired and failed; the enum's numeric values are documented on the endpoint in the reference.

The CSV shortcut

For spreadsheet-bound reporting, the export endpoint returns a ready CSV. It's a POST but is marked as a read operation, so a read-only key may call it:

curl -s -X POST "$GATEWAY/api/charging-sessions/v1/export-csv" \
-H "API-KEY: $KEY" \
-H 'Content-Type: application/json' \
-d '{"Ids": [12345, 12346, 12347]}' \
-o sessions.csv

It takes explicit session ids — list first, then export. For continuous pipelines, prefer the JSON list; CSV is for humans.