Template Docs Commerce APIs Webhooks Tools
Get Started
Get Started

Update a webhook subscription

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

Updates information for a webhook subscription.

A successful request returns the updated Webhook Subscription resource.

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.

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.

Note: The endpoint supports partial updates so any field marked as "Optional" or "Conditional" may be omitted from the request.

curl "https://api.squarespace.com/1.0/webhook_subscriptions/123" \
  -i \
  -H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
  -H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{' \
  # Optional; string.
  # HTTPS URL to receive webhook notifications.
  '"endpointUrl": "https://example-extension.com/uninstall",' \
  # Optional; 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 updated 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"],
  // 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

200 OK

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


400 BAD REQUEST

Type: INVALID_REQUEST_ERROR

Subtype: INVALID_ARGUMENT
The request body does not conform to the required specification.