API

The Chargeflux.io API creates hosted virtual stations, sends runtime commands and reads station events. The base URL is https://www.chargeflux.io/api/v1. Requests and responses use JSON. Authenticate with a Pro plan API key created on your Automation page:

Authorization: Bearer cfk_your_api_key

If you are driving the simulator from an AI agent rather than your own code, the MCP server exposes the same capabilities as tools, with higher-level ones such as running a whole charging session in a single call.

Plan limits

PlanHosted stationsAPI keys
Free20
Pro105

POST /stations

Create and start one or more hosted charge point connections.

Body

{
  "wsUrl": "wss://csms.example.com/ocpp/CF-CI-001",
  "stationIdentity": "CF-CI-001",
  "ocppVersion": "1.6",
  "connectors": [
    { "connectorId": 1, "powerKw": 7.4, "currentType": "AC" }
  ],
  "evseCount": 2,
  "suffixPattern": "-{n}"
}

connectors accepts at most 4 entries. currentType is optional and may be AC or DC. ocppVersion is optional and may be 1.6 or 2.0.1.

evseCount (1–4, default 1) creates one charge point per EVSE. Each EVSE gets a single connector (connectorId 1) using the first entry of connectors, and its own identity formed from stationIdentity plus suffixPattern ({n} is replaced with the EVSE number). With evseCount 2 and pattern -{n}, identity CF-CI-001 fans out to CF-CI-001-1 and CF-CI-001-2. Multi-EVSE requests count as that many charge points against your plan limit.

Response

{
  "stations": [
    {
      "id": "7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2",
      "stationIdentity": "CF-CI-001-1",
      "wsUrl": "wss://csms.example.com/ocpp/CF-CI-001-1",
      "connectors": [{ "connectorId": 1, "powerKw": 7.4, "currentType": "AC" }],
      "chargerGroupId": "3d4e6b2e-…",
      "createdAt": "2026-07-10T00:00:00.000Z"
    },
    {
      "id": "…",
      "stationIdentity": "CF-CI-001-2",
      "wsUrl": "wss://csms.example.com/ocpp/CF-CI-001-2",
      "connectors": [{ "connectorId": 1, "powerKw": 7.4, "currentType": "AC" }],
      "chargerGroupId": "3d4e6b2e-…",
      "createdAt": "2026-07-10T00:00:00.000Z"
    }
  ]
}

curl

curl -X POST https://www.chargeflux.io/api/v1/stations \
  -H "Authorization: Bearer cfk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"wsUrl":"wss://csms.example.com/ocpp","stationIdentity":"CF-CI-001","evseCount":2,"connectors":[{"connectorId":1,"powerKw":7.4,"currentType":"AC"}]}'

Returns 201 with the created stations, 400 for validation errors and 409 when the request exceeds your plan station limit.

GET /stations

List your hosted stations. Live engine state is merged into each station when available.

{
  "stations": [
    {
      "id": "7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2",
      "stationIdentity": "CF-CI-001",
      "wsUrl": "wss://csms.example.com/ocpp/CF-CI-001",
      "connectors": [{ "connectorId": 1, "powerKw": 7.4, "currentType": "AC" }],
      "createdAt": "2026-07-10T00:00:00.000Z",
      "connectionState": "accepted"
    }
  ]
}
curl https://www.chargeflux.io/api/v1/stations \
  -H "Authorization: Bearer cfk_your_api_key"

GET /stations/{id}

Fetch one station by ID. connectionState may be an active runtime state such as accepted or reconnecting, and is stopped when the hosted engine is not running the station.

curl https://www.chargeflux.io/api/v1/stations/7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2 \
  -H "Authorization: Bearer cfk_your_api_key"

POST /stations/{id}/restart

Restart the hosted station from its saved configuration.

{ "ok": true }
curl -X POST https://www.chargeflux.io/api/v1/stations/7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2/restart \
  -H "Authorization: Bearer cfk_your_api_key"

POST /stations/{id}/command

Dispatch a runtime command to a running station. CONNECT commands are rejected because hosted stations are created and connected through POST /stations.

CommandBody fields
SEND_HEARTBEATNone
PLUG_INconnectorId, optional ev
PLUG_OUTconnectorId
AUTHORIZEconnectorId, idTag
START_TRANSACTIONconnectorId, idTag
STOP_TRANSACTIONconnectorId, optional reason
SEND_METER_VALUESconnectorId
SET_STATUSconnectorId, status
SIMULATE_FAULTconnectorId, errorCode
CLEAR_FAULTconnectorId
curl -X POST https://www.chargeflux.io/api/v1/stations/7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2/command \
  -H "Authorization: Bearer cfk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"type":"START_TRANSACTION","connectorId":1,"idTag":"RFID-001"}'

GET /stations/{id}/events

Read the station event stream. Use after to request events after a sequence number. limit may be supplied by clients for forward compatibility.

{
  "events": [
    {
      "seq": 42,
      "at": "2026-07-10T00:00:00.000Z",
      "event": {
        "type": "MESSAGE_RECORDED",
        "message": { "id": "abc", "direction": "sent", "timestamp": 1783641600000 }
      }
    }
  ]
}

Runtime event types are CONNECTION_STATE_CHANGED, CONNECTOR_STATE_CHANGED, MESSAGE_RECORDED, TRANSACTION_STARTED, TRANSACTION_STOPPED, RECONNECT_SCHEDULED, VALIDATION_ERROR and RUNTIME_ERROR.

curl "https://www.chargeflux.io/api/v1/stations/7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2/events?after=42&limit=100" \
  -H "Authorization: Bearer cfk_your_api_key"

DELETE /stations/{id}

Stop and delete a hosted station. A successful delete returns no body.

curl -X DELETE https://www.chargeflux.io/api/v1/stations/7b6cfafe-7bf0-48e8-8a62-2ef3f6c2a6d2 \
  -H "Authorization: Bearer cfk_your_api_key"

Key endpoints

API keys are managed from the Automation page and use browser session authentication only. API keys cannot create, list or revoke API keys.

  • GET /keys returns { keys: [...] } without hashes or plaintext keys.
  • POST /keys with { name } creates a Pro plan key and returns plaintext once. Optionally pass scopes (any of stations:read, stations:write, sessions:run; defaults to all three) and expiresInDays (1-365; defaults to never) to narrow what the key can do and how long it lives.
  • DELETE /keys/{id} revokes a key and returns 204.

Errors

StatusMeaning
400Invalid JSON body, station configuration or command.
401Missing, expired or unknown authentication.
403API key creation requires the Pro plan, or the key is missing the scope the endpoint needs.
404The station does not exist for the authenticated user.
409Plan limit reached, station already running or station not running.
502Hosted engine or database unavailable.