This page describes the complete session path from authorization through CDR delivery.
Sequence diagram
sequenceDiagram participant eMSP participant Hub as ChargeIndia Hub participant CPO eMSP->>Hub: PUT tokens/.../authorize Hub->>CPO: PUT tokens/.../authorize CPO-->>Hub: ALLOWED Hub-->>eMSP: ALLOWED eMSP->>Hub: POST commands/START_SESSION Hub->>CPO: POST commands/START_SESSION CPO-->>Hub: ACCEPTED + callback Hub-->>eMSP: ACCEPTED (via response_url) CPO->>Hub: PUT sessions/... (ACTIVE) Hub->>eMSP: PUT sessions/... (async push) eMSP->>Hub: POST commands/STOP_SESSION Hub->>CPO: POST commands/STOP_SESSION CPO->>Hub: PUT sessions/... (COMPLETED) Hub->>eMSP: PUT sessions/... (async push) CPO->>Hub: POST cdrs Hub->>eMSP: POST cdrs (async push)
Step-by-step
1. Token authorization
The eMSP authorizes the driver's token before charging:
eMSP → Hub: PUT /ocpi/2.2.1/tokens/{emsp_cc}/{emsp_pid}/{token_uid}/authorize
Hub → CPO: PUT /ocpi/2.2.1/tokens/{emsp_cc}/{emsp_pid}/{token_uid}/authorize
The CPO responds with ALLOWED, BLOCKED, NOT_ALLOWED, or UNKNOWN. The Hub returns this to the eMSP.
2. Start session
The eMSP sends a remote start command:
eMSP → Hub: POST /ocpi/2.2.1/commands/START_SESSION Hub → CPO: POST /ocpi/2.2.1/commands/START_SESSION
Required fields:
response_url— where async results are delivered (Hub rewrites CPO callback)token— driver token objectlocation_id,evse_uid,connector_id— target charge point
3. Session becomes active
The CPO pushes session state to Hub:
CPO → Hub: PUT /ocpi/2.2.1/sessions/{cpo_cc}/{cpo_pid}/{session_id}
The session must include cdr_token identifying the eMSP. The Hub asynchronously pushes to the eMSP:
Hub → eMSP: PUT /ocpi/2.2.1/sessions/{cpo_cc}/{cpo_pid}/{session_id}
4. Stop session
The eMSP sends stop:
eMSP → Hub: POST /ocpi/2.2.1/commands/STOP_SESSION
Include session_id in the command body.
5. Session completed
The CPO pushes final session state (COMPLETED) to Hub, which forwards to eMSP asynchronously.
6. CDR delivery
The CPO posts the CDR:
CPO → Hub: POST /ocpi/2.2.1/cdrs Hub → eMSP: POST /ocpi/2.2.1/cdrs (async)
Required fields summary
| Field | Set by | Purpose |
|---|---|---|
cdr_token.country_code | CPO on session/CDR | Routes async delivery to eMSP |
cdr_token.party_id | CPO on session/CDR | Routes async delivery to eMSP |
response_url | eMSP on command | Async command result delivery |
session_id | CPO / command flow | Links stop command to active session |
Timing expectations
| Path | Type | Target latency |
|---|---|---|
| Token authorize | Realtime | Synchronous (CPO response time) |
| Commands | Realtime + async | Immediate accept/reject; async result via callback |
| Sessions | Async push | p95 < 5 seconds (Hub → eMSP) |
| CDRs | Async push | p95 < 5 seconds (Hub → eMSP) |
See Async Delivery for retry behavior.
Common failures
| Failure | Cause |
|---|---|
Authorization UNKNOWN | CPO unreachable or token not recognized |
Command REJECTED | EVSE unavailable, invalid location, or routing not configured |
| Session not received by eMSP | Missing cdr_token or eMSP receiver URL not configured |
| CDR not received | Same as session — check cdr_token and receiver URL |