---
title: "Create a webhook endpoint"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a webhook endpoint

Path: CloudRaker Paperwork API › Webhooks

`POST /v1/webhooks`

Saves a delivery target you can point any run at.

Reference it from a run as `webhook: { "id": "whe_…" }` — on [extract](https://docs.cloudraker.com/paperwork/api/capabilities/extract), [fill](https://docs.cloudraker.com/paperwork/api/capabilities/fill), [pipeline](https://docs.cloudraker.com/paperwork/api/capabilities/pipeline), any of them. Runs keep the *reference*, never a URL snapshot, so pausing or re-pointing an endpoint takes effect on runs already in flight.

```json
{
  "url": "https://example.com/hooks/cloudraker",
  "events": ["run.completed", "run.failed"]
}
```

**Event types** — omit `events` to receive all of them:

- `processing.started`
- `file.processed`
- `file.failed`
- `run.completed`
- `run.failed`
- `processing.completed`
- `processing.expired`
- `space.expired`
- `agent_run.waiting`
- `agent_run.needs_input`
- `agent_run.approval_requested`
- `agent_run.task_ready`
- `agent_run.completed`
- `agent_run.failed`
- `work_session.opened`
- `work_session.waiting`
- `work_session.done`
- `turn.started`
- `turn.finished`
- `turn.failed`
- `approval.requested`
- `approval.decided`
- `artifact.created`
- `artifact.committed`
- `embed.document_saved`
- `embed.document_approved`

**Delivery guarantees.** At-least-once, so dedupe on `eventId` — a retry re-sends the whole event to every target. Up to 6 attempts, at least ten seconds apart, then the event is dropped. Each attempt is signed ES256 — verify against [the public keys](https://docs.cloudraker.com/paperwork/api/webhook-endpoints/webhook-jwks), and check what actually landed with [the delivery log](https://docs.cloudraker.com/paperwork/api/webhook-endpoints/list-webhook-deliveries).

**Learn more:** [Webhooks guide](https://docs.cloudraker.com/paperwork/developers/webhooks)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `url` (`createWebhookEndpoint.url`; string, required)
  - format `uri`; example `"https://example.com/hooks/cloudraker"`
- `events` (`createWebhookEndpoint.events`; array<string>, optional)
  - one of `"processing.started"`, `"file.processed"`, `"file.failed"`, `"run.completed"`, `"run.failed"`, `"processing.completed"`, `"processing.expired"`, `"space.expired"`, `"agent_run.waiting"`, `"agent_run.needs_input"`, `"agent_run.approval_requested"`, `"agent_run.task_ready"`, `"agent_run.completed"`, `"agent_run.failed"`, `"work_session.opened"`, `"work_session.waiting"`, `"work_session.done"`, `"turn.started"`, `"turn.finished"`, `"turn.failed"`, `"approval.requested"`, `"approval.decided"`, `"artifact.created"`, `"artifact.committed"`, `"embed.document_saved"`, `"embed.document_approved"`
- `disabled` (`createWebhookEndpoint.disabled`; boolean, optional)

## Example request

```json
{
  "url": "https://example.com/hooks/cloudraker",
  "events": [
    "processing.started"
  ],
  "disabled": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/v1/webhooks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://example.com/hooks/cloudraker",
  "events": [
    "processing.started"
  ],
  "disabled": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/webhooks';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    url: 'https://example.com/hooks/cloudraker',
    events: ['processing.started'],
    disabled: true
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/webhooks"

payload = {
    "url": "https://example.com/hooks/cloudraker",
    "events": ["processing.started"],
    "disabled": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

The endpoint.

#### Example

```json
{
  "object": "webhook_endpoint",
  "id": "whe_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
  "url": "string",
  "events": [
    "string"
  ],
  "disabled": true,
  "createdAt": "string"
}
```

- `object` (`createWebhookEndpoint.response.201.object`; string, required)
- `id` (`createWebhookEndpoint.response.201.id`; string, required)
  - example `"whe_01JQ8ZKMRT4V6WXYZ0ABCDEFGH"`
- `url` (`createWebhookEndpoint.response.201.url`; string, required)
- `disabled` (`createWebhookEndpoint.response.201.disabled`; boolean, required)
- `createdAt` (`createWebhookEndpoint.response.201.createdAt`; string, required)
- `events` (`createWebhookEndpoint.response.201.events`; array<string>, optional)

### 400

Invalid url or event type (`invalid_request`).

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`createWebhookEndpoint.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`createWebhookEndpoint.response.429.message`; string, required)
- `retryable` (`createWebhookEndpoint.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`createWebhookEndpoint.response.429.requestId`; string, required)
- `docUrl` (`createWebhookEndpoint.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/webhook-endpoints/create-webhook-endpoint/index.md
