Skip to content

Your First API Call

This walks you from zero to a working API call against the Headless CPMS gateway. Five minutes if you have Docker handy.

A request that lists every connected charging station and prints a compact JSON view. By the end you’ll know how to authenticate, how to read the response, and where to look next.

  • Docker installed and running, OR Python 3.11+ (for the source install path)
  • curl (you almost certainly have this)
  • Five minutes
  1. Boot the gateway.

    Terminal window
    docker run -d --name cpms-headless -p 8080:8080 \
    -e CPMS_API_KEY=hcpms_live_demo \
    ghcr.io/pipelet/cpms-headless:latest

    The gateway listens on http://localhost:8080. Health check first:

    Terminal window
    curl -H "X-API-Key: hcpms_live_demo" \
    http://localhost:8080/api/v1/system/health

    You should see {"status": "ok", ...}.

  2. List connected stations.

    Terminal window
    curl -H "X-API-Key: hcpms_live_demo" \
    http://localhost:8080/api/v1/stations | python3 -m json.tool

    The first time, the response will likely be an empty list — you have no stations connected yet. That’s fine. The endpoint works; we just need to give it something to do.

  3. Connect a virtual station with the simulator.

    In a second terminal, point the Charger Simulator at your gateway:

    Terminal window
    docker run -d --name chargersim -p 9310:9310 \
    -e OCPP_BACKEND_URL=ws://host.docker.internal:8080/ocpp \
    ghcr.io/pipelet/ocpp-chargersim:latest

    Wait ~5 seconds, then re-run the stations call from step 2. You should now see one station: SIM-DC-001.

  4. Start a charging session.

    Terminal window
    curl -X POST http://localhost:8080/api/v1/transactions/start \
    -H "X-API-Key: hcpms_live_demo" \
    -H "Content-Type: application/json" \
    -d '{
    "station_id": "SIM-DC-001",
    "connectorId": 1,
    "idTag": "RFID_DEMO"
    }'

    Response:

    { "status": "Accepted", "transactionId": 42 }
  5. Stop it.

    Terminal window
    curl -X POST http://localhost:8080/api/v1/transactions/stop-connector \
    -H "X-API-Key: hcpms_live_demo" \
    -H "Content-Type: application/json" \
    -d '{ "station_id": "SIM-DC-001", "connectorId": 1 }'

You hit four endpoints from the Headless CPMS API surface:

StepEndpointWhat it does
1GET /api/v1/system/healthService health probe
2GET /api/v1/stationsList every connected charge point
4POST /api/v1/transactions/startSend RemoteStartTransaction over OCPP
5POST /api/v1/transactions/stop-connectorSend RemoteStopTransaction

Pipelet translated the REST calls into OCPP 1.6 messages and dispatched them to the (simulated) station. In production this is exactly the same flow against real hardware — the gateway is unaware of whether the station is a wallbox, a 350kW DC charger, or a simulator.