Sessions

Session synchronization on ChargeIndia Hub.

Endpoints

MethodPathCallerDescription
PUT/ocpi/2.2.1/sessions/{cc}/{pid}/{session_id}CPOPush session state to Hub

Hub role: RECEIVER (CPO → Hub) + SENDER (Hub → eMSP async)

There is no GET /sessions for eMSPs on the Hub. eMSPs receive sessions via async push to their receiver endpoint.

CPO push example

PUT /ocpi/2.2.1/sessions/IN/ABC/SESSION001
Authorization: Token {cpo-token}
Content-Type: application/json

{
  "country_code": "IN",
  "party_id": "ABC",
  "id": "SESSION001",
  "start_date_time": "2025-06-23T10:00:00.000Z",
  "kwh": 5.2,
  "cdr_token": {
    "country_code": "IN",
    "party_id": "XYZ",
    "uid": "TOKEN001",
    "type": "RFID",
    "contract_id": "CONTRACT001"
  },
  "auth_method": "COMMAND",
  "location_id": "LOC001",
  "evse_uid": "EVSE001",
  "connector_id": "1",
  "currency": "INR",
  "status": "ACTIVE",
  "last_updated": "2025-06-23T10:05:00.000Z"
}

Session statuses

StatusTypical trigger
PENDINGSession created, not yet charging
ACTIVECharging in progress
COMPLETEDCharging finished
INVALIDSession invalid
RESERVATIONConnector reserved

Async delivery to eMSP

After CPO push, the Hub worker forwards to:

PUT /ocpi/2.2.1/sessions/{cpo_cc}/{cpo_pid}/{session_id}

on the eMSP's registered receiver URL.

Required: cdr_token

cdr_token.country_code and cdr_token.party_id must identify the eMSP. Without them, async delivery cannot route.

Related docs

OCPI spec

See OCPI 2.2.1 Sessions module for full Session object definitions.