- Reference
- OCPI 2.1.1 (eMSP)
- Real-time authorization (eMSP Sender)
OpenAPI reference
Real-time authorization (eMSP Sender)
/tokens/{token_uid}/authorizeReal-time authorization request from a CPO. Per OCPI 2.1.1 §2.2.2 the CPO calls the eMSP's `/tokens/{token_uid}/authorize` to validate a token presented at a Charge Point.
API: OCPI 2.1.1 (eMSP) · Module: Tokens (eMSP)
Base path:/tokens· Base URL:https://ocpi-api.gridos.co/ocpi/emsp/2.1.1
Overview
POST /tokens/{token_uid}/authorizeAbsolute URL: https://ocpi-api.gridos.co/ocpi/emsp/2.1.1/tokens/{token_uid}/authorize
Real-time authorization request from a CPO. Per OCPI 2.1.1 §2.2.2 the CPO calls the eMSP's /tokens/{token_uid}/authorize to validate a token presented at a Charge Point.
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/tokens/TOKEN123/authorize' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"connector_ids":["1"],"evse_uids":["EVSE-CPO-211-001"],"location_id":"CPO-LOC-211-001"}'Request
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
token_uid | string | Yes | Token.uid of the Token. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
type | TokenType | No | Token.type of the Token, defaults to RFID if not provided. |
Request body
application/json · Optional
Schema: LocationReferences
| Field | Type | Required | Description |
|---|---|---|---|
location_id | string | Yes | Unique identifier for the Location. |
evse_uids | string[] | No | Unique identifiers for the EVSEs within the given Location. |
connector_ids | string[] | No | Unique identifiers for the Connectors within the given Location. |
Request example
{
"connector_ids": [
"1"
],
"evse_uids": [
"EVSE-CPO-211-001"
],
"location_id": "CPO-LOC-211-001"
}Responses
| Status | Description | Schema |
|---|---|---|
200 | Successful Response | AuthorizationInfoResponse |
400 | Invalid or missing parameters (HTTP 200, OCPI envelope) | — |
401 | Unauthorized | — |
422 | Validation Error | HTTPValidationError |
200 — successful response
application/json
Schema: AuthorizationInfoResponse
| Field | Type | Required | Description |
|---|---|---|---|
status_code | integer | No | Default: 1000 |
status_message | string | No | — |
timestamp | string (date-time) | No | — |
data | AuthorizationInfo | No | AuthorizationInfo |
Response example
{
"status_code": 1000,
"status_message": "Success",
"timestamp": "2015-06-29T22:39:09Z",
"data": {
"allowed": "ALLOWED",
"location": {
"evse_uids": [
"EVSE-CPO-211-001"
],
"location_id": "CPO-LOC-211-001"
}
}
}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/tokens/TOKEN123/authorize' \
-H "Authorization: Token $OCPI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"connector_ids":["1"],"evse_uids":["EVSE-CPO-211-001"],"location_id":"CPO-LOC-211-001"}'