Template Docs Commerce APIs Webhooks Tools
Get Started
Get Started

Rotate a subscription secret

POST /api.squarespace.com/{api-version}/webhook_subscriptions/{id}/actions/rotateSecret

Rotates a webhook subscription's secret. The previous secret for a subscription is no longer valid after a new one is generated. The response contains information about the rotated secret.

Parameters

{api-version} string
required

See the Webhook Subscriptions API Overview page for the current API version.


{id} string
required

Specifies the Webhook Subscription to update.

Request example

Read the Overview to learn about specific API permissions. Every request should also abide by Squarespace rate limits.

curl "https://api.squarespace.com/1.0/webhook_subscriptions/123/actions/rotateSecret" \
  -i \
  -H "Authorization: Bearer YOUR_OR_OAUTH_TOKEN" \
  -H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION" \
  -H "Content-Type: application/json" \
  -X POST

Response example

A successful request generates a JSON response with the Webhook Subscription's rotated secret.

Note: For easier reference between response fields and descriptions, comments were added in the example, though this makes the JSON invalid.

{
  // Hexadecimal value used to generate a signature for a webhook notification;
  // field is only returned when creating a new subscription or rotating a secret.
  // Store the secret in a safe location to verify notifications from Squarespace.
  // See the 'Verifying notifications' guide under Webhooks for details.
  "secret": "F3F9B981C78E7A6187E42853F6CE2804177E98206164779423B02DEC981ACD6B"
}

Status codes and error conditions

200 OK

The request was successful. The message body contains data in the format specified above.


404 NOT FOUND

Type: INVALID_REQUEST_ERROR

Subtype: INVALID_ARGUMENT
The requested Webhook Subscription was not found.