Guest organisation
OCPI
Learn reference
Guest organisation
OCPI
Learn reference

Finishing the charging session

By Abhishek Uniyal · Updated

Step 5 of 11

OCPI 2.2.1

Compare versions

Finishing an OCPI Session means sending its final state to the driver service provider. The CPO also sends a charge detail record, or CDR, for billing; these records do not by themselves show a customer debit.

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

    Session update: status COMPLETED

    PATCH/sessions/{country_code}/{party_id}/{session_id}

    When the Session has finished, the CPO sends the change with PATCH and sets its status to COMPLETED, the final status of a Session. Sessions cannot be deleted.

    Response

    {"status_code": 1000, "timestamp": "2026-10-16T09:30:00Z"}
    Sources (4)
    "Any changes to a Session in the CPO system are sent to the eMSP system by calling PATCH on the eMSP's Sessions endpoint with the updated Session object."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"Sessions cannot be deleted, final status of a session is: `COMPLETED`."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"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

    Charge detail record (CDR)

    POST/cdrs

    The CPO pushes the new CDR to the eMSP's CDRs endpoint with POST. The eMSP answers with a Location header holding the URL of the new CDR. A CDR cannot be changed once it is sent.

    Response

    Location: https://www.server.com/ocpi/emsp/2.2.1/cdrs/123456{"status_code": 1000, "timestamp": "2026-10-16T09:30:00Z"}
    Sources (3)
    "When the CPO creates CDR(s) they push them to the relevant eMSP by calling POST on the eMSPs CDRs endpoint with the newly created CDR(s)."OCPI 2.2.1 CDRs module · #mod_cdrs_push_model"The response should contain the URL to the just created CDR object in the eMSP's system."OCPI 2.2.1 CDRs module · #mod_cdrs_response_headers"Because a CDR is for billing purposes, it cannot be changed or replaced once sent to the eMSP. Changes are simply not allowed."OCPI 2.2.1 CDRs module · #mod_cdrs_flow_and_lifecycle