Skip to content

Admin API: Webhooks

Operations to create, change, and delete webhooks, and to send tests, view delivery history, and resend. Common rules (authentication, error format, dates and times) are in the Admin API reference.

The shape of the webhooks you receive and how to verify the signature are in Receive webhooks.

In the examples, replace <hostname> with the hostname of your environment and <access token> with an access token that starts with hako_pat_. Replace other values in angle brackets, such as <slug>, with the values described in each operation’s parameter table.

Operation Method and path
List webhooks GET /admin/api/spaces/{slug}/webhooks
Create a webhook POST /admin/api/spaces/{slug}/webhooks
Get a webhook GET /admin/api/spaces/{slug}/webhooks/{id}
Change webhook settings PATCH /admin/api/spaces/{slug}/webhooks/{id}
Delete a webhook DELETE /admin/api/spaces/{slug}/webhooks/{id}
Webhook delivery history GET /admin/api/spaces/{slug}/webhooks/{id}/deliveries
Resend a webhook delivery with the same body POST /admin/api/spaces/{slug}/webhooks/{id}/deliveries/{delivery_id}/redeliver
Send a test webhook POST /admin/api/spaces/{slug}/webhooks/{id}/test
GET /admin/api/spaces/{slug}/webhooks
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space

Responses:

Status Body Reason
200 Array of WebhookView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks" \
-H "Authorization: Bearer <access token>"
POST /admin/api/spaces/{slug}/webhooks
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space

Request body (application/json):

Name Type Required Constraints Description
contentTypeId string or null Send only events for this content type. If null, all content types and media
enabled boolean or null Whether to send. Default true
events array of strings or null Array of event names to send. Default [“entry.published”, “entry.deleted”]
headers object (string values) or null Custom headers (an object from name to value). Up to 20
name string Yes Name
preset string or null Format to send. Allowed values: custom, vercel, netlify, slack. Default custom
secret string or null Signing secret (8–256 characters)
url string Yes Destination (http:// or https://)

Responses:

Status Body Reason
201 WebhookView (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404
409 Error (application/json) A usage limit set by the operator was reached (the limit’s name and value are in limit in the body)
415 Error (application/json) Content-Type: application/json is missing
422 Error (application/json) The JSON has the wrong shape (a required key is missing, a type is wrong, or there is an unknown key)

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X POST "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks" \
-H "Authorization: Bearer <access token>" \
-H "Content-Type: application/json" \
-d '{
"name": "<name>",
"url": "<url>"
}'
GET /admin/api/spaces/{slug}/webhooks/{id}
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID

Responses:

Status Body Reason
200 WebhookView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks/<id>" \
-H "Authorization: Bearer <access token>"
PATCH /admin/api/spaces/{slug}/webhooks/{id}
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID

Request body (application/json):

Name Type Required Constraints Description
contentTypeId string or null Send only events for this content type. If null, all content types and media
enabled boolean or null Whether to send
events array of strings or null Array of event names to send
headers object (string values) or null Custom headers (an object from name to value). Up to 20
name string or null Name
preset string or null Format to send. Allowed values: custom, vercel, netlify, slack
secret string or null Signing secret (8–256 characters). Send null to remove the secret
url string or null Destination (http:// or https://)

Responses:

Status Body Reason
200 WebhookView (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404
415 Error (application/json) Content-Type: application/json is missing
422 Error (application/json) The JSON has the wrong shape (a required key is missing, a type is wrong, or there is an unknown key)

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X PATCH "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks/<id>" \
-H "Authorization: Bearer <access token>" \
-H "Content-Type: application/json" \
-d '{}'
DELETE /admin/api/spaces/{slug}/webhooks/{id}
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID

Responses:

Status Body Reason
204 None
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X DELETE "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks/<id>" \
-H "Authorization: Bearer <access token>"
GET /admin/api/spaces/{slug}/webhooks/{id}/deliveries
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID
limit query integer 0 or more Number of items
cursor query string nextCursor from the previous response

Responses:

Status Body Reason
200 DeliveriesResponse (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks/<id>/deliveries" \
-H "Authorization: Bearer <access token>"

Resend a webhook delivery with the same body

Section titled “Resend a webhook delivery with the same body”

Resends the same body as before (the deliveryId in the body is also the same as before) from the start, as a new delivery.

POST /admin/api/spaces/{slug}/webhooks/{id}/deliveries/{delivery_id}/redeliver
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID
delivery_id path string Yes Delivery ID

Responses:

Status Body Reason
202 DeliveryView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X POST "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks/<id>/deliveries/<delivery_id>/redeliver" \
-H "Authorization: Bearer <access token>"

Sends immediately and returns the result. Does not resend on failure.

POST /admin/api/spaces/{slug}/webhooks/{id}/test
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID

Responses:

Status Body Reason
200 DeliveryView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X POST "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/webhooks/<id>/test" \
-H "Authorization: Bearer <access token>"