Rotate a webhook endpoint's secret
const url = 'https://api.example.com/v1/webhook_endpoints/example/rotate_secret';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.example.com/v1/webhook_endpoints/example/rotate_secret \ --header 'Authorization: Bearer <token>'Issues a new signing secret, returned on this response only. For 24 hours deliveries carry a signature made with each, so your receiver can switch over without dropping an event.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The object’s id.
Responses
Section titled “Responses”The endpoint, with its new secret.
object
The signing secret, whsec_.... Returned on create and rotate only.
A Unix timestamp.
Example
{ "id": "we_3f9a1c2b7d4e5f60718293a4", "object": "webhook_endpoint", "status": "enabled"}authentication_failure: access_token_required when no token was sent, invalid_access_token when it is not valid, has expired, or is a client secret. Sent with a WWW-Authenticate: Bearer header, which adds error="invalid_token" when a token was sent.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}authorization_failure with merchant_mismatch: a Merchant-Id header, query parameter or body field names a merchant or tenant other than the key’s.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}not_found: resource_missing for an id this key cannot see, route_missing for a path that does not exist.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}dependency_failure with service_unavailable: something on our side did not answer, or failed part-way. Whether the secret was rotated is not known, and a new secret is shown only in the answer you did not get. This call takes no Idempotency-Key: send it again, and it rotates again, so use the secret in the answer you receive. A secret the unanswered call made, or the one before it, keeps signing for 24 hours and then stops.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}