---
title: "Event subscriptions | Docs | ERP by R&D Copilot"
description: "Register the HTTPS endpoint that receives events, and read and replay their deliveries."
canonical: "https://erp.rdcopilot.com/docs/api-reference/subscriptions/"
language: en
updated: 2026-11-22
---

# Event subscriptions

Register the HTTPS endpoint that receives events, and read and replay their deliveries.

## List subscriptions

GET `/erp/v1/subscriptions`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | Nooptional | Records 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 subscriptions. | `SubscriptionPage` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

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

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/subscriptions?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")}/erp/v1/subscriptions?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": "01e18cf6-7bba-441f-8b0f-63165e58edca",
      "url": "https://hooks.brumar.example/erp",
      "eventTypes": [
        "com.rdcopilot.erp.sales-order.confirmed.v1",
        "com.rdcopilot.erp.sales-order.reserved.v1",
        "com.rdcopilot.erp.delivery.created.v1",
        "com.rdcopilot.erp.invoice.created.v1"
      ],
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Create a subscription

POST `/erp/v1/subscriptions`

Registers the HTTPS endpoint that receives the events you choose. Every delivery is signed with the secret of the subscription; the answer carries the secret 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. |
| `url` | `string` | Yesrequired | An HTTPS endpoint of yours. |
| `eventTypes` | `string[]` | Yesrequired | The event types you want. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result and `secret`, the signing secret of the subscription. It is returned in this answer only. | `SecretOperationResult` |
| `400` | The request cannot be read or breaks the contract: the JSON is malformed, a field is missing or unknown, or a type is wrong. `fields` names each one and says what is wrong with it. | `Error` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `409` | The `operationId` was used before with a different request. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "7e5b45e5-aab6-4a9e-88d6-085129a805d7",
  "url": "https://hooks.brumar.example/erp",
  "eventTypes": [
    "com.rdcopilot.erp.sales-order.confirmed.v1",
    "com.rdcopilot.erp.sales-order.reserved.v1",
    "com.rdcopilot.erp.delivery.created.v1",
    "com.rdcopilot.erp.invoice.created.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "7e5b45e5-aab6-4a9e-88d6-085129a805d7",
    "url": "https://hooks.brumar.example/erp",
    "eventTypes": [
      "com.rdcopilot.erp.sales-order.confirmed.v1",
      "com.rdcopilot.erp.sales-order.reserved.v1",
      "com.rdcopilot.erp.delivery.created.v1",
      "com.rdcopilot.erp.invoice.created.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '7e5b45e5-aab6-4a9e-88d6-085129a805d7',
        'url': 'https://hooks.brumar.example/erp',
        'eventTypes': [
            'com.rdcopilot.erp.sales-order.confirmed.v1',
            'com.rdcopilot.erp.sales-order.reserved.v1',
            'com.rdcopilot.erp.delivery.created.v1',
            'com.rdcopilot.erp.invoice.created.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "7e5b45e5-aab6-4a9e-88d6-085129a805d7",
  "url": "https://hooks.brumar.example/erp",
  "eventTypes": [
    "com.rdcopilot.erp.sales-order.confirmed.v1",
    "com.rdcopilot.erp.sales-order.reserved.v1",
    "com.rdcopilot.erp.delivery.created.v1",
    "com.rdcopilot.erp.invoice.created.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/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")}/erp/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "7e5b45e5-aab6-4a9e-88d6-085129a805d7",
  "url": "https://hooks.brumar.example/erp",
  "eventTypes": [
    "com.rdcopilot.erp.sales-order.confirmed.v1",
    "com.rdcopilot.erp.sales-order.reserved.v1",
    "com.rdcopilot.erp.delivery.created.v1",
    "com.rdcopilot.erp.invoice.created.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "7e5b45e5-aab6-4a9e-88d6-085129a805d7",
  "status": "accepted",
  "aggregateId": "01e18cf6-7bba-441f-8b0f-63165e58edca",
  "aggregateRevision": 1,
  "secret": "whsec_XzqUQsvy8YdbmCI7sU1wJ518NC+J/8aC"
}
```

## Rotate the secret of a subscription

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

Issues a new signing secret and returns it once. For 24 hours every delivery carries two signatures, one for each secret; after that only the new one.

### 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 change was accepted. The body is the operation result and `secret`, the signing secret of the subscription. It is returned in this answer only. | `SecretOperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The subscription does not exist. | `Error` |
| `409` | The `operationId` was used before with a different request. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/subscriptions/01e18cf6-7bba-441f-8b0f-63165e58edca/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "7971b262-f758-4062-b06a-9018caf5ade1"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/subscriptions/01e18cf6-7bba-441f-8b0f-63165e58edca/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "7971b262-f758-4062-b06a-9018caf5ade1"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/subscriptions/01e18cf6-7bba-441f-8b0f-63165e58edca/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '7971b262-f758-4062-b06a-9018caf5ade1',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "7971b262-f758-4062-b06a-9018caf5ade1"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/subscriptions/01e18cf6-7bba-441f-8b0f-63165e58edca/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")}/erp/v1/subscriptions/01e18cf6-7bba-441f-8b0f-63165e58edca/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "7971b262-f758-4062-b06a-9018caf5ade1"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "7971b262-f758-4062-b06a-9018caf5ade1",
  "status": "accepted",
  "aggregateId": "01e18cf6-7bba-441f-8b0f-63165e58edca",
  "aggregateRevision": 2,
  "secret": "whsec_k3Tn0Gm2VdWm9bQp1xYhF7sJ4LrZcA6e"
}
```

## List event deliveries

GET `/erp/v1/event-deliveries`

Returns the deliveries of events with their attempts, newest first. `state` keeps only the deliveries in one state, for example the parked ones.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `state` | query | `string` | Nooptional | Only deliveries in this state. One of `delivered`, `retrying`, `parked`, `replayed` |
| `limit` | query | `integer` | Nooptional | Records 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 event deliveries. | `EventDeliveryPage` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/erp/v1/event-deliveries?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/event-deliveries?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")}/erp/v1/event-deliveries?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": "9e333bea-26ed-46c2-835d-551e5f3db259",
      "eventId": "cd8f2491-89d6-49fe-bd86-58921a9a65ff",
      "type": "com.rdcopilot.erp.sales-order.reserved.v1",
      "state": "retrying",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-23T07:01:00Z"
        },
        {
          "n": 2,
          "http": 503,
          "at": "2026-11-23T07:02:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 2
    },
    {
      "id": "df8cc18b-4a2b-4363-8bc2-af08e1083330",
      "eventId": "955eaa18-ce8d-4b00-af9e-dd49a294df7b",
      "type": "com.rdcopilot.erp.invoice.created.v1",
      "state": "parked",
      "attempts": [
        {
          "n": 1,
          "http": 500,
          "at": "2026-11-23T07:01:00Z"
        },
        {
          "n": 2,
          "http": 500,
          "at": "2026-11-23T07:02:00Z"
        },
        {
          "n": 3,
          "http": 500,
          "at": "2026-11-23T07:07:00Z"
        },
        {
          "n": 4,
          "http": 500,
          "at": "2026-11-23T07:37:00Z"
        },
        {
          "n": 5,
          "http": 500,
          "at": "2026-11-23T09:37:00Z"
        },
        {
          "n": 6,
          "http": 500,
          "at": "2026-11-23T21:37:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 6
    },
    {
      "id": "6a9a081b-0932-4fee-82bc-231f4b70b191",
      "eventId": "b1370dd6-14e1-4aee-bdbd-4b0da92165e9",
      "type": "com.rdcopilot.erp.sales-order.confirmed.v1",
      "state": "delivered",
      "attempts": [
        {
          "n": 1,
          "http": 200,
          "at": "2026-11-23T07:01:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Replay an event

POST `/erp/v1/event-deliveries/{deliveryId}/replay`

Sends a parked event again to the endpoint. The event is the same, with the same `id`. It is refused when the delivery is not parked.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `deliveryId` | path | `string (uuid)` | Yesrequired | The delivery of the parked 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 change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The event delivery does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `nothing_parked`: The event delivery is not parked, so there is nothing to replay. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/event-deliveries/df8cc18b-4a2b-4363-8bc2-af08e1083330/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "abe71360-a83f-41b5-8e93-3cb7a17c4d74"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/event-deliveries/df8cc18b-4a2b-4363-8bc2-af08e1083330/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "abe71360-a83f-41b5-8e93-3cb7a17c4d74"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/event-deliveries/df8cc18b-4a2b-4363-8bc2-af08e1083330/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'abe71360-a83f-41b5-8e93-3cb7a17c4d74',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "abe71360-a83f-41b5-8e93-3cb7a17c4d74"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/event-deliveries/df8cc18b-4a2b-4363-8bc2-af08e1083330/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")}/erp/v1/event-deliveries/df8cc18b-4a2b-4363-8bc2-af08e1083330/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "abe71360-a83f-41b5-8e93-3cb7a17c4d74"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "abe71360-a83f-41b5-8e93-3cb7a17c4d74",
  "status": "accepted",
  "aggregateId": "df8cc18b-4a2b-4363-8bc2-af08e1083330",
  "aggregateRevision": 7
}
```
