> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ocpplab.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ocpplab.io/_mcp/server.

# Publish a webhook event

POST https://api.ocpplab.io/webhook-gateway/events
Content-Type: application/json

Admin tokens only: deliveries carry the platform signature. Queues one signed delivery per ACTIVE subscription of the event type. ``data`` must match the event type's payload schema. Posting the same ``event_id`` again queues nothing new.

Reference: https://docs.ocpplab.io/api-reference/webhooks/events/deliver

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a DeliverEventRequest.

- `event` (enum, required)
  - Allowed values: `token.provisioned`, `token.activated`, `token.suspended`, `token.reactivated`, `token.revoked`, `token.updated`, `energy.connector_status`, `energy.asset_updated`, `energy.control_response`, `energy.power_measurement`
- `data` (DeliverEventRequestData, required)
- `occurred_at` (datetime, optional, nullable)
- `event_id` (string, optional, nullable)

## Response

### 200

How many deliveries were queued.

- `queued` (integer, required)

## Errors

### 400 Bad Request Error

data does not match the event type's payload schema

- `detail` (string, required) — Human-readable error message returned by the API.

### 401 Unauthorized Error

Missing or invalid Bearer token

- `detail` (string, required) — Human-readable error message returned by the API.

### 403 Forbidden Error

Not an admin token

- `detail` (string, required) — Human-readable error message returned by the API.

### 422 Unprocessable Entity Error

The request does not match the schema

- `detail` (list of ValidationError, optional) — One entry per invalid field.

### 429 Too Many Requests Error

Gateway rate limit reached; retry after the given seconds

- `detail` (string, required) — Human-readable error message returned by the API.

### 502 Bad Gateway Error

Gateway unreachable, failing, or misconfigured

- `detail` (string, required) — Human-readable error message returned by the API.

### 504 Gateway Timeout Error

Gateway timed out

- `detail` (string, required) — Human-readable error message returned by the API.

## Types

### DeliverEventRequestData

### ValidationError

Why one field is invalid.

- `loc` (list of ValidationErrorLocItems, required) — Where the field is: ``body`` / ``query`` / ``path`` / ``header``, then its name.
- `msg` (string, required) — What is wrong, in English.
- `type` (string, required) — Machine-readable error code, e.g. ``missing``.
- `input` (any, optional) — The value that was sent.
- `ctx` (ValidationErrorCtx, optional) — Details of the rule that failed, e.g. `{"le": 200}`.

### TokenEventData

Envelope ``data`` for every ``token.*`` event.

- `id` (integer, required)
- `tenant_id` (string, required)
- `uid` (string, required)
- `type` (enum, required)
  - Allowed values: `AD_HOC_USER`, `APP_USER`, `OTHER`, `RFID`
- `contract_id` (string, required)
- `issuer` (string, required)
- `country_code` (string, required)
- `party_id` (string, required)
- `whitelist` (enum, required)
  - Allowed values: `ALWAYS`, `ALLOWED`, `ALLOWED_OFFLINE`, `NEVER`
- `ocpi_version` (string, required)
- `status` (enum, required)
  - Allowed values: `PROVISIONED`, `ACTIVE`, `SUSPENDED`, `EXPIRED`, `REVOKED`
- `created_at` (datetime, required)
- `last_updated` (datetime, required)
- `visual_number` (string, optional, nullable)
- `group_id` (string, optional, nullable)
- `language` (string, optional, nullable)
- `valid_from` (datetime, optional, nullable)
- `valid_until` (datetime, optional, nullable)
- `metadata` (map from string to any, optional, nullable)
- `status_reason` (string, optional, nullable)
- `invalidated_at` (datetime, optional, nullable)

### ConnectorStatusEvent

- `asset_id` (string, required)
- `connector_id` (integer, required)
- `status` (string, required)
- `timestamp` (datetime, required)
- `asset_type` (string, optional, nullable, default: CHARGEBOX)
- `error_code` (string, optional, nullable)

### AssetUpdatedEvent

- `asset_id` (string, required)
- `connectors` (list of AssetConnector, required)
- `asset_type` (string, optional, nullable, default: CHARGEBOX)
- `version` (integer, optional, nullable, default: 1)
- `deleted` (boolean, optional, nullable, default: false)
- `max_power_kw` (double, optional, nullable)

### ControlResponseEvent

- `request_id` (string, required)
- `charge_point_id` (string, required)
- `connector_id` (integer, required)
- `action` (enum, required)
  - Allowed values: `SET_EVSE_INPUT_LIMIT`, `CLEAR_EVSE_INPUT_LIMIT`
- `result` (enum, required)
  - Allowed values: `PENDING`, `ACCEPTED`, `REJECTED_BY_CHARGING_STATION`, `CHARGING_STATION_OFFLINE`, `CHARGING_STATION_NOT_RESPONSIVE`, `INTERNAL_ERROR`
- `created_at` (datetime, required)
- `limit` (double, optional, nullable)
- `unit` (enum, optional, nullable)
  - Allowed values: `W`, `A`
- `valid_to` (datetime, optional, nullable)
- `detail` (string, optional, nullable)
- `tracking_id` (string, optional, nullable)
- `completed_at` (datetime, optional, nullable)

### PowerMeasurementEvent

- `asset_id` (string, required)
- `active_power` (double, required)
- `timestamp` (datetime, required)
- `asset_type` (string, optional, nullable, default: CHARGEBOX)
- `connector_id` (integer, optional, nullable)
- `evse_id` (integer, optional, nullable)
- `transaction_id` (string, optional, nullable)

### ValidationErrorLocItems

### ValidationErrorCtx

Details of the rule that failed, e.g. `{"le": 200}`.

### AssetConnector

- `connector_id` (integer, required)
- `chargebox_id` (string, required)
- `current_type` (string, optional, nullable)
- `max_power_w` (integer, optional, nullable)

## Examples

**Request**

```json
{
  "event": "energy.connector_status",
  "data": {
    "asset_id": "CP-AMS-001",
    "asset_type": "CHARGEBOX",
    "connector_id": 1,
    "status": "Charging",
    "timestamp": "2026-10-03T10:00:00Z"
  },
  "occurred_at": "2026-10-03T10:00:00Z",
  "event_id": "evt_2026-10-03_cp-ams-001_1"
}
```

**Response**

```json
{
  "queued": 2
}
```

**SDK Code**

```python
import requests

url = "https://api.ocpplab.io/webhook-gateway/events"

payload = {
    "event": "energy.connector_status",
    "data": {
        "asset_id": "CP-AMS-001",
        "asset_type": "CHARGEBOX",
        "connector_id": 1,
        "status": "Charging",
        "timestamp": "2026-10-03T10:00:00Z"
    },
    "occurred_at": "2026-10-03T10:00:00Z",
    "event_id": "evt_2026-10-03_cp-ams-001_1"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.ocpplab.io/webhook-gateway/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"event":"energy.connector_status","data":{"asset_id":"CP-AMS-001","asset_type":"CHARGEBOX","connector_id":1,"status":"Charging","timestamp":"2026-10-03T10:00:00Z"},"occurred_at":"2026-10-03T10:00:00Z","event_id":"evt_2026-10-03_cp-ams-001_1"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ocpplab.io/webhook-gateway/events"

	payload := strings.NewReader("{\n  \"event\": \"energy.connector_status\",\n  \"data\": {\n    \"asset_id\": \"CP-AMS-001\",\n    \"asset_type\": \"CHARGEBOX\",\n    \"connector_id\": 1,\n    \"status\": \"Charging\",\n    \"timestamp\": \"2026-10-03T10:00:00Z\"\n  },\n  \"occurred_at\": \"2026-10-03T10:00:00Z\",\n  \"event_id\": \"evt_2026-10-03_cp-ams-001_1\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.ocpplab.io/webhook-gateway/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"event\": \"energy.connector_status\",\n  \"data\": {\n    \"asset_id\": \"CP-AMS-001\",\n    \"asset_type\": \"CHARGEBOX\",\n    \"connector_id\": 1,\n    \"status\": \"Charging\",\n    \"timestamp\": \"2026-10-03T10:00:00Z\"\n  },\n  \"occurred_at\": \"2026-10-03T10:00:00Z\",\n  \"event_id\": \"evt_2026-10-03_cp-ams-001_1\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ocpplab.io/webhook-gateway/events")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"event\": \"energy.connector_status\",\n  \"data\": {\n    \"asset_id\": \"CP-AMS-001\",\n    \"asset_type\": \"CHARGEBOX\",\n    \"connector_id\": 1,\n    \"status\": \"Charging\",\n    \"timestamp\": \"2026-10-03T10:00:00Z\"\n  },\n  \"occurred_at\": \"2026-10-03T10:00:00Z\",\n  \"event_id\": \"evt_2026-10-03_cp-ams-001_1\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ocpplab.io/webhook-gateway/events', [
  'body' => '{
  "event": "energy.connector_status",
  "data": {
    "asset_id": "CP-AMS-001",
    "asset_type": "CHARGEBOX",
    "connector_id": 1,
    "status": "Charging",
    "timestamp": "2026-10-03T10:00:00Z"
  },
  "occurred_at": "2026-10-03T10:00:00Z",
  "event_id": "evt_2026-10-03_cp-ams-001_1"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.ocpplab.io/webhook-gateway/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"event\": \"energy.connector_status\",\n  \"data\": {\n    \"asset_id\": \"CP-AMS-001\",\n    \"asset_type\": \"CHARGEBOX\",\n    \"connector_id\": 1,\n    \"status\": \"Charging\",\n    \"timestamp\": \"2026-10-03T10:00:00Z\"\n  },\n  \"occurred_at\": \"2026-10-03T10:00:00Z\",\n  \"event_id\": \"evt_2026-10-03_cp-ams-001_1\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "event": "energy.connector_status",
  "data": [
    "asset_id": "CP-AMS-001",
    "asset_type": "CHARGEBOX",
    "connector_id": 1,
    "status": "Charging",
    "timestamp": "2026-10-03T10:00:00Z"
  ],
  "occurred_at": "2026-10-03T10:00:00Z",
  "event_id": "evt_2026-10-03_cp-ams-001_1"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ocpplab.io/webhook-gateway/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```