# Webhook endpoints

> Besday webhook endpoints API: register, list, test and delete the https URLs that receive signed order events.

Source: https://besday.com/docs/api/webhook-endpoints · Updated 2026-12-03 · OpenAPI: https://besday.com/api/v1/openapi.json

Webhook endpoints receive [signed events](https://besday.com/docs/api/webhooks) when your orders change.

## The webhook endpoint object

A URL on your server that Besday POSTs signed events to when your orders change.

| Field | Type | Description |
|---|---|---|
| `object` | string | Always `webhook_endpoint`. One of: `webhook_endpoint`. |
| `id` | string | Unique id. |
| `url` | string | https URL that receives events. |
| `description` | string or null | Your label. |
| `events` | string[] | Event types sent there, or `["*"]` for all. |
| `secret` | string | Create only: the `whsec_…` signing secret. Shown once. |
| `created_at` | string | ISO 8601 timestamp (UTC) |

Example:

```json
{
  "object": "webhook_endpoint",
  "id": "we_3f9d0c8e",
  "url": "https://yourapp.com/webhooks/besday",
  "description": "Production",
  "events": [
    "order.delivered",
    "order.completed",
    "order.cancelled"
  ],
  "created_at": "2026-12-03T17:20:00.000Z"
}
```

## Create a webhook endpoint

`POST /api/v1/webhook_endpoints`

Registers an https URL for order events. The answer includes the signing secret, once.

- Scope: `read_write`
- Returns: 201 `webhook_endpoint`
- Supports `Idempotency-Key`

Body parameters (JSON):

| Name | Type | Required | Description |
|---|---|---|---|
| `url` | string | yes | https URL on port 443 that resolves to public addresses. |
| `events` | string[] | no | Event types to send, or `["*"]` (default) for all: `order.paid`, `order.awaiting_acceptance`, `order.awaiting_product`, `order.in_production`, `order.delivered`, `order.revision_requested`, `order.disputed`, `order.completed`, `order.cancelled`. |
| `description` | string | no | Your label, up to 200 characters. |

cURL:

```bash
curl -X POST "https://besday.com/api/v1/webhook_endpoints" \
  -H "Authorization: Bearer $BESDAY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://yourapp.com/webhooks/besday",
  "events": [
    "order.delivered",
    "order.completed",
    "order.cancelled"
  ],
  "description": "Production"
}'
```

Node.js:

```javascript
const res = await fetch("https://besday.com/api/v1/webhook_endpoints", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BESDAY_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://yourapp.com/webhooks/besday",
    "events": [
      "order.delivered",
      "order.completed",
      "order.cancelled"
    ],
    "description": "Production"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
```

Python:

```python
import os, uuid, requests

res = requests.post(
    "https://besday.com/api/v1/webhook_endpoints",
    headers={
        "Authorization": f"Bearer {os.environ['BESDAY_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
      "url": "https://yourapp.com/webhooks/besday",
      "events": [
        "order.delivered",
        "order.completed",
        "order.cancelled"
      ],
      "description": "Production"
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
```

Response (201):

```json
{
  "object": "webhook_endpoint",
  "id": "we_3f9d0c8e",
  "url": "https://yourapp.com/webhooks/besday",
  "description": "Production",
  "events": [
    "order.delivered",
    "order.completed",
    "order.cancelled"
  ],
  "created_at": "2026-12-03T17:20:00.000Z",
  "secret": "whsec_Wq3m…(shown once)"
}
```

Errors: `parameter_invalid`, `url_not_allowed`, `limit_reached`.


## List webhook endpoints

`GET /api/v1/webhook_endpoints`

Your brand’s webhook endpoints (secrets are never shown again).

- Scope: `read`
- Returns: 200 a list of `webhook_endpoint` objects

cURL:

```bash
curl "https://besday.com/api/v1/webhook_endpoints" \
  -H "Authorization: Bearer $BESDAY_API_KEY"
```

Node.js:

```javascript
const res = await fetch("https://besday.com/api/v1/webhook_endpoints", {
  headers: {
    Authorization: `Bearer ${process.env.BESDAY_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
```

Python:

```python
import os, uuid, requests

res = requests.get(
    "https://besday.com/api/v1/webhook_endpoints",
    headers={
        "Authorization": f"Bearer {os.environ['BESDAY_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
```

Response (200):

```json
{
  "object": "list",
  "data": [
    {
      "object": "webhook_endpoint",
      "id": "we_3f9d0c8e",
      "url": "https://yourapp.com/webhooks/besday",
      "description": "Production",
      "events": [
        "order.delivered",
        "order.completed",
        "order.cancelled"
      ],
      "created_at": "2026-12-03T17:20:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```


## Delete a webhook endpoint

`DELETE /api/v1/webhook_endpoints/{id}`

Stops sending events to the endpoint. Pending deliveries to it are dropped.

- Scope: `read_write`
- Returns: 200 `deleted`

Path parameters:

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The endpoint id. |

cURL:

```bash
curl -X DELETE "https://besday.com/api/v1/webhook_endpoints/we_3f9d0c8e" \
  -H "Authorization: Bearer $BESDAY_API_KEY"
```

Node.js:

```javascript
const res = await fetch("https://besday.com/api/v1/webhook_endpoints/we_3f9d0c8e", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.BESDAY_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
```

Python:

```python
import os, uuid, requests

res = requests.delete(
    "https://besday.com/api/v1/webhook_endpoints/we_3f9d0c8e",
    headers={
        "Authorization": f"Bearer {os.environ['BESDAY_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
```

Response (200):

```json
{
  "object": "webhook_endpoint",
  "id": "we_3f9d0c8e",
  "deleted": true
}
```

Errors: `not_found`.


## Send a test event

`POST /api/v1/webhook_endpoints/{id}/test`

Sends a signed `ping` event now and reports what your endpoint answered.

- Scope: `read_write`
- Returns: 200 `webhook_test`

Path parameters:

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The endpoint id. |

cURL:

```bash
curl -X POST "https://besday.com/api/v1/webhook_endpoints/we_3f9d0c8e/test" \
  -H "Authorization: Bearer $BESDAY_API_KEY"
```

Node.js:

```javascript
const res = await fetch("https://besday.com/api/v1/webhook_endpoints/we_3f9d0c8e/test", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BESDAY_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
```

Python:

```python
import os, uuid, requests

res = requests.post(
    "https://besday.com/api/v1/webhook_endpoints/we_3f9d0c8e/test",
    headers={
        "Authorization": f"Bearer {os.environ['BESDAY_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
```

Response (200):

```json
{
  "object": "webhook_test",
  "endpoint_id": "we_3f9d0c8e",
  "event_id": "evt_77aa01",
  "delivered": true,
  "status_code": 200,
  "error": null
}
```

Errors: `not_found`.

