---
title: "Subscriptions | Docs | Treasury by R&D Copilot"
description: "Register the HTTPS endpoint that receives events, and read, retry and replay the deliveries."
canonical: "https://banking.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 `/banking/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` | Treasury cannot answer now. | `Error` |

### Request

curl

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

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/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"]}/banking/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') . '/banking/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")}/banking/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": "a907adea-68a7-492e-94b1-0fe38c5ff793",
      "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
      "url": "https://erp.brumar.example/banking/events",
      "eventTypes": [
        "com.rdcopilot.banking.statement.imported.v1",
        "com.rdcopilot.banking.match.suggested.v1",
        "com.rdcopilot.banking.match.accepted.v1",
        "com.rdcopilot.banking.payment.approved.v1",
        "com.rdcopilot.banking.payment.exported.v1",
        "com.rdcopilot.banking.payment.confirmed.v1",
        "com.rdcopilot.banking.payment.rejected.v1"
      ],
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Create a subscription

POST `/banking/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 are delivered. |
| `url` | `string` | Yesrequired | The HTTPS address that receives the events. |
| `eventTypes` | `string[]` | Yesrequired | The event types delivered. |

### 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. | `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` |
| `404` | The company does not exist in your account. | `Error` |
| `409` | The `operationId` was already used 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` | Treasury cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/banking/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
  "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
  "url": "https://erp.brumar.example/banking/events",
  "eventTypes": [
    "com.rdcopilot.banking.statement.imported.v1",
    "com.rdcopilot.banking.match.suggested.v1",
    "com.rdcopilot.banking.match.accepted.v1",
    "com.rdcopilot.banking.payment.approved.v1",
    "com.rdcopilot.banking.payment.exported.v1",
    "com.rdcopilot.banking.payment.confirmed.v1",
    "com.rdcopilot.banking.payment.rejected.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
    "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
    "url": "https://erp.brumar.example/banking/events",
    "eventTypes": [
      "com.rdcopilot.banking.statement.imported.v1",
      "com.rdcopilot.banking.match.suggested.v1",
      "com.rdcopilot.banking.match.accepted.v1",
      "com.rdcopilot.banking.payment.approved.v1",
      "com.rdcopilot.banking.payment.exported.v1",
      "com.rdcopilot.banking.payment.confirmed.v1",
      "com.rdcopilot.banking.payment.rejected.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '256c79a3-7eb8-4b3f-b46f-0fd60d92987c',
        'companyId': '3e738c06-3df7-4eb7-bfe2-259b8ba481f9',
        'url': 'https://erp.brumar.example/banking/events',
        'eventTypes': [
            'com.rdcopilot.banking.statement.imported.v1',
            'com.rdcopilot.banking.match.suggested.v1',
            'com.rdcopilot.banking.match.accepted.v1',
            'com.rdcopilot.banking.payment.approved.v1',
            'com.rdcopilot.banking.payment.exported.v1',
            'com.rdcopilot.banking.payment.confirmed.v1',
            'com.rdcopilot.banking.payment.rejected.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
  "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
  "url": "https://erp.brumar.example/banking/events",
  "eventTypes": [
    "com.rdcopilot.banking.statement.imported.v1",
    "com.rdcopilot.banking.match.suggested.v1",
    "com.rdcopilot.banking.match.accepted.v1",
    "com.rdcopilot.banking.payment.approved.v1",
    "com.rdcopilot.banking.payment.exported.v1",
    "com.rdcopilot.banking.payment.confirmed.v1",
    "com.rdcopilot.banking.payment.rejected.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/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")}/banking/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
  "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
  "url": "https://erp.brumar.example/banking/events",
  "eventTypes": [
    "com.rdcopilot.banking.statement.imported.v1",
    "com.rdcopilot.banking.match.suggested.v1",
    "com.rdcopilot.banking.match.accepted.v1",
    "com.rdcopilot.banking.payment.approved.v1",
    "com.rdcopilot.banking.payment.exported.v1",
    "com.rdcopilot.banking.payment.confirmed.v1",
    "com.rdcopilot.banking.payment.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": "256c79a3-7eb8-4b3f-b46f-0fd60d92987c",
  "status": "accepted",
  "aggregateId": "a907adea-68a7-492e-94b1-0fe38c5ff793",
  "aggregateRevision": 1,
  "secret": "whsec_T7mQ2vLx0bNf5RcYd9HsJe3KpWa8UgZo"
}
```

## List deliveries

GET `/banking/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 in the list of companies. |
| `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 company or operation. | `Error` |
| `404` | The company does not exist in your account. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | Treasury cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/banking/v1/deliveries?companyId=3e738c06-3df7-4eb7-bfe2-259b8ba481f9&limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/deliveries?companyId=3e738c06-3df7-4eb7-bfe2-259b8ba481f9&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"]}/banking/v1/deliveries?companyId=3e738c06-3df7-4eb7-bfe2-259b8ba481f9&limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/deliveries?companyId=3e738c06-3df7-4eb7-bfe2-259b8ba481f9&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")}/banking/v1/deliveries?companyId=3e738c06-3df7-4eb7-bfe2-259b8ba481f9&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": "a80e70de-9e87-4a9b-9de3-ba22403a5f36",
      "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
      "subscriptionId": "a907adea-68a7-492e-94b1-0fe38c5ff793",
      "eventId": "26ce0064-f6ec-408e-9b0e-c5bb0301b8bc",
      "type": "com.rdcopilot.banking.payment.rejected.v1",
      "state": "retrying",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-20T09:04:00Z"
        },
        {
          "n": 2,
          "http": 503,
          "at": "2026-11-20T09:05:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 2
    },
    {
      "id": "5a280d9f-e601-458c-b3a0-6ab01af6e733",
      "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
      "subscriptionId": "a907adea-68a7-492e-94b1-0fe38c5ff793",
      "eventId": "20b7194a-ae6f-4b44-9aaf-b2967156458f",
      "type": "com.rdcopilot.banking.payment.confirmed.v1",
      "state": "parked",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-19T17:12:00Z"
        },
        {
          "n": 2,
          "http": 503,
          "at": "2026-11-19T17:13:00Z"
        },
        {
          "n": 3,
          "http": 503,
          "at": "2026-11-19T17:18:00Z"
        },
        {
          "n": 4,
          "http": 503,
          "at": "2026-11-19T17:48:00Z"
        },
        {
          "n": 5,
          "http": 503,
          "at": "2026-11-19T19:48:00Z"
        },
        {
          "n": 6,
          "http": 503,
          "at": "2026-11-20T07:48:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 6
    },
    {
      "id": "b075a0cf-0669-4dd7-af03-ceb85c29b175",
      "companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
      "subscriptionId": "a907adea-68a7-492e-94b1-0fe38c5ff793",
      "eventId": "740853fd-01ee-4be6-bd7c-0c6f97579e6a",
      "type": "com.rdcopilot.banking.statement.imported.v1",
      "state": "delivered",
      "attempts": [
        {
          "n": 1,
          "http": 200,
          "at": "2026-11-20T09:01:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Rotate the secret of a subscription

POST `/banking/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 in your account. | `Error` |
| `409` | The `operationId` was already used 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` | Treasury cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/banking/v1/subscriptions/a907adea-68a7-492e-94b1-0fe38c5ff793/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "aa49510d-b439-424c-bfb1-01323ca012bc"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/subscriptions/a907adea-68a7-492e-94b1-0fe38c5ff793/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "aa49510d-b439-424c-bfb1-01323ca012bc"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/subscriptions/a907adea-68a7-492e-94b1-0fe38c5ff793/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'aa49510d-b439-424c-bfb1-01323ca012bc',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "aa49510d-b439-424c-bfb1-01323ca012bc"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/subscriptions/a907adea-68a7-492e-94b1-0fe38c5ff793/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")}/banking/v1/subscriptions/a907adea-68a7-492e-94b1-0fe38c5ff793/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "aa49510d-b439-424c-bfb1-01323ca012bc"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "aa49510d-b439-424c-bfb1-01323ca012bc",
  "status": "accepted",
  "aggregateId": "a907adea-68a7-492e-94b1-0fe38c5ff793",
  "aggregateRevision": 2,
  "secret": "whsec_Bq4Zt1NwGk8VyEh6Mc0RsXu7DjPa3LfI"
}
```

## Retry a delivery

POST `/banking/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, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The delivery does not exist in your account. | `Error` |
| `409` | The `operationId` was already used with a different request. | `Error` |
| `422` | The delivery is not waiting for another attempt. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | Treasury cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/banking/v1/deliveries/a80e70de-9e87-4a9b-9de3-ba22403a5f36/retry" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "4df9c24b-692a-4065-afa5-0f5243823ac5"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/deliveries/a80e70de-9e87-4a9b-9de3-ba22403a5f36/retry`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "4df9c24b-692a-4065-afa5-0f5243823ac5"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/deliveries/a80e70de-9e87-4a9b-9de3-ba22403a5f36/retry',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '4df9c24b-692a-4065-afa5-0f5243823ac5',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "4df9c24b-692a-4065-afa5-0f5243823ac5"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/deliveries/a80e70de-9e87-4a9b-9de3-ba22403a5f36/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")}/banking/v1/deliveries/a80e70de-9e87-4a9b-9de3-ba22403a5f36/retry");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "4df9c24b-692a-4065-afa5-0f5243823ac5"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "4df9c24b-692a-4065-afa5-0f5243823ac5",
  "status": "accepted",
  "aggregateId": "a80e70de-9e87-4a9b-9de3-ba22403a5f36",
  "aggregateRevision": 3
}
```

## Replay an event

POST `/banking/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, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The delivery does not exist in your account. | `Error` |
| `409` | The `operationId` was already used with a different request. | `Error` |
| `422` | `nothing_parked`: The delivery is not parked. `endpoint_not_answering`: The endpoint of the subscription does not answer. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | Treasury cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/banking/v1/deliveries/5a280d9f-e601-458c-b3a0-6ab01af6e733/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "f0c12006-1617-4fcd-a5b0-60d7ee2bc3c3"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/deliveries/5a280d9f-e601-458c-b3a0-6ab01af6e733/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "f0c12006-1617-4fcd-a5b0-60d7ee2bc3c3"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/banking/v1/deliveries/5a280d9f-e601-458c-b3a0-6ab01af6e733/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'f0c12006-1617-4fcd-a5b0-60d7ee2bc3c3',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "f0c12006-1617-4fcd-a5b0-60d7ee2bc3c3"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/deliveries/5a280d9f-e601-458c-b3a0-6ab01af6e733/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")}/banking/v1/deliveries/5a280d9f-e601-458c-b3a0-6ab01af6e733/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "f0c12006-1617-4fcd-a5b0-60d7ee2bc3c3"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "f0c12006-1617-4fcd-a5b0-60d7ee2bc3c3",
  "status": "accepted",
  "aggregateId": "5a280d9f-e601-458c-b3a0-6ab01af6e733",
  "aggregateRevision": 7
}
```
