Have an OCPI object of your own? Check it in the OCPI Message Checker →

Version
Watch from

    requestresponseeMSPCPO

    How to read an OCPI exchange

    OCPI is REST, not a socket protocol, so every step is an HTTP request or its response. Two things trip people up, and the simulator makes both visible:

    • The response envelope. Every reply wraps its payload in { data, status_code, status_message, timestamp }. The HTTP status tells you the transport worked; the status_code tells you whether OCPI is happy. An HTTP 200 can carry a 2003 error, so always read both.
    • Sender = data owner. The Sender is the party that owns the data; the Receiver consumes it. The CPO is the Sender of Locations, Sessions, CDRs and Tariffs; the eMSP is the Sender of Tokens. Each scenario says who is who, and Watch from shows it from your side.

    What changes in OCPI 2.3.0

    Switch the version to 2.3.0 and the changed fields light up. The ones you will meet in these scenarios:

    • Prices: excl_vat and incl_vat are gone; a price has before_taxes and a list of taxes.
    • Tariffs: a new, required tax_included says whether the prices already include tax.
    • Credentials: the HUB role is gone; a hub lists the parties behind it as ordinary roles and gives its own ID in the new hub_party_id.
    • Connectors: a new, optional capabilities list can announce Plug & Charge support.

    2.3.0 also adds parking details, a support phone number, accessibility information, the EMAID token type and the MCS and SAE J3400 connector types. What’s new in OCPI 2.3 covers all of it, and OCPI 2.2 vs 2.2.1 explains the 2.2.1 fields marked in green.

    What each scenario shows

    • Registration handshake: the three-token exchange (A, B, C) that has to happen before any business data flows. Under Break it, try Token A is wrong.
    • Locations: the eMSP pulling a charge point, and where status actually lives (on the EVSE, not the connector). Under Break it, try The Location does not exist.
    • Real-time authorization: the CPO asking the eMSP whether an RFID card may charge, and the 404 with status_code 2004 for a card the eMSP does not know.
    • Sessions: a live session pushed with PUT (answered 201 Created), then merged with PATCH (answered 200 OK).
    • Commands: a remote START, and why Commands are asynchronous. Under Break it, try The charger does not answer and The result never arrives.
    • CDR: the final, immutable billing receipt, with its price in both versions.
    • Paging: pulling every Location page by page with offset, limit, X-Total-Count and the Link header.
    • Tariffs: the CPO pushing a price, and the field 2.3.0 adds to it.
    • Update credentials: rotating tokens with PUT, which is also how a live connection moves to 2.3.0.
    • Delete credentials: ending a connection with DELETE, and the 401 an old token gets afterwards.
    • The error envelope: a command for an unknown Location, an HTTP 200 that is not, in fact, a success.

    The OCPI sandbox guide says what to look at in each of these steps and adds three short exercises. When you move from this teaching aid to a real partner, testing an OCPI connection before go-live lists the handshake requests and the error answers to expect. For the station side of the story, try Rey, the OCPP simulator.

    This is a teaching aid: the exchanges are canned, accurate sample messages, not a live connection to any platform. It runs entirely in your browser. The messages follow OCPI 2.2.1 and OCPI 2.3.0 (edition 2), published by the EVRoaming Foundation.

    Frequently asked questions

    What is an OCPI sandbox?

    An OCPI sandbox lets you exercise the OCPI request and response flow without a live roaming partner. This one steps through accurate OCPI 2.2.1 and 2.3.0 HTTP exchanges (the credentials handshake, Locations, Tokens, Sessions, Tariffs, Commands and CDRs) so you can see the method, path, headers and the envelope of each reply.

    Does it cover OCPI 2.3.0?

    Yes. Switch the version to 2.3.0 and every scenario plays in 2.3.0: prices carry before_taxes and a list of taxes, tariffs carry tax_included, and each field that changed is highlighted with a note. The 2.3.0 messages follow OCPI 2.3.0 edition 2.

    Are these real OCPI messages?

    Yes. The object shapes, field names, paths, status codes and the response envelope follow OCPI 2.2.1 and 2.3.0, and every object passes this site’s OCPI Message Checker. Tokens and URLs are placeholders, and the two parties, Example CPO and Demo eMSP, are fictional.

    Why can an HTTP 200 still be an OCPI error?

    Because the transport and the application layer are separate. When a request is valid JSON and reaches an endpoint that exists, the server must not answer with an HTTP error, so the failure shows up as a non-1000 status_code inside an HTTP 200 envelope. Always read both. A few cases do use an HTTP error: a GET for an object that does not exist should return 404, an unknown credentials token gets 401, and real-time authorization of an unknown token returns 404 with status_code 2004.

    What does "Watch from" do?

    It puts the party you are building on the left and labels every message as one you send or one you receive. Pick the eMSP side if you are building an eMSP, and the CPO side if you are building a CPO.