Sessions

OCPI 2.1.1

By Abhishek Uniyal · Updated

Sessions in OCPI 2.1.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.

Sources (4)
id · string(36) · cardinality 1: The unique id that identifies the session in the CPO platform. start_datetime · DateTime · cardinality 1: The time when the session became active. end_datetime · DateTime · cardinality ?: The time when the session is completed. kwh · number · cardinality 1: How many kWh are charged. auth_id · string(36) · cardinality 1: Reference to a token, identified by the auth_id field of the Token. auth_method · AuthMethod · cardinality 1: Method used for authentication. location · Location · cardinality 1: The location where this session took place, including only the relevant EVSE and connector 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 · number · cardinality ?: The total cost (excluding VAT) 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, no price information is given in the Session object, this does not have to mean it is 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.1.1 Sessions module · #31-session-objectACTIVE: The session is accepted and active. Al pre-condition are 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.1.1 Sessions module · #41-sessionstatus-enum"Sessions cannot be deleted, final status of a session is: `COMPLETED`."OCPI 2.1.1 Sessions module · #11-push-model"Same as the PUT method, but only the fields/objects that have to be updated have to be present, other fields/objects that are not specified are considered unchanged."OCPI 2.1.1 Sessions module · #223-patch-method

Example payload · zero-energy-active

{
  "id": "EXAMPLE-SESSION",
  "kwh": 0,
  "auth_method": "WHITELIST",
  "currency": "EUR",
  "status": "ACTIVE",
  "last_updated": "2026-01-01T00:00:00Z",
  "start_datetime": "2026-01-01T00:00:00Z",
  "auth_id": "EXAMPLE-CONTRACT",
  "location": {
    "id": "EXAMPLE-LOCATION",
    "type": "ON_STREET",
    "address": "Example Street 1",
    "city": "Utrecht",
    "postal_code": "3511AA",
    "country": "NLD",
    "coordinates": {
      "latitude": "52.090700",
      "longitude": "5.121400"
    },
    "evses": [
      {
        "uid": "EXAMPLE-EVSE",
        "status": "AVAILABLE",
        "connectors": [
          {
            "id": "1",
            "standard": "IEC_62196_T2",
            "format": "SOCKET",
            "power_type": "AC_3_PHASE",
            "voltage": 230,
            "amperage": 32,
            "last_updated": "2026-01-01T00:00:00Z"
          }
        ],
        "last_updated": "2026-01-01T00:00:00Z"
      }
    ],
    "last_updated": "2026-01-01T00:00:00Z"
  }
}

Example payload · update-cost

{
  "total_cost": 0.6
}
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

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

    GET
    /ocpi/2.1.1/sessions/
Source
Method: Description ----------------------: --------------------------------------------------------------------------------------- GET: Fetch Session objects of charging sessions last updated between the {date_from} and {date_to} (paginated) POST: n/a PUT: n/a PATCH: n/a DELETE: n/aOCPI 2.1.1 Sessions module · #21-cpo-interface

eMSP

  • Get the Session object from the eMSP system by its id {session_id}.

    GET
    /ocpi/2.1.1/sessions/{country_code}/{party_id}/{session_id}
  • Send a new/updated Session object

    PUT
    /ocpi/2.1.1/sessions/{country_code}/{party_id}/{session_id}
  • Update the Session object of id {session_id}.

    PATCH
    /ocpi/2.1.1/sessions/{country_code}/{party_id}/{session_id}
Source
Method: Description ------------------------------: --------------------------------------------------------------------- GET: Get the Session object from the eMSP system by its id {session_id}. POST: n/a PUT: Send a new/updated Session object PATCH: Update the Session object of id {session_id}. DELETE: n/aOCPI 2.1.1 Sessions module · #22-emsp-interface

Try an endpoint

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