Establish an OCPI 2.2.1 connection to the counterparty (eMSP or CPO) or roaming hub: complete the credentials handshake by exchanging tokens via POST /ocpi/2.2.1/credentials and retrieve the versions and module URLs from the returned version detail endpoint.
Implement the Tariffs module as a CPO: push tariff objects (containing TariffElement arrays with PriceComponent entries for FLAT, ENERGY, TIME, and PARKING_TIME types, plus TariffRestriction time/day filters) to the eMSP via PUT /ocpi/{version}/tariffs/{country_code}/{party_id}/{tariff_id}.
During a charging session, build the CDR (Charge Detail Record) on session close: populate required fields including id, start_date_time, end_date_time, cdr_token, auth_method, cdr_location, currency, tariffs (snapshot at session start), charging_periods (per-interval energy and time), total_cost, and total_energy.
For Credit CDRs (introduced in OCPI 2.2.1 to handle billing corrections), set the credit flag to true and reference the original CDR id in the credit_reference_id field; push via POST /ocpi/{version}/cdrs.
Include Calibration Law / Eichrecht fields in CDRs where legally required (Germany and other EU markets): populate the signed_data field with the meter's signed OCMF or EDIFACT payload for legal admissibility of the energy measurement.
Reconcile CDR totals: verify that total_cost equals the sum of cost across all ChargingPeriods after applying tariff rules; mismatches cause eMSP rejection — implement a pre-submission validation step.
Known gotchas
OCPI 2.2.1 CDRs include a tariff snapshot at the time of the session, not a reference to the current tariff; if the tariff changes between session start and CDR submission, the CDR must reflect the tariff active at session start — storing tariff snapshots at authorization time is essential.
The Credit CDR mechanism is new in 2.2.1 and not all eMSP implementations handle it correctly; test credit CDR acceptance with your counterparty before relying on it for billing corrections.
OCPI uses party_id and country_code as compound identifiers for all objects; using the wrong country_code (e.g., 'EU' instead of a valid ISO 3166-1 alpha-2 code) will cause object routing failures through roaming hubs.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp