---
title: "Webhooks | Docs | Payroll by R&D Copilot"
description: "Read events, register subscriptions and replay deliveries."
canonical: "https://payroll.rdcopilot.com/docs/api-reference/events/"
language: en
updated: 2026-11-22
---

# Webhooks

Read events, register subscriptions and replay deliveries.

## List payroll events

GET `/payroll/v1/events`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | Nooptional | Default `100` Range `1` – `500` |
| `cursor` | query | `string` | Nooptional |  |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | Current record. | `EventPage` |
| `401` | Token missing or invalid. | `Error` |
| `403` | The client lacks access to this company or operation. | `Error` |
| `429` | Too many requests. The request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/payroll/v1/events" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

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

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/payroll/v1/events');
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")}/payroll/v1/events");
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": [
    {
      "specversion": "1.0",
      "id": "f7cc9497-d3fd-4476-9100-000000000010",
      "type": "com.rdcopilot.payroll.pay_run.approved.v1",
      "source": "/payroll/v1",
      "time": "2026-12-02T10:15:00Z",
      "customerOrgId": "brumar",
      "legalCompanyId": "brumar",
      "aggregateType": "pay_run",
      "aggregateId": "PR-2026-11",
      "aggregateRevision": 6,
      "correlationId": "f7cc9497-d3fd-4476-9100-000000000011",
      "causationId": "f7cc9497-d3fd-4476-9100-000000000005",
      "actor": {
        "type": "api_client",
        "id": "payroll-client"
      },
      "data": {
        "status": "approved"
      }
    }
  ],
  "nextCursor": null
}
```

## Register a webhook subscription

POST `/payroll/v1/subscriptions`

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | UUID chosen by the caller for this change. |
| `expectedRevision` | `integer` | Yesrequired | Revision read before writing, or zero for a new subscription. |
| `url` | `string (uri)` | Yesrequired | HTTPS webhook endpoint. |
| `types` | `string[]` | Yesrequired |  |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | Subscription and its signing secret. | `OperationResult` |
| `400` | Invalid request fields. | `Error` |
| `401` | Token missing or invalid. | `Error` |
| `403` | The client lacks access to this company or operation. | `Error` |
| `409` | The revision changed or the operation ID was reused with a different request body. | `Error` |
| `429` | Too many requests. The request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/payroll/v1/subscriptions" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000008",
  "expectedRevision": 0,
  "url": "https://payroll-hooks.example/events",
  "types": [
    "com.rdcopilot.payroll.pay_run.approved.v1"
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/payroll/v1/subscriptions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "f7cc9497-d3fd-4476-9100-000000000008",
    "expectedRevision": 0,
    "url": "https://payroll-hooks.example/events",
    "types": [
      "com.rdcopilot.payroll.pay_run.approved.v1"
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/payroll/v1/subscriptions',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'f7cc9497-d3fd-4476-9100-000000000008',
        'expectedRevision': 0,
        'url': 'https://payroll-hooks.example/events',
        'types': [
            'com.rdcopilot.payroll.pay_run.approved.v1',
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000008",
  "expectedRevision": 0,
  "url": "https://payroll-hooks.example/events",
  "types": [
    "com.rdcopilot.payroll.pay_run.approved.v1"
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/payroll/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")}/payroll/v1/subscriptions");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000008",
  "expectedRevision": 0,
  "url": "https://payroll-hooks.example/events",
  "types": [
    "com.rdcopilot.payroll.pay_run.approved.v1"
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000008",
  "status": "completed",
  "aggregateRevision": 1,
  "subscriptionId": "sub-payroll-01",
  "secret": "whsec_cGF5cm9sbC1zaWduaW5nLXZlY3Rvci1vbmx5"
}
```

## Rotate the subscription secret

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

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `subscriptionId` | path | `string` | Yesrequired |  |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | UUID chosen by the caller for this change. |
| `expectedRevision` | `integer` | Yesrequired | Revision read before writing, or zero for a new subscription. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | Subscription and its signing secret. | `OperationResult` |
| `400` | Invalid request fields. | `Error` |
| `401` | Token missing or invalid. | `Error` |
| `403` | The client lacks access to this company or operation. | `Error` |
| `404` | Record not found. | `Error` |
| `409` | The revision changed or the operation ID was reused with a different request body. | `Error` |
| `429` | Too many requests. The request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/payroll/v1/subscriptions/sub-payroll-01/secret" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000012",
  "expectedRevision": 1
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/payroll/v1/subscriptions/sub-payroll-01/secret`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "f7cc9497-d3fd-4476-9100-000000000012",
    "expectedRevision": 1
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/payroll/v1/subscriptions/sub-payroll-01/secret',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'f7cc9497-d3fd-4476-9100-000000000012',
        'expectedRevision': 1,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000012",
  "expectedRevision": 1
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/payroll/v1/subscriptions/sub-payroll-01/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")}/payroll/v1/subscriptions/sub-payroll-01/secret");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000012",
  "expectedRevision": 1
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000012",
  "status": "completed",
  "aggregateRevision": 2,
  "subscriptionId": "sub-payroll-01",
  "secret": "whsec_cGF5cm9sbC1yb3RhdGlvbi12ZWN0b3Itb25seQ=="
}
```

## Replay a parked delivery

POST `/payroll/v1/events/{eventId}/replay`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `eventId` | path | `string (uuid)` | Yesrequired |  |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | UUID chosen by the caller for this change. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | Recorded operation and its outcome. | `OperationResult` |
| `400` | Invalid request fields. | `Error` |
| `401` | Token missing or invalid. | `Error` |
| `403` | The client lacks access to this company or operation. | `Error` |
| `404` | Record not found. | `Error` |
| `409` | The revision changed or the operation ID was reused with a different request body. | `Error` |
| `429` | Too many requests. The request was not processed. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/payroll/v1/events/f7cc9497-d3fd-4476-9100-000000000010/replay" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000009"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/payroll/v1/events/f7cc9497-d3fd-4476-9100-000000000010/replay`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "f7cc9497-d3fd-4476-9100-000000000009"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/payroll/v1/events/f7cc9497-d3fd-4476-9100-000000000010/replay',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'f7cc9497-d3fd-4476-9100-000000000009',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000009"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/payroll/v1/events/f7cc9497-d3fd-4476-9100-000000000010/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")}/payroll/v1/events/f7cc9497-d3fd-4476-9100-000000000010/replay");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000009"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "f7cc9497-d3fd-4476-9100-000000000009",
  "status": "completed",
  "aggregateRevision": 1
}
```
