- Reference
- OCPI 2.2.1 (eMSP)
- Receiver Tariff
OpenAPI reference
Receiver Tariff
/tariffs/{country_code}/{party_id}/{tariff_id}Push a new or updated Tariff. PUT is full-replace per OCPI 2.2.1 §12.4.2 — omitted optional fields reset to their schema defaults. Path `tariff_id` MUST match `body.id` (2001 on mismatch).
API: OCPI 2.2.1 (eMSP) · Module: Tariffs (eMSP)
Base path:/tariffs· Base URL:https://ocpi-api.gridos.co/ocpi/emsp/2.2.1
Overview
PUT /tariffs/{country_code}/{party_id}/{tariff_id}Absolute URL: https://ocpi-api.gridos.co/ocpi/emsp/2.2.1/tariffs/{country_code}/{party_id}/{tariff_id}
Push a new or updated Tariff. PUT is full-replace per OCPI 2.2.1 §12.4.2 — omitted optional fields reset to their schema defaults. Path tariff_id MUST match body.id (2001 on mismatch).
Requires authentication. Use Authorization: Token <token>. See OCPI credentials.
How to call
Quick Shell sample (set OCPI_TOKEN when auth is required). Full Python and TypeScript under Examples.
curl -sS -X PUT 'https://ocpi-api.gridos.co/ocpi/emsp/2.2.1/tariffs/NL/ABC/TARIFF1' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"country_code":"NL","party_id":"STK","id":"11","currency":"EUR","type":"REGULAR","elements":[{"price_components":[{"type":"FLAT","price":2.5,"step_size":1}]},{"price_components":[{"type":"TIME","price":1,"step_size":900}],"restrictions":{"max_power":32}}],"last_updated":"2015-06-29T20:39:09Z"}'Request
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
country_code | string | Yes | ISO-3166 alpha-2 country code (uppercase). |
party_id | string | Yes | CPO/eMSP party ID (ISO-15118, 3 uppercase alphanumerics). |
tariff_id | string | Yes | Tariff.id of the Tariff object. |
Request body
application/json · Required
Schema: Tariff
| Field | Type | Required | Description |
|---|---|---|---|
country_code | string | Yes | — |
party_id | string | Yes | — |
id | string | Yes | — |
currency | string | Yes | — |
type | `"AD_HOC_PAYMENT" | "PROFILE_CHEAP" | "PROFILE_FAST" |
tariff_alt_text | DisplayText[] | No | — |
tariff_alt_url | string | No | — |
min_price | Price | No | OCPI Price: an amount with and without VAT. |
max_price | Price | No | OCPI Price: an amount with and without VAT. |
elements | TariffElement[] | Yes | Elements |
start_date_time | string (date-time) | No | — |
end_date_time | string (date-time) | No | — |
energy_mix | EnergyMix | No | OCPI EnergyMix: the energy sources / environmental impact of a supply. |
last_updated | string (date-time) | Yes | — |
Request examples
Example 1
{
"country_code": "NL",
"party_id": "STK",
"id": "11",
"currency": "EUR",
"type": "REGULAR",
"elements": [
{
"price_components": [
{
"type": "FLAT",
"price": 2.5,
"step_size": 1
}
]
},
{
"price_components": [
{
"type": "TIME",
"price": 1,
"step_size": 900
}
],
"restrictions": {
"max_power": 32
}
}
],
"last_updated": "2015-06-29T20:39:09Z"
}Example 2
{
"country_code": "DE",
"party_id": "EMP",
"id": "12",
"currency": "EUR",
"type": "REGULAR",
"tariff_alt_text": [
{
"language": "en",
"text": "Parking garage tariff"
}
],
"elements": [
{
"price_components": [
{
"type": "ENERGY",
"price": 0.35,
"step_size": 1
}
]
}
],
"last_updated": "2015-07-01T07:50:00Z"
}Responses
| Status | Description | Schema |
|---|---|---|
200 | Successful Response | TariffResponse |
400 | Invalid or missing parameters (HTTP 200, OCPI envelope) | — |
401 | Unauthorized | — |
422 | Validation Error | HTTPValidationError |
200 — successful response
application/json
Schema: TariffResponse
| Field | Type | Required | Description |
|---|---|---|---|
status_code | integer | No | Default: 1000 |
status_message | string | No | — |
timestamp | string (date-time) | No | — |
data | TariffOut | No | TariffOut |
Response example
{
"status_code": 1000,
"status_message": "Success",
"timestamp": "2024-01-15T10:00:00Z",
"data": {
"country_code": "NL",
"currency": "EUR",
"elements": [
{
"price_components": [
{
"price": 0.2,
"step_size": 1,
"type": "ENERGY",
"vat": 21
}
]
}
],
"end_date_time": "2024-12-31T23:59:59Z",
"energy_mix": {
"energy_sources": [
{
"percentage": 100,
"source": "SOLAR"
}
],
"is_green_energy": true
},
"id": "TARIFF-001",
"last_updated": "2024-01-15T10:00:00Z",
"max_price": {
"excl_vat": 50,
"incl_vat": 60.5
},
"min_price": {
"excl_vat": 0.5,
"incl_vat": 0.605
},
"party_id": "CPO",
"start_date_time": "2024-01-01T00:00:00Z",
"tariff_alt_text": [
{
"language": "en",
"text": "Standard tariff €0.20/kWh"
}
],
"tariff_alt_url": "https://example.com/tariffs/TARIFF-001",
"type": "REGULAR"
}
}400 — invalid or missing parameters (HTTP 200, OCPI envelope)
application/json
Response example
{
"status_code": 2001,
"status_message": "Invalid or missing parameters",
"timestamp": "2025-01-01T00:00:00Z",
"doc_url": "https://github.com/ocpplab/ocpi-gateway/blob/main/docs/errors.md#2001-invalid-parameters",
"errors": [
{
"field": "country_code",
"message": "expected 'NL' to match Token A identity",
"type": "value_error.identity_mismatch"
}
]
}401 — unauthorized
application/json
Response example
{
"status_code": 2001,
"status_message": "Unauthorized",
"timestamp": "2025-01-01T00:00:00Z"
}422 — validation error
application/json
Schema: HTTPValidationError
| Field | Type | Required | Description |
|---|---|---|---|
detail | ValidationError[] | No | Detail |
Response example
{
"detail": [
{
"loc": [],
"msg": "string",
"type": "string",
"input": {
"_type": "Input"
},
"ctx": {
"_type": "Context"
}
}
]
}Examples
Shell, Python, and TypeScript (set OCPI_TOKEN when auth is required).
curl -sS -X PUT 'https://ocpi-api.gridos.co/ocpi/emsp/2.2.1/tariffs/NL/ABC/TARIFF1' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"country_code":"NL","party_id":"STK","id":"11","currency":"EUR","type":"REGULAR","elements":[{"price_components":[{"type":"FLAT","price":2.5,"step_size":1}]},{"price_components":[{"type":"TIME","price":1,"step_size":900}],"restrictions":{"max_power":32}}],"last_updated":"2015-06-29T20:39:09Z"}'