Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Response
Success, webhook created
Creates a new webhook subscription
The request must include:
data - parent object which includes the children/nested attributes:target_url - The URL where webhook events will be sentevent - The type of event to subscribe to (see available events below), for example “tag_added”resource_id (optional) - Specific resource ID to filter events for, for example the id of the Contact Tag. When the property is omitted, the webhook will be triggered for all events of the specified type, as a wildcard webhook.| Event | Description | Required API Scopes |
|---|---|---|
purchase | Customer makes a purchase | view:purchases |
payment_succeeded | Payment transaction completes successfully | view:transactions |
order_created | New order is created | view:transactions, view:orders |
form_submission | Someone submits a form | view:form_submissions |
tag_added | Tag is added to a contact | view:contacts |
tag_removed | Tag is removed from a contact | view:contacts |
Note: You can only create webhooks for events you have permission to access based on your API key scopes. For example to use tags you need the view:contacts scope, which is included in the account owner api key scope.
You can view sample webhook payloads for each event type:
GET /api/v1/hooks/purchase_sampleGET /api/v1/hooks/payment_succeeded_sampleGET /api/v1/hooks/order_created_sampleGET /api/v1/hooks/form_submission_sampleGET /api/v1/hooks/tag_added_sampleGET /api/v1/hooks/tag_removed_sampleExample request targeting a specific tag:
{
"data": {
"type": "hooks",
"attributes": {
"target_url": "https://example.com/webhook",
"event": "tag_added",
"resource_id": "123"
},
"relationships": {
"site": {
"data": {
"id": "456",
"type": "sites"
}
}
}
}
}
Example request using a wildcard webhook:
{
"data": {
"type": "hooks",
"attributes": {
"target_url": "https://example.com/webhook",
"event": "tag_added"
},
"relationships": {
"site": {
"data": {
"id": "456",
"type": "sites"
}
}
}
}
}
The actual payloads are sent to the target_url as a POST request with the following JSON body:
{
"id": "hash_id",
"event": "tag_added",
"payload": [],
}
The id is the ID of the resource that triggered the event.
The event is the type of event that triggered the webhook.
The payload is the actual payload of the event and the content will be similar to the sample payloads above.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Success, webhook created