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

# Subscriptions

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

## List subscriptions

GET `/declarations/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, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

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

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/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"]}/declarations/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') . '/declarations/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")}/declarations/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": "35f6e58a-d74b-49a8-8f34-c6732a2a4f3c",
      "companyId": "a79a302d-e7f0-4fde-9086-48c003b9709a",
      "url": "https://erp.brumar.example/declarations/events",
      "eventTypes": [
        "com.rdcopilot.declarations.return.submitted.v1",
        "com.rdcopilot.declarations.return.accepted.v1",
        "com.rdcopilot.declarations.return.rejected.v1"
      ],
      "revision": 1
    },
    {
      "id": "b5a6b345-a2e4-4f5c-963b-460de635e9f9",
      "companyId": "e5860f91-2f25-4d40-bafd-2c0211d184fa",
      "url": "https://pos.brumar.example/declarations/events",
      "eventTypes": [
        "com.rdcopilot.declarations.return.submitted.v1",
        "com.rdcopilot.declarations.return.accepted.v1",
        "com.rdcopilot.declarations.return.rejected.v1"
      ],
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Create a subscription

POST `/declarations/v1/subscriptions`

Registers the HTTPS endpoint of a company that receives its events. 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. |
| `companyId` | `string (uuid)` | Yesrequired | The company whose events you want. |
| `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 is not valid JSON or a field is missing or has the wrong type. | `Error` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `404` | The company does not exist in your account. | `Error` |
| `409` | The `operationId` was already used with a different request. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/declarations/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "e274fcd2-ba9e-47b3-bb06-9757df96277c",
  "companyId": "a79a302d-e7f0-4fde-9086-48c003b9709a",
  "url": "https://erp.brumar.example/declarations/events",
  "eventTypes": [
    "com.rdcopilot.declarations.return.submitted.v1",
    "com.rdcopilot.declarations.return.accepted.v1",
    "com.rdcopilot.declarations.return.rejected.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "e274fcd2-ba9e-47b3-bb06-9757df96277c",
    "companyId": "a79a302d-e7f0-4fde-9086-48c003b9709a",
    "url": "https://erp.brumar.example/declarations/events",
    "eventTypes": [
      "com.rdcopilot.declarations.return.submitted.v1",
      "com.rdcopilot.declarations.return.accepted.v1",
      "com.rdcopilot.declarations.return.rejected.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/declarations/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'e274fcd2-ba9e-47b3-bb06-9757df96277c',
        'companyId': 'a79a302d-e7f0-4fde-9086-48c003b9709a',
        'url': 'https://erp.brumar.example/declarations/events',
        'eventTypes': [
            'com.rdcopilot.declarations.return.submitted.v1',
            'com.rdcopilot.declarations.return.accepted.v1',
            'com.rdcopilot.declarations.return.rejected.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "e274fcd2-ba9e-47b3-bb06-9757df96277c",
  "companyId": "a79a302d-e7f0-4fde-9086-48c003b9709a",
  "url": "https://erp.brumar.example/declarations/events",
  "eventTypes": [
    "com.rdcopilot.declarations.return.submitted.v1",
    "com.rdcopilot.declarations.return.accepted.v1",
    "com.rdcopilot.declarations.return.rejected.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/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")}/declarations/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "e274fcd2-ba9e-47b3-bb06-9757df96277c",
  "companyId": "a79a302d-e7f0-4fde-9086-48c003b9709a",
  "url": "https://erp.brumar.example/declarations/events",
  "eventTypes": [
    "com.rdcopilot.declarations.return.submitted.v1",
    "com.rdcopilot.declarations.return.accepted.v1",
    "com.rdcopilot.declarations.return.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": "e274fcd2-ba9e-47b3-bb06-9757df96277c",
  "status": "accepted",
  "aggregateId": "35f6e58a-d74b-49a8-8f34-c6732a2a4f3c",
  "aggregateRevision": 1,
  "secret": "whsec_XzqUQsvy8YdbmCI7sU1wJ518NC+J/8aC"
}
```

## Rotate the secret of a subscription

POST `/declarations/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, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `404` | The subscription does not exist in your account. | `Error` |
| `409` | The `operationId` was already used with a different request. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/declarations/v1/subscriptions/35f6e58a-d74b-49a8-8f34-c6732a2a4f3c/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "7cc37f58-c814-4c8b-99b9-c5d61399b36f"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/subscriptions/35f6e58a-d74b-49a8-8f34-c6732a2a4f3c/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "7cc37f58-c814-4c8b-99b9-c5d61399b36f"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/declarations/v1/subscriptions/35f6e58a-d74b-49a8-8f34-c6732a2a4f3c/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '7cc37f58-c814-4c8b-99b9-c5d61399b36f',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "7cc37f58-c814-4c8b-99b9-c5d61399b36f"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/subscriptions/35f6e58a-d74b-49a8-8f34-c6732a2a4f3c/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")}/declarations/v1/subscriptions/35f6e58a-d74b-49a8-8f34-c6732a2a4f3c/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "7cc37f58-c814-4c8b-99b9-c5d61399b36f"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "7cc37f58-c814-4c8b-99b9-c5d61399b36f",
  "status": "accepted",
  "aggregateId": "35f6e58a-d74b-49a8-8f34-c6732a2a4f3c",
  "aggregateRevision": 2,
  "secret": "whsec_k3Tn0Gm2VdWm9bQp1xYhF7sJ4LrZcA6e"
}
```

## Check an endpoint

POST `/declarations/v1/subscriptions/{subscriptionId}/check`

Calls the endpoint of the subscription once more and records whether it answers. It is refused when the endpoint already answers.

### 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: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `404` | The subscription does not exist in your account. | `Error` |
| `409` | `operation_reused`: The `operationId` was already used with a different request. `endpoint_answering`: The event endpoint already answers. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/declarations/v1/subscriptions/b5a6b345-a2e4-4f5c-963b-460de635e9f9/check" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "83fb2a97-64f8-4a89-b57b-64b9a0c9d004"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/subscriptions/b5a6b345-a2e4-4f5c-963b-460de635e9f9/check`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "83fb2a97-64f8-4a89-b57b-64b9a0c9d004"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/declarations/v1/subscriptions/b5a6b345-a2e4-4f5c-963b-460de635e9f9/check',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '83fb2a97-64f8-4a89-b57b-64b9a0c9d004',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "83fb2a97-64f8-4a89-b57b-64b9a0c9d004"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/subscriptions/b5a6b345-a2e4-4f5c-963b-460de635e9f9/check');
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")}/declarations/v1/subscriptions/b5a6b345-a2e4-4f5c-963b-460de635e9f9/check");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "83fb2a97-64f8-4a89-b57b-64b9a0c9d004"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "83fb2a97-64f8-4a89-b57b-64b9a0c9d004",
  "status": "accepted",
  "aggregateId": "b5a6b345-a2e4-4f5c-963b-460de635e9f9",
  "aggregateRevision": 2
}
```

## List deliveries

GET `/declarations/v1/deliveries`

Returns the deliveries of a company’s 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 |
| --- | --- | --- | --- | --- |
| `companyId` | query | `string (uuid)` | Yesrequired | The company whose records you want. It is the `id` of a company of your account. |
| `state` | query | `string` | Nooptional | Only deliveries in this state. One of `delivered`, `retrying`, `parked`, `replayed` |
| `returnId` | query | `string (uuid)` | Nooptional | Only the deliveries about this return. |
| `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, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `404` | The company does not exist in your account. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/declarations/v1/deliveries?companyId=a79a302d-e7f0-4fde-9086-48c003b9709a&limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/deliveries?companyId=a79a302d-e7f0-4fde-9086-48c003b9709a&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")}/declarations/v1/deliveries?companyId=a79a302d-e7f0-4fde-9086-48c003b9709a&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": "9ba45f49-8d67-42da-8c17-96be90153924",
      "companyId": "e5860f91-2f25-4d40-bafd-2c0211d184fa",
      "returnId": "e0a7f7b8-c7cd-46bc-9053-95e250975d06",
      "type": "com.rdcopilot.declarations.return.submitted.v1",
      "state": "retrying",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-23T07:12:08Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 1
    },
    {
      "id": "dd24acf2-7d70-4cc7-bab2-7c2481c387dc",
      "companyId": "e5860f91-2f25-4d40-bafd-2c0211d184fa",
      "returnId": "c8ce0045-bc7c-4d65-97b6-2c14c2cc3827",
      "type": "com.rdcopilot.declarations.return.accepted.v1",
      "state": "parked",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-10-22T11:07:46Z"
        },
        {
          "n": 2,
          "http": 503,
          "at": "2026-10-22T11:08:46Z"
        },
        {
          "n": 3,
          "http": 503,
          "at": "2026-10-22T11:13:46Z"
        },
        {
          "n": 4,
          "http": 503,
          "at": "2026-10-22T11:43:46Z"
        },
        {
          "n": 5,
          "http": 503,
          "at": "2026-10-22T13:43:46Z"
        },
        {
          "n": 6,
          "http": 503,
          "at": "2026-10-23T01:43:46Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 6
    }
  ],
  "nextCursor": null
}
```

## Retry a delivery

POST `/declarations/v1/deliveries/{deliveryId}/retry`

Makes the next attempt of a delivery whose state is `retrying` now. After the last attempt fails the delivery is `parked`.

### 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, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `404` | The delivery does not exist in your account. | `Error` |
| `409` | `operation_reused`: The `operationId` was already used with a different request. `nothing_to_retry`: The delivery is not waiting for a retry. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/declarations/v1/deliveries/9ba45f49-8d67-42da-8c17-96be90153924/retry" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "d13200de-488a-4ba7-8663-2def99e28497"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/deliveries/9ba45f49-8d67-42da-8c17-96be90153924/retry`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "d13200de-488a-4ba7-8663-2def99e28497"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/declarations/v1/deliveries/9ba45f49-8d67-42da-8c17-96be90153924/retry',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'd13200de-488a-4ba7-8663-2def99e28497',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "d13200de-488a-4ba7-8663-2def99e28497"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/deliveries/9ba45f49-8d67-42da-8c17-96be90153924/retry');
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")}/declarations/v1/deliveries/9ba45f49-8d67-42da-8c17-96be90153924/retry");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "d13200de-488a-4ba7-8663-2def99e28497"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "d13200de-488a-4ba7-8663-2def99e28497",
  "status": "accepted",
  "aggregateId": "9ba45f49-8d67-42da-8c17-96be90153924",
  "aggregateRevision": 2
}
```

## Replay an event

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

Sends a parked event again to the endpoint of the company. It is refused while the endpoint does not answer and 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, not valid or has ended. | `Error` |
| `403` | The token does not give access to this data. | `Error` |
| `404` | The delivery does not exist in your account. | `Error` |
| `409` | `operation_reused`: The `operationId` was already used with a different request. `nothing_parked`: The delivery is not parked. `endpoint_not_answering`: The event endpoint still does not answer. The event stays parked. | `Error` |
| `429` | Too many requests. `Retry-After` gives the seconds to wait; the request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/declarations/v1/deliveries/dd24acf2-7d70-4cc7-bab2-7c2481c387dc/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "19c13b10-c702-4fb8-b633-7dacf8f5bb41"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/deliveries/dd24acf2-7d70-4cc7-bab2-7c2481c387dc/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "19c13b10-c702-4fb8-b633-7dacf8f5bb41"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/declarations/v1/deliveries/dd24acf2-7d70-4cc7-bab2-7c2481c387dc/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '19c13b10-c702-4fb8-b633-7dacf8f5bb41',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "19c13b10-c702-4fb8-b633-7dacf8f5bb41"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/deliveries/dd24acf2-7d70-4cc7-bab2-7c2481c387dc/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")}/declarations/v1/deliveries/dd24acf2-7d70-4cc7-bab2-7c2481c387dc/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "19c13b10-c702-4fb8-b633-7dacf8f5bb41"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "19c13b10-c702-4fb8-b633-7dacf8f5bb41",
  "status": "accepted",
  "aggregateId": "dd24acf2-7d70-4cc7-bab2-7c2481c387dc",
  "aggregateRevision": 7
}
```
