Sessions (CPO)

Push session state updates to ChargeIndia Hub.

Hub role: RECEIVER (CPO → Hub)

Endpoints

MethodPathDescription
PUT/ocpi/2.2.1/sessions/{cc}/{pid}/{session_id}Push full session state to Hub
PATCH/ocpi/2.2.1/sessions/{cc}/{pid}/{session_id}Partial session update (merged on Hub)

Use your own CPO country_code and party_id in URL paths and object bodies. See Hub Receiver Identity (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"
}

PATCH example

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

{
  "kwh": 6.1,
  "status": "ACTIVE",
  "last_updated": "2025-06-23T10:10:00.000Z"
}

The Hub merges the patch into the stored session and forwards a PATCH with the same fragment to the eMSP receiver.

Session statuses

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

Required: cdr_token

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

OCPI spec

See OCPI 2.2.1 Sessions module for full Session object definitions.