# Webhooks

> Outgoing webhooks, signed, retried, with a delivery log: 10 endpoints of the Teemli API.

Source: https://docs.teemli.com/developers/reference/webhooks/

Generated from [`api/openapi.yaml`](/developers/api/) (OpenAPI 3.1). Base URL: `https://api.teemli.com`. Auth: `Authorization: Bearer <token or tml_ API key>`. Errors are `application/problem+json`; writes accept an `Idempotency-Key` header.

Outgoing webhooks, signed, retried, with a delivery log

## My webhooks

```http
GET /v1/orgs/{org}/webhooks
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Webhooks — object

## Create a webhook (the signing secret is shown once)

```http
POST /v1/orgs/{org}/webhooks
```

The URL must be https on a public address (checked now and before each delivery; no redirects).

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `url` (required) | string (uri) |  |
| `description` | string |  |
| `events` (required) | array of WebhookEventType |  |
| `filters` | WebhookFilters | Optional narrowing; an empty or missing list matches everything. |

**Responses**

- `201` Created — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `422` Invalid input — Problem

## The events a webhook can subscribe to, and how deliveries are signed

```http
GET /v1/orgs/{org}/webhooks/events
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Events — object

## A webhook

```http
GET /v1/orgs/{org}/webhooks/{id}
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `200` The webhook — Webhook
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Change a webhook (enabling it again resets its failure count)

```http
PATCH /v1/orgs/{org}/webhooks/{id}
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `url` | string (uri) |  |
| `description` | string |  |
| `events` | array of WebhookEventType |  |
| `filters` | WebhookFilters | Optional narrowing; an empty or missing list matches everything. |
| `enabled` | boolean |  |

**Responses**

- `200` The webhook — Webhook
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `422` Invalid input — Problem

## Delete a webhook

```http
DELETE /v1/orgs/{org}/webhooks/{id}
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Deleted
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Replace the signing secret (shown once)

```http
POST /v1/orgs/{org}/webhooks/{id}/rotate-secret
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `200` The webhook and its new secret — object
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Send a test event (`ping`)

```http
POST /v1/orgs/{org}/webhooks/{id}/test
```

Queued and sent by the worker within seconds; watch the delivery log. Test events aren't retried.

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `202` Queued — WebhookDelivery
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## The delivery log (newest first)

```http
GET /v1/orgs/{org}/webhooks/{id}/deliveries
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |
| `limit` | query | integer | Page size. |
| `cursor` | query | string | Opaque cursor from a previous page's `next_cursor`. |

**Responses**

- `200` A page — object

## Send a failed delivery again

```http
POST /v1/orgs/{org}/webhook-deliveries/{id}/retry
```

**API keys:** needs the `webhooks:manage` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `200` Queued again — WebhookDelivery
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem
