---
docId: doc_4d3f96e5f9e94f9599cecc05e9501342
title: Bind secrets
description: "Bind existing secrets to webhook credentials."
api:
  group: webhooks
  auth: bearer
  operations:
    - operationId: bindWebhookSecret
      method: POST
      path: '/v1/webhooks/{webhookId}/secrets'
      postmanName: Bind a secret to a webhook
---

<script>
  import { Ways, Collapsible } from '$lib/components';
</script>

# Bind secrets

Bind a workspace [secret](/api-reference/secrets) to a webhook slot. Use it to:

- reuse a credential across several webhooks without sending its value every time,
- reauthorize a slot in `needs_authorization` after changing the destination.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/webhooks/$WEBHOOK_ID/secrets \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "slot": "webhook.secret", "secretId": "secret_123" }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.webhooks.bindSecret("webhook_123", { slot: "webhook.secret", secretId: "secret_123" });
```

</Ways.Way>
</Ways>

If you prefer to send the value, use `secret` or `headers` in [update a webhook](/api-reference/webhooks/update): Platica creates the secret and binds it for you.

If your credential covers several workspaces, add `?workspace=<id>` with the webhook's workspace ([list workspaces](/api-reference/workspaces)); without it the answer is `400`.

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `webhookId` | string | Webhook id | ✓ |

## Request body

```json
{
  "slot": "webhook.secret",
  "secretId": "a1c3e5f7092b4d6f8a0c2e4f6b8d0a1c3e5f7092b4d6f8a0c2e4f6b8d0a1c3e5"
}
```

## Body parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `slot` | string | The slot: `webhook.secret` for the signature, or `header:<name>` for a webhook header, with the name in lowercase | ✓ |
| `secretId` | string | Secret id, from [list secrets](/api-reference/secrets/list) or [create a secret](/api-reference/secrets/create) | ✓ |

## Response

`data` contains the complete webhook, with the fields from [get a webhook](/api-reference/webhooks/get#response-fields). The slot becomes `authorized`.

```json
{
  "status": "success",
  "message": "Secret bound successfully",
  "data": {
    "id": "webhook_abc123",
    "name": "Notifications webhook",
    "url": "https://hooks.example.com/platica",
    "events": [
      "conversation.created",
      "message.created"
    ],
    "active": false,
    "hasSecret": true,
    "headers": {
      "Custom-Header": "custom value"
    },
    "createdAt": "2026-10-28T12:05:00.000Z",
    "updatedAt": "2026-11-03T18:44:02.000Z",
    "creationDate": "2026-10-28T12:05:00.000Z",
    "lastUpdate": "2026-11-03T18:44:02.000Z",
    "lastDeliveryAt": "2026-11-03T17:42:10.000Z",
    "lastDeliveryStatus": "success",
    "lastDeliveryCode": 200,
    "lastDeliveryError": null,
    "status": "pending_verification",
    "version": 7,
    "verified": false,
    "secrets": [
      {
        "slot": "webhook.secret",
        "state": "authorized",
        "secretId": "a1c3e5f7092b4d6f8a0c2e4f6b8d0a1c3e5f7092b4d6f8a0c2e4f6b8d0a1c3e5"
      }
    ],
    "workspaceId": "ws_123",
    "nextStep": "Inactive. Activate it with PATCH /v1/webhooks/webhook_abc123 and { \"active\": true }; the destination is verified first."
  }
}
```

## Errors

<Collapsible summary="Show error codes and fixes">

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | `slot` or `secretId` is missing. `details.issues` says which |
| `400` | `INVALID_REQUEST` | Your credential covers several workspaces and you did not send `?workspace=`, or you sent one it does not cover. `details.available` carries the IDs you can use |
| `400` | `SECRET_SLOT_INVALID` | That slot does not exist in the webhook: the header is not configured, or it is `Content-Type`, `User-Agent`, or an `X-Webhook-*` |
| `400` | `SECRET_DESTINATION_INVALID` | The webhook URL is not `https` or is not valid |
| `401` | `UNAUTHENTICATED` | The credential is missing or invalid |
| `403` | `FORBIDDEN` | An OAuth token without the `platica:write` scope, the person does not have the Integrations module (the message is `Missing integrations permission`), cannot use secrets, or does not have permission to configure webhooks |
| `404` | `SECRET_NOT_FOUND` | The secret does not exist in this workspace |
| `404` | `NOT_FOUND` | The webhook does not exist in the workspace |
| `409` | `SECRET_USE_REVOKED` | The secret is revoked or expired |
| `409` | `SECRET_CHANGED` | The secret changed while it was being bound. Repeat the call |
| `409` | `RESOURCE_CHANGED` | The webhook changed while it was being bound. Repeat the call |

```json
{
  "code": 400,
  "error": "Bad Request - The request has validation errors",
  "details": {
    "code": "SECRET_SLOT_INVALID",
    "message": "Esa ranura no existe en la configuración actual."
  }
}
```

The general error format is in [Errors](/api-reference/errors).

</Collapsible>

## Notes

- After binding, activate the webhook with [test a webhook](/api-reference/webhooks/test) or send `{ "active": true }` in [update a webhook](/api-reference/webhooks/update). Binding alone does not activate it.
- The secret is authorized for that slot and for the webhook's current destination. If you change `url` to another domain, you have to bind again.
- To bind `header:<name>`, the header has to exist in the webhook's `headers`. Add it with an empty value in [update a webhook](/api-reference/webhooks/update).
- With `webhook.secret` bound, every delivery is signed with the value of that secret. Your server must validate with the same value: see [Delivery and signatures](/api-reference/webhooks/signatures).
