---
title: "Event operations | Docs | AI Assistant by R&D Copilot"
description: "Register a receiver and manage webhook delivery and replay."
canonical: "https://ai.rdcopilot.com/docs/api-reference/events/"
language: en
updated: 2026-11-22
---

# Event operations

Register a receiver and manage webhook delivery and replay.

## Read webhook deliveries

GET `/ai/v1/events`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | Nooptional | Default `100` Range `1` – `500` |
| `cursor` | query | `string` | Nooptional |  |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | Current result. | `DeliveryPage` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/ai/v1/events" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/ai/v1/events`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/ai/v1/events',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/events');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/ai/v1/events");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `200`

JSON

```json
{
  "items": [
    {
      "specversion": "1.0",
      "id": "5ec69550-f3fa-43b1-af49-18e3137c4f49",
      "type": "com.rdcopilot.ai.run.done.v1",
      "source": "/ai/v1/tasks/runs",
      "time": "2026-11-19T11:00:00Z",
      "customerOrgId": "brumar",
      "legalCompanyId": "brumar-distributie",
      "aggregateType": "run",
      "aggregateId": "run-1042",
      "aggregateRevision": 3,
      "correlationId": "86c4fe37-99d4-4bfc-a8f1-347afc902a56",
      "causationId": "423a61ed-2ea7-40fd-a31e-da3baa387eac",
      "actor": {
        "id": "ana-rusu",
        "type": "user"
      },
      "data": {
        "status": "done",
        "receiptId": "offer-1042"
      },
      "state": "parked"
    }
  ],
  "nextCursor": null
}
```

## Register an HTTPS endpoint

POST `/ai/v1/subscriptions`

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | UUID selected by the client. |
| `expectedRevision` | `integer` | Yesrequired | Revision of the record. |
| `url` | `string` | Yesrequired | HTTPS endpoint that receives events. |
| `types` | `string[]` | Yesrequired | Events to deliver. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The signing secret is returned once. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `409` | `expectedRevision` is older than the record. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/ai/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "470fe510-52f0-4415-97cb-2353d4748297",
  "expectedRevision": 0,
  "url": "https://receiver.example/hooks/ai",
  "types": [
    "com.rdcopilot.ai.run.waiting_for_approval.v1",
    "com.rdcopilot.ai.run.done.v1",
    "com.rdcopilot.ai.run.failed.v1",
    "com.rdcopilot.ai.run.rejected.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/ai/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "470fe510-52f0-4415-97cb-2353d4748297",
    "expectedRevision": 0,
    "url": "https://receiver.example/hooks/ai",
    "types": [
      "com.rdcopilot.ai.run.waiting_for_approval.v1",
      "com.rdcopilot.ai.run.done.v1",
      "com.rdcopilot.ai.run.failed.v1",
      "com.rdcopilot.ai.run.rejected.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/ai/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '470fe510-52f0-4415-97cb-2353d4748297',
        'expectedRevision': 0,
        'url': 'https://receiver.example/hooks/ai',
        'types': [
            'com.rdcopilot.ai.run.waiting_for_approval.v1',
            'com.rdcopilot.ai.run.done.v1',
            'com.rdcopilot.ai.run.failed.v1',
            'com.rdcopilot.ai.run.rejected.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "470fe510-52f0-4415-97cb-2353d4748297",
  "expectedRevision": 0,
  "url": "https://receiver.example/hooks/ai",
  "types": [
    "com.rdcopilot.ai.run.waiting_for_approval.v1",
    "com.rdcopilot.ai.run.done.v1",
    "com.rdcopilot.ai.run.failed.v1",
    "com.rdcopilot.ai.run.rejected.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/subscriptions');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/ai/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "470fe510-52f0-4415-97cb-2353d4748297",
  "expectedRevision": 0,
  "url": "https://receiver.example/hooks/ai",
  "types": [
    "com.rdcopilot.ai.run.waiting_for_approval.v1",
    "com.rdcopilot.ai.run.done.v1",
    "com.rdcopilot.ai.run.failed.v1",
    "com.rdcopilot.ai.run.rejected.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "470fe510-52f0-4415-97cb-2353d4748297",
  "status": "accepted",
  "aggregateRevision": 1,
  "subscriptionId": "sub-1042",
  "secret": "whsec_ZXhhbXBsZS1zaWduaW5nLXNlY3JldC1mb3ItZG9jcw=="
}
```

## Rotate a signing secret

POST `/ai/v1/subscriptions/{subscriptionId}/secret`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `subscriptionId` | path | `string` | Yesrequired | Subscription identifier. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | UUID selected by the client. |
| `expectedRevision` | `integer` | Yesrequired | Revision of the record. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The replacement secret is returned once. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The record does not exist for this company. | `Error` |
| `409` | `expectedRevision` is older than the record. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/ai/v1/subscriptions/sub-1042/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "09c56d15-5d27-4fd1-98aa-b49cc6837a75",
  "expectedRevision": 1
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/ai/v1/subscriptions/sub-1042/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "09c56d15-5d27-4fd1-98aa-b49cc6837a75",
    "expectedRevision": 1
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/ai/v1/subscriptions/sub-1042/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '09c56d15-5d27-4fd1-98aa-b49cc6837a75',
        'expectedRevision': 1,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "09c56d15-5d27-4fd1-98aa-b49cc6837a75",
  "expectedRevision": 1
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/subscriptions/sub-1042/secret');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/ai/v1/subscriptions/sub-1042/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "09c56d15-5d27-4fd1-98aa-b49cc6837a75",
  "expectedRevision": 1
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "09c56d15-5d27-4fd1-98aa-b49cc6837a75",
  "status": "accepted",
  "aggregateRevision": 2,
  "subscriptionId": "sub-1042",
  "secret": "whsec_bmV3LXNpZ25pbmctc2VjcmV0LWZvci10aGlzLXN1YnM="
}
```

## Replay a parked delivery

POST `/ai/v1/events/{eventId}/replay`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `eventId` | path | `string` | Yesrequired | ID of the parked event. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | UUID selected by the client. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | Read the operation to follow the outcome. | `OperationResult` |
| `400` | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. `fields` names each one. | `Error` |
| `401` | The token is missing, expired or not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The record does not exist for this company. | `Error` |
| `409` | This `operationId` was sent before with another body. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/ai/v1/events/5ec69550-f3fa-43b1-af49-18e3137c4f49/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "9d5f537d-f6af-463f-bc66-16aa81463fb5"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/ai/v1/events/5ec69550-f3fa-43b1-af49-18e3137c4f49/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "9d5f537d-f6af-463f-bc66-16aa81463fb5"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/ai/v1/events/5ec69550-f3fa-43b1-af49-18e3137c4f49/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '9d5f537d-f6af-463f-bc66-16aa81463fb5',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "9d5f537d-f6af-463f-bc66-16aa81463fb5"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/ai/v1/events/5ec69550-f3fa-43b1-af49-18e3137c4f49/replay');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/ai/v1/events/5ec69550-f3fa-43b1-af49-18e3137c4f49/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "9d5f537d-f6af-463f-bc66-16aa81463fb5"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "9d5f537d-f6af-463f-bc66-16aa81463fb5",
  "status": "accepted",
  "aggregateRevision": 0
}
```
