---
title: "Events and subscriptions | Docs | Inventory by R&D Copilot"
description: "Register an endpoint for events, read the events and their delivery state, and replay a parked event."
canonical: "https://inventory.rdcopilot.com/docs/api-reference/events/"
language: en
updated: 2026-11-22
---

# Events and subscriptions

Register an endpoint for events, read the events and their delivery state, and replay a parked event.

## List events

GET `/inventory/v1/events`

Returns the events of your subscriptions in pages, the newest first, with the state of their delivery.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `state` | query | `string` | Nooptional | Only events in this delivery state. One of `delivered`, `retrying`, `parked`, `replayed` |
| `limit` | query | `integer` | Nooptional | Events per page, from 1 to 500. Default `100` Range `1` – `500` |
| `cursor` | query | `string` | Nooptional | The `nextCursor` of the previous page. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | A page of events. | `EventPage` |
| `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` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/inventory/v1/events?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/events?limit=20`, {
  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"]}/inventory/v1/events?limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/events?limit=20');
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")}/inventory/v1/events?limit=20");
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": [
    {
      "id": "517ef9ce-9831-449c-bd68-d37290ecd357",
      "type": "com.rdcopilot.inventory.movement.v1",
      "time": "2026-11-23T07:12:00.000Z",
      "aggregateId": "c2c684e0-3700-5969-a967-1f8b830a2012",
      "state": "parked",
      "attempts": 6
    }
  ],
  "nextCursor": null
}
```

## Replay an event

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

Sends a parked event again, with the same `id`, to the subscriptions it belongs to. A replay starts a new series of delivery attempts.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `eventId` | path | `string (uuid)` | Yesrequired | The event. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The event was queued to be sent again. The body is the operation result. | `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 request was refused. The `code` is `event_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `operation_reused`. | `Error` |
| `429` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/inventory/v1/events/517ef9ce-9831-449c-bd68-d37290ecd357/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "9bd10b48-ecb8-453e-a57d-4b038853268e"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/events/517ef9ce-9831-449c-bd68-d37290ecd357/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "9bd10b48-ecb8-453e-a57d-4b038853268e"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/events/517ef9ce-9831-449c-bd68-d37290ecd357/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '9bd10b48-ecb8-453e-a57d-4b038853268e',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "9bd10b48-ecb8-453e-a57d-4b038853268e"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/events/517ef9ce-9831-449c-bd68-d37290ecd357/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")}/inventory/v1/events/517ef9ce-9831-449c-bd68-d37290ecd357/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "9bd10b48-ecb8-453e-a57d-4b038853268e"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "9bd10b48-ecb8-453e-a57d-4b038853268e",
  "status": "accepted",
  "aggregateRevision": 1
}
```

## Create a subscription

POST `/inventory/v1/subscriptions`

Registers an HTTPS endpoint of yours for the event types you name. Every delivery is signed with the secret of the subscription, which the answer returns once.

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `endpoint` | `string` | Yesrequired | The HTTPS address that receives the events. |
| `eventTypes` | `string[]` | Yesrequired | The event types to send, for example `com.rdcopilot.inventory.movement.v1`. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The subscription was created. `secret` is the signing secret: it is returned only here, once. Sending the same request again, and reading the operation, omit it. | `SubscriptionOperationResult` |
| `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` | The request was refused. The `code` is `operation_reused`. | `Error` |
| `429` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/inventory/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "62e2e752-8094-4c2b-a497-8fa4ffe50f68",
  "endpoint": "https://hooks.brumar.example/inventory",
  "eventTypes": [
    "com.rdcopilot.inventory.movement.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "62e2e752-8094-4c2b-a497-8fa4ffe50f68",
    "endpoint": "https://hooks.brumar.example/inventory",
    "eventTypes": [
      "com.rdcopilot.inventory.movement.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '62e2e752-8094-4c2b-a497-8fa4ffe50f68',
        'endpoint': 'https://hooks.brumar.example/inventory',
        'eventTypes': [
            'com.rdcopilot.inventory.movement.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "62e2e752-8094-4c2b-a497-8fa4ffe50f68",
  "endpoint": "https://hooks.brumar.example/inventory",
  "eventTypes": [
    "com.rdcopilot.inventory.movement.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/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")}/inventory/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "62e2e752-8094-4c2b-a497-8fa4ffe50f68",
  "endpoint": "https://hooks.brumar.example/inventory",
  "eventTypes": [
    "com.rdcopilot.inventory.movement.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "62e2e752-8094-4c2b-a497-8fa4ffe50f68",
  "status": "completed",
  "aggregateRevision": 1,
  "subscriptionId": "38bc76c7-5d0e-4943-9ac2-04066d08dadf",
  "secret": "whsec_VGhlIHNpZ25pbmcgc2VjcmV0IG9mIHRoZSBJbnZlbnRvcnkgZG9jcy4="
}
```

## Rotate the secret of a subscription

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

Returns a new signing secret, once. For 24 hours every delivery carries a signature made with each secret, then only the one made with the new secret.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `subscriptionId` | path | `string (uuid)` | Yesrequired | The subscription. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The secret was replaced. `secret` is the new signing secret: it is returned only here, once. | `SubscriptionOperationResult` |
| `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 request was refused. The `code` is `subscription_not_found`. | `Error` |
| `409` | The request was refused. The `code` is `operation_reused`. | `Error` |
| `429` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/inventory/v1/subscriptions/38bc76c7-5d0e-4943-9ac2-04066d08dadf/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "883cfbf3-5da2-404d-b02c-2bc93f041982"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/subscriptions/38bc76c7-5d0e-4943-9ac2-04066d08dadf/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "883cfbf3-5da2-404d-b02c-2bc93f041982"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/subscriptions/38bc76c7-5d0e-4943-9ac2-04066d08dadf/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '883cfbf3-5da2-404d-b02c-2bc93f041982',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "883cfbf3-5da2-404d-b02c-2bc93f041982"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/subscriptions/38bc76c7-5d0e-4943-9ac2-04066d08dadf/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")}/inventory/v1/subscriptions/38bc76c7-5d0e-4943-9ac2-04066d08dadf/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "883cfbf3-5da2-404d-b02c-2bc93f041982"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "883cfbf3-5da2-404d-b02c-2bc93f041982",
  "status": "completed",
  "aggregateRevision": 2,
  "subscriptionId": "38bc76c7-5d0e-4943-9ac2-04066d08dadf",
  "secret": "whsec_VGhlIG5leHQgc2lnbmluZyBzZWNyZXQgb2YgdGhlIEludmVudG9yeS4="
}
```
