Sessions

OCPI 2.2.1

By Abhishek Uniyal · Updated

Sessions in OCPI 2.2.1

A Session is the charging record shared between platforms. ACTIVE permits a Session with no transferred energy. Finish it with COMPLETED; OCPI does not delete Sessions. PATCH leaves omitted fields unchanged. A PATCH includes last_updated. The Reservation flow says RESERVED while its SessionStatus enum says RESERVATION. ChargerDojo accepts either value.

Sources (7)
country_code · CiString(2) · cardinality 1: ISO-3166 alpha-2 country code of the CPO that 'owns' this Session. party_id · CiString(3) · cardinality 1: ID of the CPO that 'owns' this Session (following the ISO-15118 standard). id · CiString(36) · cardinality 1: The unique id that identifies the charging session in the CPO platform. start_date_time · DateTime · cardinality 1: The timestamp when the session became ACTIVE in the Charge Point. When the session is still PENDING, this field SHALL be set to the time the Session was created at the Charge Point. When a Session goes from PENDING to ACTIVE, this field SHALL be updated to the moment the Session went to ACTIVE in the Charge Point. end_date_time · DateTime · cardinality ?: The timestamp when the session was completed/finished, charging might have finished before the session ends, for example: EV is full, but parking cost also has to be paid. kwh · number · cardinality 1: How many kWh were charged. cdr_token · CdrToken · cardinality 1: Token used to start this charging session, including all the relevant information to identify the unique token. auth_method · AuthMethod · cardinality 1: Method used for authentication. This might change during a session, for example when the session was started with a reservation: ReserveNow: `COMMAND`. When the driver arrives and starts charging using a Token that is whitelisted: `WHITELIST`. authorization_reference · CiString(36) · cardinality ?: Reference to the authorization given by the eMSP. When the eMSP provided an `authorization_reference` in either: real-time authorization, StartSession or ReserveNow this field SHALL contain the same value. When different `authorization_reference` values have been given by the eMSP that are relevant to this Session, the last given value SHALL be used here. location_id · CiString(36) · cardinality 1: Location.id of the Location object of this CPO, on which the charging session is/was happening. evse_uid · CiString(36) · cardinality 1: EVSE.uid of the EVSE of this Location on which the charging session is/was happening. Allowed to be set to: `#NA` when this session is created for a reservation, but no EVSE yet assigned to the driver. connector_id · CiString(36) · cardinality 1: Connector.id of the Connector of this Location where the charging session is/was happening. Allowed to be set to: `#NA` when this session is created for a reservation, but no connector yet assigned to the driver. meter_id · string(255) · cardinality ?: Optional identification of the kWh meter. currency · string(3) · cardinality 1: ISO 4217 code of the currency used for this session. charging_periods · ChargingPeriod · cardinality *: An optional list of Charging Periods that can be used to calculate and verify the total cost. total_cost · Price · cardinality ?: The total cost of the session in the specified currency. This is the price that the eMSP will have to pay to the CPO. A total_cost of 0.00 means free of charge. When omitted, i.e. no price information is given in the Session object, it does not imply the session is/was free of charge. status · SessionStatus · cardinality 1: The status of the session. last_updated · DateTime · cardinality 1: Timestamp when this Session was last updated (or created).OCPI 2.2.1 Sessions module · #mod_sessions_session_objectACTIVE: The session has been accepted and is active. All pre-conditions were met: Communication between EV and EVSE (for example: cable plugged in correctly), EV or driver is authorized. EV is being charged, or can be charged. Energy is, or is not, being transfered.OCPI 2.2.1 Sessions module · #mod_sessions_sessionstatus_enum"Sessions cannot be deleted, final status of a session is: `COMPLETED`."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"Same as the PUT method, but only the fields/objects that need to be updated have to be present. Fields/objects which are not specified are considered unchanged."OCPI 2.2.1 Sessions module · #mod_sessions_patch_method"Any request to the PATCH method SHALL contain the `last_updated` field."OCPI 2.2.1 Sessions module · #mod_sessions_patch_method"When a EV driver makes a Reservation for a Charge Point/EVSE, the Sender SHALL create a new Session object with `status` = `RESERVED`"OCPI 2.2.1 Sessions module · #mod_sessions_reservationRESERVATION: The session is started due to a reservation, charging has not yet started. The session might never become an _active_ session.OCPI 2.2.1 Sessions module · #mod_sessions_sessionstatus_enum

Example payload · zero-energy-active

{
  "id": "EXAMPLE-SESSION",
  "kwh": 0,
  "auth_method": "WHITELIST",
  "currency": "EUR",
  "status": "ACTIVE",
  "last_updated": "2026-01-01T00:00:00Z",
  "country_code": "NL",
  "party_id": "EXA",
  "start_date_time": "2026-01-01T00:00:00Z",
  "cdr_token": {
    "country_code": "NL",
    "party_id": "EXB",
    "uid": "EXAMPLE-TOKEN",
    "type": "RFID",
    "contract_id": "EXAMPLE-CONTRACT"
  },
  "location_id": "EXAMPLE-LOCATION",
  "evse_uid": "EXAMPLE-EVSE",
  "connector_id": "1"
}

Example payload · update-cost

{
  "total_cost": {
    "excl_vat": 0.6
  },
  "last_updated": "2026-01-01T00:01:00Z"
}
Learn how a Session update works

Which endpoints does this module define?

These paths illustrate the requests. Use the URLs advertised by your partner, replace the placeholders and choose the matching interface. A listed method does not establish that this site's simulator implements it.

CPO · sender interface

  • Fetch Session objects of charging sessions last updated between the {date_from} and {date_to}(paginated).

    GET
    /ocpi/2.2.1/sessions/
  • Setting Charging Preferences of an ongoing session.

    PUT
    /ocpi/2.2.1/sessions/{session_id}/charging_preferences
Source
Method: Description GET: Fetch Session objects of charging sessions last updated between the `{date_from}` and `{date_to}`(paginated). POST: n/a PUT: Setting Charging Preferences of an ongoing session. PATCH: n/a DELETE: n/aOCPI 2.2.1 Sessions module · #mod_sessions_cpo_interface

eMSP · receiver interface

  • Retrieve a Session object from the eMSP's system with Session.id equal to {session_id}.

    GET
    /ocpi/2.2.1/sessions/{country_code}/{party_id}/{session_id}
  • Send a new/updated Session object to the eMSP.

    PUT
    /ocpi/2.2.1/sessions/{country_code}/{party_id}/{session_id}
  • Update the Session object with Session.id equal to {session_id}.

    PATCH
    /ocpi/2.2.1/sessions/{country_code}/{party_id}/{session_id}
Source
Method: Description GET: Retrieve a Session object from the eMSP's system with Session.id equal to `{session_id}`. POST: n/a PUT: Send a new/updated Session object to the eMSP. PATCH: Update the Session object with Session.id equal to `{session_id}`. DELETE: n/aOCPI 2.2.1 Sessions module · #mod_sessions_emsp_interface

Try an endpoint

Send a request to this site's OCPI endpoints and read the answer. It never reaches your own system.