Guest organisation
OCPI
Learn reference
Guest organisation
OCPI
Learn reference

Starting a charging session

By Abhishek Uniyal · Updated

Step 2 of 11

OCPI 2.2.1

Compare versions

The CPO authorizes the driver's token, in real time with the eMSP or from its own copy of the eMSP's tokens, then pushes the new Session to the eMSP.

What changes in OCPI 2.2.1
Modules in OCPI 2.2.1
Sessions
CDRs
Locations
Tariffs
Tokens
Commands
Credentials
Versions
Hub Client Info
Charging Profiles
Payments · extension
Advertised sender and receiver interfaces

An endpoint declares how another platform can pull or push data. Credentials uses the same interface for both roles.

The header token is encoded

The request header carries an encoded token; the Credentials body still carries the raw token.

Billing records name the Token owner

A charge record names the country and company that own the driver's Token.

Which OCPI messages are exchanged?

  1. CPOeMSP

    Real-time authorization

    POST/tokens/{token_uid}/authorize

    When the eMSP has its Tokens authorized in real time, the CPO asks the eMSP whether a Token may charge, optionally at a given Location. The eMSP answers with an AuthorizationInfo object, and ALLOWED means the Token may charge.

    Response

    {"status_code": 1000, "data": {"allowed": "ALLOWED", "token": {…}}, "timestamp": "2026-10-16T09:30:00Z"}
    Sources (6)
    "An eMSP might want their Tokens to be authorized 'real-time', not white-listed. For this the eMSP has to implement the POST Authorize request and set the Token.whitelist field to `NEVER` for Tokens they want to have authorized 'real-time'."OCPI 2.2.1 Tokens module · #mod_tokens_real-time_authorization"Do a 'real-time' authorization request to the eMSP system, validating if a Token might be used (at the optionally given Location)."OCPI 2.2.1 Tokens module · #mod_tokens_post_method"When the token is known by the Sender, the response SHALL contain a AuthorizationInfo object. If the token is not known, the response SHALL contain the status code: `2004: Unknown Token`, and no `data` field."OCPI 2.2.1 Tokens module · #mod_tokens_post_response_dataALLOWED: This Token is allowed to charge (at this location).OCPI 2.2.1 Tokens module · #mod_tokens_allowed_enum"OCPI status code, as listed in Status Codes, indicates how the request was handled. To avoid confusion with HTTP codes, OCPI status codes consist of four digits."OCPI 2.2.1 Transport and format chapter · #transport_and_format_response_format1000: Generic success codeOCPI 2.2.1 Status codes chapter · #status_codes_1xxx_success
  2. CPOeMSP

    New Session

    PUT/sessions/{country_code}/{party_id}/{session_id}

    The CPO pushes the Session it just created to the eMSP's Sessions endpoint.

    Response

    {"status_code": 1000, "timestamp": "2026-10-16T09:30:00Z"}
    Sources (2)
    "When the CPO creates a Session object they push it to the corresponding eMSP by calling PUT on the eMSP's Sessions endpoint with the newly created Session object."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"We also advise that in such cases, platform sending the response leave the `data` field unset in the response format. This applies for example to PUT requests when pushing Session objects, and PATCH requests to add charging periods to Sessions."OCPI 2.2.1 Transport and format chapter · #transport_and_format_response_format

Does an ACTIVE Session prove energy delivery?

Whether the CPO asks the eMSP in real time depends on the token's whitelist value: the eMSP can require a real-time request, allow one, or rule it out, and then the CPO authorizes from its own copy of the eMSP's tokens. A new Session can start as PENDING, before it becomes ACTIVE. ACTIVE can also describe a Session with no energy transfer; read the meter updates to see how much energy was recorded.

Sources (4)
"An eMSP might want their Tokens to be authorized 'real-time', not white-listed. For this the eMSP has to implement the POST Authorize request and set the Token.whitelist field to `NEVER` for Tokens they want to have authorized 'real-time'."OCPI 2.2.1 Tokens module · #mod_tokens_real-time_authorizationALWAYS: Token always has to be whitelisted, realtime authorization is not possible/allowed. CPO shall always allow any use of this Token. ALLOWED: It is allowed to whitelist the token, realtime authorization is also allowed. The CPO may choose which version of authorization to use. ALLOWED_OFFLINE: In normal situations realtime authorization shall be used. But when the CPO cannot get a response from the eMSP (communication between CPO and eMSP is offline), the CPO shall allow this Token to be used. NEVER: Whitelisting is forbidden, only realtime authorization is allowed. CPO shall always send a realtime authorization for any use of this Token to the eMSP.OCPI 2.2.1 Tokens module · #mod_tokens_whitelisttype_enumPENDING: The session is pending, it has not yet started. Not all pre-conditions are met. This is the initial state. The session might never become an _active_ session.OCPI 2.2.1 Sessions module · #mod_sessions_sessionstatus_enumACTIVE: 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