POST /v1/routines/{routine}/hooks/{hook_id}/rotate
Issues a new signing secret for a webhook trigger verified with the `b3os` scheme and returns it once. The previous secret keeps verifying deliveries for `grace_s` seconds (default one day) so senders can switch.

Authentication

Bearer Token (b3os_sk_ API key or b3os_pat_ token) API Key (cookie: __Host-b3os_session)

Path Parameters

routine string required path
A routine ID (`rtn_…`) or name. Names are unique per project; `runs`, `hooks`, `validate` and `import` are reserved and cannot be routine names.
Example: "nightly-digest"
hook_id string required path
The hook ID (`hk_…`).
Example: "hk_01m5t3r2qwz23751t0x74bhahz"

Request Body

application/json
grace_s integer

Responses

200 The new secret.
application/json
object string REQUIRED
Enum: hook_secret
hook_id string REQUIRED
secret string REQUIRED
previous_valid_until string (date-time) | null REQUIRED
400 The request failed validation (`invalid_request`, `invalid_url`).
401 Missing, malformed, expired or revoked credentials (`unauthorized`).
403 Authenticated but not allowed (`forbidden`, `egress_denied`).
404 No such hook (`hook_not_found`).
413 The request body exceeds this operation's limit.
415 The Content-Type is not accepted by this operation.
429 A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500 Something failed inside B3OS (`internal`). Retry with backoff.
503 The node or the product is not available right now (`node_unavailable`, `product_unavailable`, `capacity_unavailable`).
curl -X POST 'https://beta-api.b3os.org/v1/routines/nightly-digest/hooks/hk_01m5t3r2qwz23751t0x74bhahz/rotate' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "grace_s": 3600}'
const response = await fetch('https://beta-api.b3os.org/v1/routines/nightly-digest/hooks/hk_01m5t3r2qwz23751t0x74bhahz/rotate', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "grace_s": 3600  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/routines/nightly-digest/hooks/hk_01m5t3r2qwz23751t0x74bhahz/rotate', headers=headers, json={  "grace_s": 3600})print(response.json())
200 Response
{  "object": "hook_secret",  "hook_id": "hk_01m5t3r2qwz23751t0x74bhahz",  "secret": "whsec_ex4mple7ex4mple7ex4mple7ex4mple7",  "previous_valid_until": "2026-10-25T20:40:00.000Z"}
Ask a question... ⌘I