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

# Organization webhook

> Receive the events of all your customer projects on a single webhook endpoint, each identified by project_id and external_ref.

With the Partner API, you do not need to register a webhook endpoint per customer. The **organization webhook** is a single endpoint that receives the events of **every** project in the organization.

Each event carries the `project_id` and the `external_ref` of the project it came from. You route by your own ID, without keeping a lookup table.

> [!WARNING]
>
> The Partner API is experimental in the SDK. The Node.js examples use `@routa-chat/sdk/partner`.

## Set the endpoint

`PUT /v1/partner/webhook` creates or replaces the endpoint. Required scope: `webhooks:write`.

```bash cURL theme={null}
curl -X PUT https://api.routa.chat/v1/partner/webhook \
  -H "Authorization: Bearer $ROUTA_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://crm.example.com/routa",
    "subscribed_types": ["message.*", "channel.status_changed"]
  }'
```

```ts Node.js theme={null}
import { RoutaPartner } from '@routa-chat/sdk/partner'

const partner = new RoutaPartner(process.env['ROUTA_PARTNER_KEY']!)

const { webhook, secret } = await partner.webhook.set({
  url: 'https://crm.example.com/routa',
  subscribedTypes: ['message.*', 'channel.status_changed'],
})
```

| Field | Description |
| - | - |
| `url` | `https://` address that receives the deliveries. The host must resolve to a public address. An invalid address responds `422 invalid_webhook_url`. |
| `subscribed_types` | List of event types or wildcards, with at least one item. An invalid value responds `422 invalid_subscribed_types`. |

In `subscribed_types`, use an exact event type, such as `message.delivered`, or the wildcard of a group: `message.*`, `channel.*` or `template.*`. A bare `*` is not accepted. See the types in [Event types](https://docs.routa.chat/en/webhooks/event-types.md).

## Creation and updates

`PUT` is idempotent:

* **On the first call**, Routa creates the endpoint and responds `201` with the signing secret. The secret is shown **only once**. Store it.
* **On later calls**, Routa replaces the URL and the types, re-enables the endpoint and responds `200`, without the secret. The existing secret does not change.

Re-enabling the endpoint with a `PUT` is how you bring it back after it was disabled for consecutive failures.

`GET /v1/partner/webhook` retrieves the endpoint and never returns the secret. If no endpoint was set, the response is `404 webhook_endpoint_not_found`.

## The envelope

The events have the same format as the events of a project. Two fields identify the customer:

| Field | Description |
| - | - |
| `project_id` | ID of the project the event came from. |
| `external_ref` | Your ID for the customer, or `null` when the project has no `external_ref`, such as projects created in the dashboard. |

```json theme={null}
{
  "id": "evt_01J8...",
  "type": "message.delivered",
  "api_version": "v1",
  "schema_version": 1,
  "project_id": "proj_01J8...",
  "external_ref": "lead_123",
  "sequence": 918273,
  "occurred_at": "2026-11-21T13:22:41.031Z",
  "recorded_at": "2026-11-21T13:22:41.120Z",
  "data": { "...": "..." }
}
```

See every field in [Events](https://docs.routa.chat/en/concepts/events.md).

The organization endpoint receives the events of every project in the organization, including projects created in the dashboard. For those, `external_ref` is `null`.

You can also keep webhook endpoints on individual projects. In that case, you receive both deliveries.

## Signatures and retries

Deliveries are signed, retried and replayed exactly like those of a project. Verify each one with the secret of the organization endpoint:

* [Verify signatures](https://docs.routa.chat/en/webhooks/signatures.md)
* [Retries and replay](https://docs.routa.chat/en/webhooks/retries-and-replay.md)

In the Node.js SDK, `partner.webhook.constructEvent()` verifies the signature and returns the typed event. See [Receive the events of every customer](https://docs.routa.chat/en/sdk/partner.md#receive-the-events-of-every-customer).

## Rotate the secret

`POST /v1/partner/webhook/rotate_secret` issues a new secret and returns it only once. The previous secret keeps signing deliveries for **24 hours**, so you can swap it without losing events. Required scope: `webhooks:write`.

```bash cURL theme={null}
curl -X POST https://api.routa.chat/v1/partner/webhook/rotate_secret \
  -H "Authorization: Bearer $ROUTA_PARTNER_KEY"
```

```ts Node.js theme={null}
const rotated = await partner.webhook.rotateSecret()

// rotated.secret is shown only once.
```

If no endpoint was set, the response is `404 webhook_endpoint_not_found`. An Owner or Admin can also see the state of the endpoint and rotate the secret in the dashboard, under **Settings**, on the **Partner** tab, in the **Webhook** section.

## Concurrency

An endpoint with many customers is the bottleneck of all of them. That is why Routa keeps at most **32 concurrent deliveries** to the organization endpoint, against 8 to the endpoint of a project. Answer fast and process the work on a queue on your side.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.