How OCPI works

Beginner

By Abhishek Uniyal · Updated

Step 4 of 6

An OCPI exchange has a request and a response. Platforms discover module URLs, then exchange charging data under their selected version.

Sources (4)
"The Open Charge Point Interface (OCPI) enables a scalable, automated EV roaming setup between Charge Point Operators and e-Mobility Service Providers."OCPI 2.2.1 specification · #introduction_introduction_and_backgroundALWAYS: 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_enum"This endpoint lists all the available OCPI versions and the corresponding URLs to where version specific details such as the supported endpoints can be found."OCPI 2.2.1 Version information endpoint chapter · #version_information_endpoint_version_information_endpoint"The Sender generates a unique credentials token: `CREDENTIALS_TOKEN_B`, sends it to the Receiver in a POST request to the `credentials` module of the Receiver. The Receiver stores `CREDENTIALS_TOKEN_B` and uses it for any requests to the Sender Platform, including the version information and details."OCPI 2.2.1 Credentials chapter · #credentials_registration
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.

How do the platforms exchange information?

One platform asks and the other answers. Here is the shape of one exchange between an eMSP and a CPO:

One exchange
eMSP

→

Asks for information

→

CPO
CPO

→

Sends the answer back

→

eMSP
What they exchange
Locations
Tariffs
Tokens
Sessions
CDRs
Commands

Must every card tap contact the eMSP?

The Token is the driver identification record. Its whitelist policy tells the CPO when it can authorize from its stored copy and when it must ask the eMSP in real time.

ALWAYS
Use the whitelist. Real-time authorization is not allowed.
ALLOWED
The CPO may choose stored authorization or a real-time request.
ALLOWED_OFFLINE
Use real-time authorization normally. If communication with the eMSP is offline, allow this Token from the stored copy.
NEVER
Do not whitelist. Send a real-time authorization request for every use.
Sources (2)
"The Open Charge Point Interface (OCPI) enables a scalable, automated EV roaming setup between Charge Point Operators and e-Mobility Service Providers."OCPI 2.2.1 specification · #introduction_introduction_and_backgroundALWAYS: 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_enum

Does HTTP success mean OCPI success?

Read both layers of the response. HTTP is the transport status; the OCPI response body has its own status_code. OCPI 1000 is the generic success code. An HTTP success alone does not establish the OCPI result.

Teaching example · OCPI 2.2.1 response body excerpt

{
  "status_code": 1000
}
Sources (2)
"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
One platform asks, the other answersEach module carries one kind of dataAuthorization follows the Token whitelist policy