> ## 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.

# Partner keys

> Scopes, expiry, address restriction and rotation of partner keys, and what each one can do.

The **partner key** (`rt_partner_…`) authenticates the [Partner API](https://docs.routa.chat/en/partners/overview.md). It is an organization credential: it reaches **every** customer project you created. Treat it as an administrator credential.

## Partner key and project key

| | Partner key | Project key |
| - | - | - |
| Format | `rt_partner_…` | `rt_live_…` or `rt_test_…` |
| Valid on | `/v1/partner/*` routes | Data routes (`/v1/messages`, `/v1/events` and the others) |
| Sends messages | Never | Yes, with the `messages:write` scope |
| Who issues it | A person, in the dashboard | You, through the Partner API, or a person, in the dashboard |

A partner key on a data route responds `401 api_key_invalid`. A project key on a `/v1/partner/*` route responds `401 partner_key_invalid`.

## Scopes

A new key only has `projects:read` and `projects:write`. The other scopes are opt-in: ask for each one on purpose.

| Scope | Default | What it allows |
| - | - | - |
| `projects:read` | Yes | List and retrieve projects and list channels. |
| `projects:write` | Yes | Create and rename projects. |
| `api_keys:write` | No | Issue, rotate and revoke project API keys. |
| `webhooks:write` | No | Retrieve, set and rotate the secret of the [organization webhook](https://docs.routa.chat/en/partners/webhook.md). There is no read-only scope for it. |
| `channels:write` | No | Delete a disabled channel. |
| `projects:delete` | No | Delete a project created through the Partner API. |

Without the required scope, the response is `403 insufficient_scope`.

> [!WARNING]
>
> With `api_keys:write`, a leaked key can issue a project key with `messages:write` for **any** of your customers, and so send messages on behalf of all of them. Grant this scope only when you need it, and combine it with an address restriction and an expiry.

## Address restriction and expiry

* **`expires_at`.** The key stops being valid from that moment.
* **`ip_allowlist`.** Lists the addresses the key can be used from. IPv4 accepts an exact address or a CIDR range. IPv6 is compared by the exact string only, with no ranges. An empty list means no restriction.

A key used from a blocked address gets the same response as an unknown key: `401 partner_key_invalid`.

Restrict the key to the addresses of your servers and set an expiry. You set these options in the dashboard, where the key is issued.

## Rotation and revocation

* **Rotation.** The dashboard issues a new key before you revoke the old one, so both values work during the swap.
* **Revoking deletes the key.** Once revoked, the key no longer exists. Revoking it again says it does not exist.

You issue, list, rotate and revoke partner keys in the dashboard, as an Owner or Admin. A partner key does **not** manage partner keys, the signing secret or the redirect origins.

## What a partner key reaches

Only projects the Partner API itself created, that is, projects with an `external_ref`. Projects you created in the dashboard respond `404 project_not_found` on these routes. The exception is [`GET /v1/partner/webhook`](https://docs.routa.chat/en/api-reference/endpoint/partner/retrieve-webhook), which belongs to the organization.

The key never reads an existing secret (secrets are shown only once) and never sends messages. Everything it does is recorded in the audit log, with the key as the author.

## Delete a disabled channel

`DELETE /v1/partner/projects/{project_id}/channels/{channel_id}` deletes a channel. Required scope: `channels:write`.

```bash cURL theme={null}
curl -X DELETE https://api.routa.chat/v1/partner/projects/proj_01J8.../channels/chan_01J8... \
  -H "Authorization: Bearer $ROUTA_PARTNER_KEY"
```

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

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

await partner.channels.delete(projectId, channelId)
```

Only a `disabled` channel can be deleted. Any other responds `409 channel_not_disabled`. The deletion removes the channel, its credential and its templates, and frees the number. Messages, usage and events remain and keep referring to the channel. Nothing changes on WhatsApp.

A project or channel that does not belong to your organization responds `404`.

Use this when a customer's project cannot be deleted because of a disabled channel: delete the channel and then the project. See [Onboard a customer](https://docs.routa.chat/en/partners/onboarding.md#6-delete-a-customer-project-to-free-the-slot).

## Rate limit

All `/v1/partner/*` routes share one limit per organization: 10 requests per second, with a burst of up to 30. Above it, the API responds `429` with the `Retry-After` header.


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