- Reference
- OCPI 2.1.1 (eMSP)
- Receiver CDRs
OpenAPI reference
Receiver CDRs
/cdrsSend a new CDR to the eMSP. The response must contain a Location header with the URL to the newly created CDR.
API: OCPI 2.1.1 (eMSP) · Module: CDRs (eMSP)
Base path:/cdrs· Base URL:https://ocpi-api.gridos.co/ocpi/emsp/2.1.1
Overview
POST /cdrsAbsolute URL: https://ocpi-api.gridos.co/ocpi/emsp/2.1.1/cdrs
Send a new CDR to the eMSP. The response must contain a Location header with the URL to the newly created CDR.
Storage scope (country_code / party_id) is taken from the authenticated caller identity; the native 2.1.1 CDR body carries no party identity.
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 POST 'https://ocpi-api.gridos.co/ocpi/emsp/2.1.1/cdrs' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"id":"12345","start_date_time":"2015-06-29T21:39:09Z","stop_date_time":"2015-06-29T23:37:32Z","auth_id":"DE8ACC12E46L89","auth_method":"WHITELIST","location":{"id":"LOC1","type":"ON_STREET","name":"Gent Zuid","address":"F.Rooseveltlaan 3A","city":"Gent","postal_code":"9000","country":"BEL","coordinates":{"latitude":"51.047599","longitude":"3.729944"},"evses":[{"uid":"3256","evse_id":"BE-BEC-E041503003","status":"AVAILABLE","connectors":[{"id":"1","standard":"IEC_62196_T2","format":"SOCKET","power_type":"AC_1_PHASE","voltage":230,"amperage":64,"last_updated":"2015-06-29T21:39:01Z"}],"last_updated":"2015-06-29T21:39:01Z"}],"last_updated":"2015-06-29T21:39:01Z"},"currency":"EUR","tariffs":[{"id":"12","currency":"EUR","elements":[{"price_components":[{"type":"TIME","price":2,"step_size":300}]}],"last_updated":"2015-02-02T14:15:01Z"}],"charging_periods":[{"start_date_time":"2015-06-29T21:39:09Z","dimensions":[{"type":"TIME","volume":1.973}]}],"total_cost":4,"total_energy":15.342,"total_time":1.973,"last_updated":"2015-06-29T22:01:13Z"}'Request
Request body
application/json · Required
Schema: Cdr
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
start_date_time | string (date-time) | Yes | — |
stop_date_time | string (date-time) | Yes | — |
auth_id | string | Yes | — |
auth_method | `"AUTH_REQUEST" | "WHITELIST"` | Yes |
location | Location | Yes | Location |
meter_id | string | No | — |
currency | string | Yes | — |
tariffs | Tariff[] | No | — |
charging_periods | ChargingPeriod[] | Yes | Charging Periods |
total_cost | number | Yes | — |
total_energy | number | Yes | — |
total_time | number | Yes | — |
total_parking_time | number | No | — |
remark | string | No | — |
last_updated | string (date-time) | Yes | — |
Request examples
Example 1
{
"id": "12345",
"start_date_time": "2015-06-29T21:39:09Z",
"stop_date_time": "2015-06-29T23:37:32Z",
"auth_id": "DE8ACC12E46L89",
"auth_method": "WHITELIST",
"location": {
"id": "LOC1",
"type": "ON_STREET",
"name": "Gent Zuid",
"address": "F.Rooseveltlaan 3A",
"city": "Gent",
"postal_code": "9000",
"country": "BEL",
"coordinates": {
"latitude": "51.047599",
"longitude": "3.729944"
},
"evses": [
{
"uid": "3256",
"evse_id": "BE-BEC-E041503003",
"status": "AVAILABLE",
"connectors": [
{
"id": "1",
"standard": "IEC_62196_T2",
"format": "SOCKET",
"power_type": "AC_1_PHASE",
"voltage": 230,
"amperage": 64,
"last_updated": "2015-06-29T21:39:01Z"
}
],
"last_updated": "2015-06-29T21:39:01Z"
}
],
"last_updated": "2015-06-29T21:39:01Z"
},
"currency": "EUR",
"tariffs": [
{
"id": "12",
"currency": "EUR",
"elements": [
{
"price_components": [
{
"type": "TIME",
"price": 2,
"step_size": 300
}
]
}
],
"last_updated": "2015-02-02T14:15:01Z"
}
],
"charging_periods": [
{
"start_date_time": "2015-06-29T21:39:09Z",
"dimensions": [
{
"type": "TIME",
"volume": 1.973
}
]
}
],
"total_cost": 4,
"total_energy": 15.342,
"total_time": 1.973,
"last_updated": "2015-06-29T22:01:13Z"
}Example 2
{
"id": "CDR-98765",
"start_date_time": "2015-07-01T08:00:00Z",
"stop_date_time": "2015-07-01T09:10:00Z",
"auth_id": "NL-EMP-445566",
"auth_method": "AUTH_REQUEST",
"location": {
"id": "LOC2",
"type": "PARKING_GARAGE",
"address": "Stationsplein 1",
"city": "Utrecht",
"postal_code": "3511AA",
"country": "NLD",
"coordinates": {
"latitude": "52.089444",
"longitude": "5.110278"
},
"evses": [
{
"uid": "EVSE-UTR-1",
"status": "AVAILABLE",
"connectors": [
{
"id": "1",
"standard": "IEC_62196_T2",
"format": "SOCKET",
"power_type": "AC_3_PHASE",
"voltage": 400,
"amperage": 32,
"last_updated": "2015-07-01T07:59:00Z"
}
],
"last_updated": "2015-07-01T07:59:00Z"
}
],
"last_updated": "2015-07-01T07:59:00Z"
},
"currency": "EUR",
"charging_periods": [
{
"start_date_time": "2015-07-01T08:00:00Z",
"dimensions": [
{
"type": "ENERGY",
"volume": 18.75
}
]
}
],
"total_cost": 6.95,
"total_energy": 18.75,
"total_time": 1.1667,
"last_updated": "2015-07-01T09:10:00Z"
}Responses
| Status | Description | Schema |
|---|---|---|
201 | Successful Response | CdrResponse |
400 | Invalid or missing parameters (HTTP 200, OCPI envelope) | — |
401 | Unauthorized | — |
422 | Validation Error | HTTPValidationError |
201 — successful response
application/json
Schema: CdrResponse
| Field | Type | Required | Description |
|---|---|---|---|
status_code | integer | No | Default: 1000 |
status_message | string | No | — |
timestamp | string (date-time) | No | — |
data | CDROut | No | CDROut |
Response example
{
"status_code": 1000,
"status_message": "Success",
"timestamp": "2015-06-29T22:39:09Z",
"data": {
"auth_id": "DE8ACC12E46L89",
"auth_method": "WHITELIST",
"charging_periods": [
{
"dimensions": [
{
"type": "TIME",
"volume": 1.973
}
],
"start_date_time": "2015-06-29T21:39:09Z"
}
],
"currency": "EUR",
"id": "12345",
"last_updated": "2015-06-29T22:01:13Z",
"location": {
"address": "F.Rooseveltlaan 3A",
"city": "Gent",
"coordinates": {
"latitude": "51.047599",
"longitude": "3.729944"
},
"country": "BEL",
"evses": [
{
"connectors": [
{
"amperage": 64,
"format": "SOCKET",
"id": "1",
"last_updated": "2015-03-16T10:10:02Z",
"power_type": "AC_1_PHASE",
"standard": "IEC_62196_T2",
"tariff_id": "11",
"voltage": 230
}
],
"evse_id": "BE-BEC-E041503003",
"last_updated": "2015-06-28T08:12:01Z",
"status": "AVAILABLE",
"uid": "3256"
}
],
"id": "LOC1",
"last_updated": "2015-06-29T20:39:09Z",
"postal_code": "9000",
"type": "ON_STREET"
},
"meter_id": "METER-001",
"remark": "Charged at Gent Zuid",
"start_date_time": "2015-06-29T21:39:09Z",
"stop_date_time": "2015-06-29T23:37:32Z",
"tariffs": [
{
"currency": "EUR",
"elements": [
{
"price_components": [
{
"price": 2,
"step_size": 300,
"type": "TIME"
}
]
}
],
"id": "12",
"last_updated": "2015-02-02T14:15:01Z"
}
],
"total_cost": 4,
"total_energy": 15.342,
"total_parking_time": 0.25,
"total_time": 1.973
}
}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": 2000,
"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 POST 'https://ocpi-api.gridos.co/ocpi/emsp/2.1.1/cdrs' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"id":"12345","start_date_time":"2015-06-29T21:39:09Z","stop_date_time":"2015-06-29T23:37:32Z","auth_id":"DE8ACC12E46L89","auth_method":"WHITELIST","location":{"id":"LOC1","type":"ON_STREET","name":"Gent Zuid","address":"F.Rooseveltlaan 3A","city":"Gent","postal_code":"9000","country":"BEL","coordinates":{"latitude":"51.047599","longitude":"3.729944"},"evses":[{"uid":"3256","evse_id":"BE-BEC-E041503003","status":"AVAILABLE","connectors":[{"id":"1","standard":"IEC_62196_T2","format":"SOCKET","power_type":"AC_1_PHASE","voltage":230,"amperage":64,"last_updated":"2015-06-29T21:39:01Z"}],"last_updated":"2015-06-29T21:39:01Z"}],"last_updated":"2015-06-29T21:39:01Z"},"currency":"EUR","tariffs":[{"id":"12","currency":"EUR","elements":[{"price_components":[{"type":"TIME","price":2,"step_size":300}]}],"last_updated":"2015-02-02T14:15:01Z"}],"charging_periods":[{"start_date_time":"2015-06-29T21:39:09Z","dimensions":[{"type":"TIME","volume":1.973}]}],"total_cost":4,"total_energy":15.342,"total_time":1.973,"last_updated":"2015-06-29T22:01:13Z"}'