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

# Subscriptions

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

## Create a subscription

POST `/accounting/v1/subscriptions`

Registers the HTTPS endpoint that receives the events of your company, for the event types 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, a type is wrong, or a reason is empty. `fields` names each one. | `Error` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this account or company, or `customerOrgId` or `legalCompanyId` in the body is not the one of the token. | `Error` |
| `409` | This `operationId` was already used for 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/accounting/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "08e0d1ef-d9f4-4074-a46d-248df5d036a4",
  "url": "https://erp.brumar.example/accounting/events",
  "eventTypes": [
    "com.rdcopilot.accounting.posting.accepted.v1",
    "com.rdcopilot.accounting.posting.posted.v1",
    "com.rdcopilot.accounting.posting.rejected.v1",
    "com.rdcopilot.accounting.entry.reversed.v1",
    "com.rdcopilot.accounting.period.closing.v1",
    "com.rdcopilot.accounting.period.locked.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/accounting/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "08e0d1ef-d9f4-4074-a46d-248df5d036a4",
    "url": "https://erp.brumar.example/accounting/events",
    "eventTypes": [
      "com.rdcopilot.accounting.posting.accepted.v1",
      "com.rdcopilot.accounting.posting.posted.v1",
      "com.rdcopilot.accounting.posting.rejected.v1",
      "com.rdcopilot.accounting.entry.reversed.v1",
      "com.rdcopilot.accounting.period.closing.v1",
      "com.rdcopilot.accounting.period.locked.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/accounting/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '08e0d1ef-d9f4-4074-a46d-248df5d036a4',
        'url': 'https://erp.brumar.example/accounting/events',
        'eventTypes': [
            'com.rdcopilot.accounting.posting.accepted.v1',
            'com.rdcopilot.accounting.posting.posted.v1',
            'com.rdcopilot.accounting.posting.rejected.v1',
            'com.rdcopilot.accounting.entry.reversed.v1',
            'com.rdcopilot.accounting.period.closing.v1',
            'com.rdcopilot.accounting.period.locked.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "08e0d1ef-d9f4-4074-a46d-248df5d036a4",
  "url": "https://erp.brumar.example/accounting/events",
  "eventTypes": [
    "com.rdcopilot.accounting.posting.accepted.v1",
    "com.rdcopilot.accounting.posting.posted.v1",
    "com.rdcopilot.accounting.posting.rejected.v1",
    "com.rdcopilot.accounting.entry.reversed.v1",
    "com.rdcopilot.accounting.period.closing.v1",
    "com.rdcopilot.accounting.period.locked.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/accounting/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")}/accounting/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "08e0d1ef-d9f4-4074-a46d-248df5d036a4",
  "url": "https://erp.brumar.example/accounting/events",
  "eventTypes": [
    "com.rdcopilot.accounting.posting.accepted.v1",
    "com.rdcopilot.accounting.posting.posted.v1",
    "com.rdcopilot.accounting.posting.rejected.v1",
    "com.rdcopilot.accounting.entry.reversed.v1",
    "com.rdcopilot.accounting.period.closing.v1",
    "com.rdcopilot.accounting.period.locked.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "08e0d1ef-d9f4-4074-a46d-248df5d036a4",
  "status": "accepted",
  "aggregateId": "b1b0d887-44cf-406a-b541-ed995b0731a5",
  "aggregateRevision": 1,
  "secret": "whsec_Hc3ZtbHN3+zvvIqAWX/YTy+LGdijmHF/"
}
```

## Rotate the secret of a subscription

POST `/accounting/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 account or company, or `customerOrgId` or `legalCompanyId` in the body is not the one of the token. | `Error` |
| `404` | No subscription with this id exists for your company. | `Error` |
| `409` | This `operationId` was already used for 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/accounting/v1/subscriptions/b1b0d887-44cf-406a-b541-ed995b0731a5/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "bbff0f78-9b0d-4a73-8b0f-2b9e65599a52"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/accounting/v1/subscriptions/b1b0d887-44cf-406a-b541-ed995b0731a5/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "bbff0f78-9b0d-4a73-8b0f-2b9e65599a52"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/accounting/v1/subscriptions/b1b0d887-44cf-406a-b541-ed995b0731a5/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'bbff0f78-9b0d-4a73-8b0f-2b9e65599a52',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "bbff0f78-9b0d-4a73-8b0f-2b9e65599a52"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/accounting/v1/subscriptions/b1b0d887-44cf-406a-b541-ed995b0731a5/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")}/accounting/v1/subscriptions/b1b0d887-44cf-406a-b541-ed995b0731a5/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "bbff0f78-9b0d-4a73-8b0f-2b9e65599a52"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "bbff0f78-9b0d-4a73-8b0f-2b9e65599a52",
  "status": "accepted",
  "aggregateId": "b1b0d887-44cf-406a-b541-ed995b0731a5",
  "aggregateRevision": 2,
  "secret": "whsec_CFv8yqHoc5uSzZbYuRHfZFkmw/X/0Bp2"
}
```

## List deliveries

GET `/accounting/v1/deliveries`

Returns the deliveries of your events in pages, newest first. Filter by `state` to find the events that are retrying or parked.

### 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 deliveries. | `DeliveryPage` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this account or company, or `customerOrgId` or `legalCompanyId` in the body is not the one of the token. | `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/accounting/v1/deliveries?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/accounting/v1/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")}/accounting/v1/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": "a12030c9-fc4b-40a5-a238-ca25dcc1786c",
      "type": "com.rdcopilot.accounting.posting.rejected.v1",
      "aggregateId": "eefbc55a-4da9-42d9-8c56-9764421e1fff",
      "state": "retrying",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-23T07:12:01Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 1
    },
    {
      "id": "b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3",
      "type": "com.rdcopilot.accounting.entry.reversed.v1",
      "aggregateId": "c5a671de-e7b0-42b8-825d-d15c0612ff58",
      "state": "parked",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-23T07:12:01Z"
        },
        {
          "n": 2,
          "http": 502,
          "at": "2026-11-23T07:13:01Z"
        },
        {
          "n": 3,
          "http": 503,
          "at": "2026-11-23T07:18:01Z"
        },
        {
          "n": 4,
          "http": 503,
          "at": "2026-11-23T07:48:01Z"
        },
        {
          "n": 5,
          "http": 502,
          "at": "2026-11-23T09:48:01Z"
        },
        {
          "n": 6,
          "http": null,
          "at": "2026-11-23T21:48:01Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 6
    }
  ],
  "nextCursor": null
}
```

## Replay an event

POST `/accounting/v1/deliveries/{deliveryId}/replay`

Sends a parked event again to the endpoint. It is refused when the delivery is not parked and when the endpoint does not answer the check that precedes the replay.

### Parameters

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

### 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 account or company, or `customerOrgId` or `legalCompanyId` in the body is not the one of the token. | `Error` |
| `404` | No delivery with this id exists for your company. | `Error` |
| `409` | `operation_reused`: This `operationId` was already used for a different request. `nothing_parked`: The delivery is not in the `parked` state, so there is nothing to replay. `endpoint_not_answering`: Your endpoint did not answer the check that precedes a 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/accounting/v1/deliveries/b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "17524c18-4119-42c1-a5cd-82b011537ecc"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/accounting/v1/deliveries/b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "17524c18-4119-42c1-a5cd-82b011537ecc"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/accounting/v1/deliveries/b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '17524c18-4119-42c1-a5cd-82b011537ecc',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "17524c18-4119-42c1-a5cd-82b011537ecc"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/accounting/v1/deliveries/b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3/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")}/accounting/v1/deliveries/b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "17524c18-4119-42c1-a5cd-82b011537ecc"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "17524c18-4119-42c1-a5cd-82b011537ecc",
  "status": "accepted",
  "aggregateId": "b4b129f5-85de-4dbd-b5ab-7ef354ce2fc3",
  "aggregateRevision": 7
}
```
