---
title: "Subscriptions | Docs | e-TVA Check by R&D Copilot"
description: "Register the HTTPS endpoint that receives events, and read, retry and replay the deliveries."
canonical: "https://etva.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 `/etva/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` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

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

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/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"]}/etva/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') . '/etva/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")}/etva/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": "a9d7d4b7-3d63-4f0e-b42f-5894e5338015",
      "companyId": "b61159f8-9c0b-4cdb-ac61-afb49517aae6",
      "url": "https://erp.brumar.example/etva/events",
      "eventTypes": [
        "com.rdcopilot.etva.period.compared.v1",
        "com.rdcopilot.etva.row.status_changed.v1",
        "com.rdcopilot.etva.difference.explained.v1",
        "com.rdcopilot.etva.difference.reopened.v1",
        "com.rdcopilot.etva.file.approved.v1",
        "com.rdcopilot.etva.file.filed.v1"
      ],
      "revision": 1
    },
    {
      "id": "9e13ec14-96e8-4233-a54b-f10022d6519c",
      "companyId": "80921810-dab0-4d2c-a1ea-ea80c89bc993",
      "url": "https://shops.brumar.example/etva/events",
      "eventTypes": [
        "com.rdcopilot.etva.file.approved.v1",
        "com.rdcopilot.etva.file.filed.v1"
      ],
      "revision": 1
    }
  ],
  "nextCursor": null
}
```

## Create a subscription

POST `/etva/v1/subscriptions`

Registers the HTTPS endpoint of a company that receives its events. Every delivery is signed with the secret of the subscription, which the answer returns once.

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `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 subscription was created. The body is the operation result with the signing secret: `whsec_` followed by base64. It is returned only here, once. | `SubscriptionOperationResult` |
| `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` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "e8e21be6-7bab-4f99-be24-d3f52abb1264",
  "companyId": "b61159f8-9c0b-4cdb-ac61-afb49517aae6",
  "url": "https://erp.brumar.example/etva/events",
  "eventTypes": [
    "com.rdcopilot.etva.period.compared.v1",
    "com.rdcopilot.etva.row.status_changed.v1",
    "com.rdcopilot.etva.difference.explained.v1",
    "com.rdcopilot.etva.difference.reopened.v1",
    "com.rdcopilot.etva.file.approved.v1",
    "com.rdcopilot.etva.file.filed.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "e8e21be6-7bab-4f99-be24-d3f52abb1264",
    "companyId": "b61159f8-9c0b-4cdb-ac61-afb49517aae6",
    "url": "https://erp.brumar.example/etva/events",
    "eventTypes": [
      "com.rdcopilot.etva.period.compared.v1",
      "com.rdcopilot.etva.row.status_changed.v1",
      "com.rdcopilot.etva.difference.explained.v1",
      "com.rdcopilot.etva.difference.reopened.v1",
      "com.rdcopilot.etva.file.approved.v1",
      "com.rdcopilot.etva.file.filed.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'e8e21be6-7bab-4f99-be24-d3f52abb1264',
        'companyId': 'b61159f8-9c0b-4cdb-ac61-afb49517aae6',
        'url': 'https://erp.brumar.example/etva/events',
        'eventTypes': [
            'com.rdcopilot.etva.period.compared.v1',
            'com.rdcopilot.etva.row.status_changed.v1',
            'com.rdcopilot.etva.difference.explained.v1',
            'com.rdcopilot.etva.difference.reopened.v1',
            'com.rdcopilot.etva.file.approved.v1',
            'com.rdcopilot.etva.file.filed.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "e8e21be6-7bab-4f99-be24-d3f52abb1264",
  "companyId": "b61159f8-9c0b-4cdb-ac61-afb49517aae6",
  "url": "https://erp.brumar.example/etva/events",
  "eventTypes": [
    "com.rdcopilot.etva.period.compared.v1",
    "com.rdcopilot.etva.row.status_changed.v1",
    "com.rdcopilot.etva.difference.explained.v1",
    "com.rdcopilot.etva.difference.reopened.v1",
    "com.rdcopilot.etva.file.approved.v1",
    "com.rdcopilot.etva.file.filed.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/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")}/etva/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "e8e21be6-7bab-4f99-be24-d3f52abb1264",
  "companyId": "b61159f8-9c0b-4cdb-ac61-afb49517aae6",
  "url": "https://erp.brumar.example/etva/events",
  "eventTypes": [
    "com.rdcopilot.etva.period.compared.v1",
    "com.rdcopilot.etva.row.status_changed.v1",
    "com.rdcopilot.etva.difference.explained.v1",
    "com.rdcopilot.etva.difference.reopened.v1",
    "com.rdcopilot.etva.file.approved.v1",
    "com.rdcopilot.etva.file.filed.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "e8e21be6-7bab-4f99-be24-d3f52abb1264",
  "status": "accepted",
  "aggregateId": "a9d7d4b7-3d63-4f0e-b42f-5894e5338015",
  "aggregateRevision": 1,
  "subscriptionId": "a9d7d4b7-3d63-4f0e-b42f-5894e5338015",
  "secret": "whsec_VGhlIHNpZ25pbmcgc2VjcmV0IG9mIHRoZSBlLVRWQSBkb2NzLg=="
}
```

## Rotate the secret of a subscription

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

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

### Parameters

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

### Request body

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

### Responses

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

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/subscriptions/a9d7d4b7-3d63-4f0e-b42f-5894e5338015/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "198e2982-2fa3-441f-88c1-82dac783446e"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/subscriptions/a9d7d4b7-3d63-4f0e-b42f-5894e5338015/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "198e2982-2fa3-441f-88c1-82dac783446e"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/subscriptions/a9d7d4b7-3d63-4f0e-b42f-5894e5338015/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '198e2982-2fa3-441f-88c1-82dac783446e',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "198e2982-2fa3-441f-88c1-82dac783446e"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/subscriptions/a9d7d4b7-3d63-4f0e-b42f-5894e5338015/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")}/etva/v1/subscriptions/a9d7d4b7-3d63-4f0e-b42f-5894e5338015/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "198e2982-2fa3-441f-88c1-82dac783446e"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "198e2982-2fa3-441f-88c1-82dac783446e",
  "status": "accepted",
  "aggregateId": "a9d7d4b7-3d63-4f0e-b42f-5894e5338015",
  "aggregateRevision": 2,
  "subscriptionId": "a9d7d4b7-3d63-4f0e-b42f-5894e5338015",
  "secret": "whsec_VGhlIG5leHQgc2lnbmluZyBzZWNyZXQgb2YgZS1UVkEu"
}
```

## List deliveries

GET `/etva/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)` | Nooptional | The company whose deliveries you want. |
| `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, 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` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

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

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/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"]}/etva/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') . '/etva/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")}/etva/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": "f10e4dc2-0104-41ef-badb-7861f41aed9a",
      "companyId": "80921810-dab0-4d2c-a1ea-ea80c89bc993",
      "periodId": "80eed314-3e2b-432a-81e8-50de64b723ed",
      "type": "com.rdcopilot.etva.difference.explained.v1",
      "state": "retrying",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-23T07:12:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 1
    },
    {
      "id": "13b79a90-71da-4bac-b9c4-3243ffb44688",
      "companyId": "80921810-dab0-4d2c-a1ea-ea80c89bc993",
      "periodId": "80eed314-3e2b-432a-81e8-50de64b723ed",
      "type": "com.rdcopilot.etva.row.status_changed.v1",
      "state": "parked",
      "attempts": [
        {
          "n": 1,
          "http": 503,
          "at": "2026-11-23T04:00:00Z"
        },
        {
          "n": 2,
          "http": 503,
          "at": "2026-11-23T04:01:00Z"
        },
        {
          "n": 3,
          "http": 503,
          "at": "2026-11-23T04:06:00Z"
        },
        {
          "n": 4,
          "http": 503,
          "at": "2026-11-23T04:36:00Z"
        },
        {
          "n": 5,
          "http": 503,
          "at": "2026-11-23T06:36:00Z"
        },
        {
          "n": 6,
          "http": 503,
          "at": "2026-11-23T18:36:00Z"
        }
      ],
      "maxAttempts": 6,
      "revision": 6
    }
  ],
  "nextCursor": null
}
```

## Retry a delivery

POST `/etva/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 period 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` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/deliveries/f10e4dc2-0104-41ef-badb-7861f41aed9a/retry" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "c4d985c5-cc73-4107-b974-584c744cd53b"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/deliveries/f10e4dc2-0104-41ef-badb-7861f41aed9a/retry`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "c4d985c5-cc73-4107-b974-584c744cd53b"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/deliveries/f10e4dc2-0104-41ef-badb-7861f41aed9a/retry',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'c4d985c5-cc73-4107-b974-584c744cd53b',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "c4d985c5-cc73-4107-b974-584c744cd53b"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/deliveries/f10e4dc2-0104-41ef-badb-7861f41aed9a/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")}/etva/v1/deliveries/f10e4dc2-0104-41ef-badb-7861f41aed9a/retry");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "c4d985c5-cc73-4107-b974-584c744cd53b"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "c4d985c5-cc73-4107-b974-584c744cd53b",
  "status": "accepted",
  "aggregateId": "f10e4dc2-0104-41ef-badb-7861f41aed9a",
  "aggregateRevision": 2
}
```

## Replay an event

POST `/etva/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 period 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` | The request was refused and not processed: the `code` is `rate_limited`. Wait the seconds in the header `Retry-After`, then send it again with the same `operationId`. | `Error` |
| `503` | The service cannot answer now: the `code` is `unavailable`. Send the request again with the same `operationId`. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/deliveries/13b79a90-71da-4bac-b9c4-3243ffb44688/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "b4e2a149-6c2b-4f56-8e2f-2c7bfdd2a63a"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/deliveries/13b79a90-71da-4bac-b9c4-3243ffb44688/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "b4e2a149-6c2b-4f56-8e2f-2c7bfdd2a63a"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/deliveries/13b79a90-71da-4bac-b9c4-3243ffb44688/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'b4e2a149-6c2b-4f56-8e2f-2c7bfdd2a63a',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "b4e2a149-6c2b-4f56-8e2f-2c7bfdd2a63a"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/deliveries/13b79a90-71da-4bac-b9c4-3243ffb44688/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")}/etva/v1/deliveries/13b79a90-71da-4bac-b9c4-3243ffb44688/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "b4e2a149-6c2b-4f56-8e2f-2c7bfdd2a63a"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "b4e2a149-6c2b-4f56-8e2f-2c7bfdd2a63a",
  "status": "accepted",
  "aggregateId": "13b79a90-71da-4bac-b9c4-3243ffb44688",
  "aggregateRevision": 7
}
```
