Create a webhook subscription
POST /api.squarespace.com/{api-version}/webhook_subscriptions
Creates a webhook subscription.
A successful request returns the created Webhook Subscription
resource.
Parameters
{api-version}
string
required
See the Webhook Subscriptions API Overview page for the current API version.
Request example
Read the Overview to learn about specific API permissions. Every request should also abide by Squarespace rate limits.
OAuth tokens and subscriptions
Some subscriptions require OAuth access permissions to specific APIs.
For example, order events (e.g., "topic": "order.create"
) require access to the Orders API.
curl "https://api.squarespace.com/1.0/webhook_subscriptions" \
-i \
-H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
-H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION" \
-H "Content-Type: application/json" \
-X POST \
-d '{' \
# Required; string.
# HTTPS URL to receive webhook notifications.
'"endpointUrl": "https://example-extension.com/uninstall",' \
# Required; array of enum strings, array cannot be empty.
# List of event topics that trigger a webhook notification.
# Possible values include: `extension.uninstall`, `order.create`, `order.update`.
'"topics": ["extension.uninstall"],' \
'}'
Response example
A response to a successful request will contain the created Webhook Subscription
.
Note: For easier reference between response fields and descriptions, comments were added in the example, though this makes the JSON invalid.
{
// Unique Webhook Subscription id.
"id": "7aff04bb-90e0-4002-96c2-69d8162c8dae",
// HTTPS URL to receive webhook notifications.
"endpointUrl": "https://example-extension.com/uninstall",
// List of event topics that trigger a webhook notification.
// Possible values include: `extension.uninstall`, `order.create`, `order.update`.
"topics": ["extension.uninstall"],
// 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",
// ISO 8601 UTC date and time string; represents when the webhook subscription was created.
"createdOn": "2020-04-22T22:18+00:00",
// ISO 8601 UTC date and time string; represents when the webhook subscription was last modified.
"updatedOn": "2020-04-22T22:18+00:00"
}
Status codes and error conditions
201 CREATED
The request was successful. The message body contains data in the format specified above.
400 BAD REQUEST
Type: INVALID_REQUEST_ERROR
Subtype: null
The request body does not conform to the required specification.
409 CONFLICT
Type: CONFLICT
Subtype: WEBHOOK_SUBSCRIPTION_LIMIT_REACHED
The Squarespace website has reached its limit of 25 webhook subscriptions.