MessageOS
APIWebhooksIdRotate secret

Rotate a webhook signing secret

POST
/webhooks/{id}/rotate-secret

Makes a new signing secret for this endpoint and returns it once.

Answers 404 until MessageOS turns secret rotation on. Until then, remove the endpoint and add it again to get a new secret.

  • The old secret stops working at once, so put the new one in your receiver right away.
  • An attempt already under way may still carry the old signature. If your receiver refuses it, the event is retried with the new secret.
  • A paused endpoint can be rotated. A removed endpoint cannot.
  • When two rotations of one endpoint run at the same time, one secret is kept, and the other call returns 409 with no secret.

Scope: webhooks:manage.

Authorization

bearer
headerAuthorizationBearer <mosc_...>

A client key (mosc_).

Path Parameters

id*integer

The endpoint id.

Range0 < value

Response Body

The endpoint, with its new signing secret.

application/json
  1. response
id*integer
url*string
eventTypes*array<>
status*string

paused after repeated dead deliveries. disabled after DELETE, a 410 response, or a PATCH to disabled. An endpoint removed with DELETE cannot be changed again.

Value in"active""paused""disabled"
secret*string

The new signing secret. It is returned only once. The old secret no longer works.

Example request

curl -X POST 'https://api.messageos.ai/v1/webhooks/42/rotate-secret' \  -H 'Authorization: Bearer mosc_...'

Example response

{  "id": 3,  "url": "https://example.com/messageos/webhooks",  "eventTypes": [    "message.delivered"  ],  "status": "active",  "secret": "4e8a1d6c0b9f3e2a7c5d8b1f4a6e9c2d0b3f7a1e5c8d2b6f"}