- Reference
- OCPI 2.2.1 (CPO)
- Receiver Token
OpenAPI reference
Receiver Token
/tokens/{country_code}/{party_id}/{token_uid}Push a new or updated Token object from the eMSP to the CPO. PUT is full-replace per OCPI 2.2.1 §14.4.2 — omitted fields reset to their schema defaults. Path `token_uid` and query `type` (defaulting t
API: OCPI 2.2.1 (CPO) · Module: Tokens (CPO)
Base path:/tokens· Base URL:https://ocpi-api.gridos.co/ocpi/cpo/2.2.1
Overview
PUT /tokens/{country_code}/{party_id}/{token_uid}Absolute URL: https://ocpi-api.gridos.co/ocpi/cpo/2.2.1/tokens/{country_code}/{party_id}/{token_uid}
Push a new or updated Token object from the eMSP to the CPO. PUT is full-replace per OCPI 2.2.1 §14.4.2 — omitted fields reset to their schema defaults. Path token_uid and query type (defaulting to the body type, then RFID) identify the Token.
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/cpo/2.2.1/tokens/NL/ABC/TOKEN123' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"country_code":"NL","party_id":"TNM","uid":"100012","type":"RFID","contract_id":"NL-TNM-000100012","visual_number":"DF000-2001-8999","issuer":"TheNewMotion","group_id":"NL-TNM-GRP001","valid":true,"whitelist":"ALWAYS","language":"nl","default_profile_type":"GREEN","last_updated":"2015-06-21T22:39:05Z"}'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). |
token_uid | string | Yes | Token.uid of the Token. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
type | TokenType | No | Token.type, defaults to RFID if not provided. |
Request body
application/json · Required
Schema: TokenCreate
| Field | Type | Required | Description |
|---|---|---|---|
country_code | string | Yes | — |
party_id | string | Yes | — |
uid | string | Yes | Unique ID by which this Token can be identified. |
type | `"AD_HOC_USER" | "APP_USER" | "RFID" |
contract_id | string | Yes | Uniquely identifies the driver contract. |
visual_number | string | No | — |
issuer | string | Yes | Issuing company, usually the connected eMSP. |
group_id | string | No | — |
valid | boolean | Yes | — |
whitelist | `"ALWAYS" | "ALLOWED" | "ALLOWED_OFFLINE" |
language | string | No | — |
default_profile_type | `"CHEAP" | "FAST" | "GREEN" |
energy_contract | object | No | — |
last_updated | string (date-time) | Yes | — |
Request examples
Example 1
{
"country_code": "NL",
"party_id": "TNM",
"uid": "100012",
"type": "RFID",
"contract_id": "NL-TNM-000100012",
"visual_number": "DF000-2001-8999",
"issuer": "TheNewMotion",
"group_id": "NL-TNM-GRP001",
"valid": true,
"whitelist": "ALWAYS",
"language": "nl",
"default_profile_type": "GREEN",
"last_updated": "2015-06-21T22:39:05Z"
}Example 2
{
"country_code": "DE",
"party_id": "EMP",
"uid": "APP-22",
"type": "APP_USER",
"contract_id": "DE-EMP-C-7788",
"issuer": "Example Mobility",
"valid": true,
"whitelist": "ALLOWED",
"last_updated": "2015-06-23T08:00:00Z"
}Responses
| Status | Description | Schema |
|---|---|---|
200 | Successful Response | TokenResponse |
400 | Invalid or missing parameters (HTTP 200, OCPI envelope) | — |
401 | Unauthorized | — |
422 | Validation Error | HTTPValidationError |
200 — successful response
application/json
Schema: TokenResponse
| Field | Type | Required | Description |
|---|---|---|---|
status_code | integer | No | Default: 1000 |
status_message | string | No | — |
timestamp | string (date-time) | No | — |
data | TokenOut | No | TokenOut |
Response example
{
"status_code": 1000,
"status_message": "Success",
"timestamp": "2024-01-15T10:00:00Z",
"data": {
"contract_id": "NL-TNM-012345678905880-S",
"country_code": "NL",
"default_profile_type": "GREEN",
"energy_contract": {
"contract_id": "ENERGY-CONTRACT-001",
"supplier_name": "Greenchoice"
},
"group_id": "GROUP-001",
"issuer": "MobilityPlus",
"language": "nl",
"last_updated": "2024-01-15T10:00:00Z",
"party_id": "TNM",
"type": "RFID",
"uid": "012345678905880",
"valid": true,
"visual_number": "DF000-2001-8999-1",
"whitelist": "ALLOWED"
}
}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/cpo/2.2.1/tokens/NL/ABC/TOKEN123' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"country_code":"NL","party_id":"TNM","uid":"100012","type":"RFID","contract_id":"NL-TNM-000100012","visual_number":"DF000-2001-8999","issuer":"TheNewMotion","group_id":"NL-TNM-GRP001","valid":true,"whitelist":"ALWAYS","language":"nl","default_profile_type":"GREEN","last_updated":"2015-06-21T22:39:05Z"}'