The OCPI Tariffs module is how a Charge Point Operator (coming soon) tells an eMSP what charging costs. The CPO publishes Tariff objects, each Connector in the Locations module points at the tariffs that apply to it, and the eMSP uses them to quote a price before the session and to check the bill after it. This page is the reference for the object and the endpoints in OCPI 2.2.1: every field with its required flag, the rule that decides which tariff element applies, a complete JSON example that parses, and the mistakes that produce wrong bills. Each statement below was checked against the 2.2.1 Tariffs module text. The pricing arithmetic of each dimension and step_size rounding has its own page, OCPI tariff dimensions in depth.
What the OCPI Tariffs module covers
- Module identifier:
tariffs. Data owner: CPO. - Sender interface (CPO): a paginated GET list, so a receiver can do a full sync.
- Receiver interface (eMSP, NSP): GET, PUT and DELETE on a single Tariff.
- Advised direction: push from CPO to eMSP during normal operation. The pull side exists for the first sync after a connection is set up, and for when the receiver is not sure its cache is current. OCPI pull vs push patterns covers how to combine the two.
Tariffs sit next to three other modules. Connectors in Locations carry tariff_ids; the Locations Receiver interface is formally dependent on Tariffs. A CDR carries a tariffs list with the tariffs relevant to that session, and each charging period names its tariff_id. Sessions charging preferences decide which tariff type applies. If the roles are new to you, start with what OCPI is.
The nesting is three levels deep, and knowing which level holds what is most of the module:
flowchart TB
T[Tariff: currency, type, validity dates]
T --> E1[Element 1: off-peak]
T --> E2[Element 2: default, no restrictions]
E1 --> R1[restriction: 22:00 to 06:00]
E1 --> P1[ENERGY 0.30 EUR per kWh]
E2 --> P2[FLAT 0.50 EUR per session]
E2 --> P3[ENERGY 0.55 EUR per kWh]
E2 --> P4[PARKING_TIME 6.00 EUR per hour]
style T fill:#dbeafe,stroke:#2563eb
style E1 fill:#fef3c7,stroke:#d97706
style E2 fill:#fef3c7,stroke:#d97706
The Tariff object: every field
Cardinality follows the spec: 1 required, ? optional, * optional list, + list with at least one entry.
| Field | Type | Card. | What to know |
|---|---|---|---|
country_code | CiString(2) | 1 | ISO 3166-1 alpha-2 of the owning CPO |
party_id | CiString(3) | 1 | The owning CPO’s party ID |
id | CiString(36) | 1 | Unique only within that CPO’s platform |
currency | string(3) | 1 | ISO 4217, one currency per Tariff |
type | TariffType | ? | AD_HOC_PAYMENT, PROFILE_CHEAP, PROFILE_FAST, PROFILE_GREEN, REGULAR. Omitted means valid for all sessions |
tariff_alt_text | DisplayText | * | Human-readable text per language (language, text) |
tariff_alt_url | URL | ? | Page explaining the tariff, useful for dynamic prices |
min_price | Price | ? | Session costs at least this (excl_vat required, incl_vat optional) |
max_price | Price | ? | Session never costs more than this |
elements | TariffElement | + | The pricing rules, in order |
start_date_time | DateTime | ? | UTC instant the tariff becomes active |
end_date_time | DateTime | ? | UTC instant after which it is no longer valid |
energy_mix | EnergyMix | ? | Same structure as on a Location |
last_updated | DateTime | 1 | Move it forward on every change |
Inside elements, a TariffElement has price_components (PriceComponent, +) and restrictions (TariffRestrictions, ?). A PriceComponent has four fields:
| Field | Type | Card. | Meaning |
|---|---|---|---|
type | TariffDimensionType | 1 | ENERGY, FLAT, PARKING_TIME or TIME |
price | number | 1 | Price per unit, excluding VAT |
vat | number | ? | VAT percentage. Omitted means no VAT applies, which is not the same as 0.0 |
step_size | int | 1 | Billing block, rounded up to the next multiple |
The units are where most bugs start:
| Dimension | Price unit | step_size unit |
|---|---|---|
ENERGY | per kWh | 1 Wh |
TIME (charging) | per hour | 1 second |
PARKING_TIME (not charging) | per hour | 1 second |
FLAT | per session | none |
TariffRestrictions fields are all optional, and when several are set they combine as a logical AND:
| Field | Unit and boundary |
|---|---|
start_time, end_time | Local HH:MM using the Location’s time_zone. If end is earlier than start, the window wraps past midnight |
start_date, end_date | Local YYYY-MM-DD, start inclusive, end exclusive |
min_kwh, max_kwh | Energy consumed in the session, min inclusive, max exclusive |
min_current, max_current | Amperes summed over all phases, at this moment |
min_power, max_power | kW, at this moment |
min_duration, max_duration | Seconds of session duration |
day_of_week | List of MONDAY to SUNDAY |
reservation | RESERVATION or RESERVATION_EXPIRES; the element then prices the reservation, with only FLAT and TIME allowed |
How OCPI picks the tariff element that applies
This is the rule that the JSON alone does not show you, and the spec states it precisely. For each dimension separately, the first Tariff Element in the list that contains a Price Component for that dimension and whose restrictions match is used. Only one Price Component per dimension is active at any moment, but different dimensions can be active at once and can come from different elements.
Three consequences follow:
- Order matters, and the default goes last. An element with no restrictions always matches. Place it first and every later element for the same dimension is unreachable. The spec advises a default per dimension, placed after all other elements for that dimension.
- No match means no charge for that dimension. If nothing matches and there is no unrestricted fallback, the driver pays nothing for that dimension. A missing default is a revenue bug, not a validation error.
- Restrictions are checked continuously, not once at session start. The spec says restrictions describe when an element becomes active or inactive during a session. A session that starts at 05:30 under an off-peak window pays the off-peak rate until 06:00 and the default rate after it. Power and current restrictions switch in the same way as the car’s charging rate rises and falls, including when a limit set through the ChargingProfiles module lowers it.
A “Free of Charge” tariff is not an empty tariff. The spec defines it as one Tariff Element without restrictions holding one FLAT Price Component with price 0.00, and a free Connector should point at it through tariff_ids.
A complete Tariff in valid JSON
Off-peak energy at €0.30/kWh from 22:00 to 06:00, €0.55/kWh otherwise, a €0.50 start fee, and a €6.00/hour parking fee (€0.10 a minute) once charging stops. All prices exclude 21% VAT. This parses as-is:
{
"country_code": "NL",
"party_id": "TNM",
"id": "AC-OFFPEAK-2026",
"currency": "EUR",
"type": "REGULAR",
"tariff_alt_text": [
{
"language": "en",
"text": "The parking fee starts when charging stops, even if the cable is still connected."
}
],
"min_price": { "excl_vat": 1.00, "incl_vat": 1.21 },
"max_price": { "excl_vat": 60.00, "incl_vat": 72.60 },
"elements": [
{
"price_components": [
{ "type": "ENERGY", "price": 0.30, "vat": 21.0, "step_size": 1 }
],
"restrictions": { "start_time": "22:00", "end_time": "06:00" }
},
{
"price_components": [
{ "type": "FLAT", "price": 0.50, "vat": 21.0, "step_size": 1 },
{ "type": "ENERGY", "price": 0.55, "vat": 21.0, "step_size": 1 },
{ "type": "PARKING_TIME", "price": 6.00, "vat": 21.0, "step_size": 60 }
]
}
],
"start_date_time": "2026-11-01T00:00:00Z",
"last_updated": "2026-10-28T09:00:00Z"
}
Walk one session through it. A driver plugs in at 22:30, takes 20 kWh by 00:30, and leaves at 01:00.
| Dimension | Element used | Quantity | Cost excl. VAT |
|---|---|---|---|
| FLAT | 2 (only one with FLAT) | 1 | 0.50 |
| ENERGY | 1 (window matches) | 20 kWh | 6.00 |
| PARKING_TIME | 2 (only one with PARKING_TIME) | 30 min | 3.00 |
| Total | 9.50 |
With 21% VAT that is 11.495, which shows the one thing the module leaves open. OCPI has no rounding parameters, and the spec says rounding follows applicable law, contracts and currency rules. Agree it with each partner in writing. The same session at 14:00 would use element 2 for energy and total 14.50 before VAT.
Two choices in the example are deliberate. step_size is 1 for energy because the spec advises 1 for anyone who wants compatibility with OCPI 3.0, which removes the field. And tariff_alt_text carries no prices: when a Tariff has both elements and tariff_alt_text, the text SHALL hold only additional information, because the eMSP may add its own fees when talking to its customer.
Endpoints: who calls what
| Interface | Method | Path | Purpose |
|---|---|---|---|
| Sender (CPO) | GET | {tariffs_url}?date_from&date_to&offset&limit | Paginated list for a full or delta sync |
| Receiver (eMSP) | GET | {tariffs_url}/{country_code}/{party_id}/{tariff_id} | CPO checks what the eMSP holds |
| Receiver (eMSP) | PUT | same | Create or replace a Tariff |
| Receiver (eMSP) | DELETE | same | Remove a Tariff that will not be used again |
POST and PATCH are n/a on both interfaces. There is no partial update, so changing one price means a PUT of the full object. The country_code and party_id in the URL SHALL equal the ones in the body.
PUT /ocpi/emsp/2.2.1/tariffs/NL/TNM/AC-OFFPEAK-2026 HTTP/1.1
Host: emsp.example.com
Authorization: Token <token the eMSP issued to this CPO>
Content-Type: application/json
X-Request-ID: 6f1d2c1e-6b1e-4a7e-9a55-0f6c1b2d3e4f
X-Correlation-ID: 1b9c7a52-0d6e-4f0b-8b1e-3a2f4c5d6e7f
The body is the full Tariff above. A successful reply carries an envelope whose status_code is 1000. Always read the envelope, because a 2xxx client error code can arrive inside an HTTP 200. OCPI error responses explained covers the codes, and OCPI request examples shows the shared headers on other modules.
On the pull side, date_from is inclusive and date_to exclusive on last_updated, and paging uses the Link, X-Total-Count and X-Limit headers. An eMSP that relies only on pull should replace its whole known list with what it receives, which is how a deleted tariff disappears for a pull-only partner.
How tariffs connect to connectors, sessions and CDRs
Connector tariff_ids. A Connector can list several tariffs, but only one of each type may be active at a time. Two tariffs of the same type are allowed only if their start_date_time to end_date_time periods do not overlap. With preference-based smart charging, list one tariff per profile type so the driver sees each option.
Price changes without a race. The spec’s own pattern: give the current tariff an end_date_time, publish the replacement with a matching start_date_time, and list both IDs on the Connector. The switch then happens on time, and the old ID can be removed from Locations later. Before you DELETE a tariff, the spec recommends making sure no Connector still references it.
Mid-session changes. OCPI does not forbid changing a tariff during a session, but the spec notes that it is common not to, and that consumer law in many countries does not allow it. The driver agreed to the tariff that was valid at the start.
CDRs. The CDR lists the tariffs relevant to the session and names a tariff_id per charging period. That is what lets an eMSP recompute the cost and compare it with total_cost, which is how a rounding disagreement or a stale cache shows up before the driver sees it.
Different prices for different eMSPs. The Tariff object has no field naming an eMSP. Each OCPI connection is bilateral, so a CPO controls which Tariffs it PUTs to each partner; if partners get different prices, the tariff_ids on the Connectors each partner receives must match the tariffs that partner holds. Through a hub, check how it routes Tariffs and Locations before you count on this. A Tariff is the price the CPO charges the eMSP; what the eMSP then charges its driver is a separate commercial decision, and the economics of OCPI roaming works one DC session through both prices.
Common mistakes and what the spec says
| Mistake | What the spec says | Fix |
|---|---|---|
| TIME or PARKING_TIME priced per minute | Both are defined in hours | €0.10/min is "price": 6.00 |
ENERGY step_size read as kWh, TIME as minutes | Multipliers are 1 Wh and 1 second | 1000 = whole kWh, 60 = whole minutes |
| Unrestricted default element placed first | First matching element per dimension wins | Put defaults last |
| No fallback for a dimension | No match means no cost for it | Add an unrestricted element per dimension |
Prices repeated in tariff_alt_text | Only additional info when elements exist | Keep prices in elements |
Local store keyed on bare id | id is unique only within the CPO | Key on country_code + party_id + id |
min_duration used as “idle for an hour” | It counts session duration | Model idle cost with PARKING_TIME |
vat omitted to mean 0% | Omitted means no VAT applicable | Send 0.0 when the rate is zero |
| PATCH to update a price | PATCH is n/a | PUT the whole Tariff |
Free connector with empty tariff_ids | Point to a Free of Charge tariff | One FLAT 0.00 element, no restrictions |
What changes in OCPI 2.3.0
OCPI 2.3.0, published in February 2025, keeps the module’s shape: the same endpoints, no PATCH, the same TariffType values and the same element-matching rule. The changes are about tax and payment, per the 2.3.0 Tariffs text:
tax_includedis a new required field on the Tariff with valuesYES,NOandN/A, andpriceis read as including or excluding tax according to it. The spec’s examples use it for Canada and the United States, where tax rates are not typically known to the CPO in advance, sovatis left out.min_priceandmax_pricebecome a PriceLimit withbefore_taxes(required) andafter_taxes(optional), replacingexcl_vatandincl_vat.preauthorize_amountis new: the amount a payment terminal provider should preauthorize for a card-paid session.
A 2.2.1 parser that rejects unknown fields will fail on 2.3.0 Tariffs, so negotiate the version per partner through Credentials and Versions. What is new in OCPI 2.3.0 covers the rest of the release.
The part OCPI leaves to you
The data model leaves less to interpretation than it first appears. Which element applies, when a restriction switches on and off, how step_size rounds and what “free” looks like are all written down. The spec stays silent on one thing on purpose, and that is how money is rounded. That gap is why two careful implementations can still produce totals a cent apart. Settle rounding with each partner before live pricing flows, recompute each CDR against the tariffs it lists, and treat a mismatch as a conversation about rounding before you treat it as an error. For the dimension-by-dimension arithmetic, including how step_size behaves when a session crosses from one element to another, continue with OCPI tariff dimensions in depth. To see how a priced session becomes an invoice, read from OCPP meter values to an invoice (coming soon).