Create webhook
Method POST
https://my.easyweek.io/api/public/v2/webhooks
Description: This endpoint registers a webhook. When any of the subscribed events occurs, EasyWeek sends an HTTP request to url. A workspace has a maximum number of webhooks; exceeding it returns 422.
Example Request
curl -i -X POST \
https://my.easyweek.io/api/public/v2/webhooks \
-H 'Authorization: Bearer <YOUR_SECRET>' \
-H 'Workspace: <YOUR_WORKSPACE>'
Request body
{
"url": "https://example.com/hooks/easyweek",
"method": "post",
"events": ["booking-created", "booking-canceled"],
"success_statuses": [200, 201],
"headers": [],
"parameters": [],
"send_notification": false,
"emails": [],
"description": "My webhook"
}
Body Parameters
- url (string, required): The callback URL. Must be unique per event set within the workspace.
- method (string, required): The HTTP method used for the callback —
getorpost. - success_statuses (array, required): HTTP status codes that count as a successful delivery, e.g.
[200, 201]. - events (array, optional): The events to subscribe to. One or more of
booking-created,booking-updated,booking-succeeded,booking-canceled,booking-rescheduled,goods-sold. - headers (array, optional): Custom headers sent with the callback.
- parameters (array, optional): Extra parameters sent with the callback.
- send_notification (boolean, optional): Whether to email on delivery failures.
- emails (array, optional): Notification recipients. Required when
send_notificationistrue. - description (string, optional): A human-readable description.
info
success_statuses also accepts a comma-separated string: "200, 201" is equivalent to [200, 201]. In responses the field is always returned as a comma-separated string.
Example Response
{
"id": 12,
"url": "https://example.com/hooks/easyweek",
"method": "post",
"description": "My webhook",
"success_statuses": "200, 201",
"status": "enabled",
"send_notification": false,
"emails": "",
"events": ["booking-created", "booking-canceled"],
"parameters": [],
"headers": [],
"tries": 3,
"timeout": 10
}