Create a webhook endpoint
Registers an endpoint for the given event types. The response includes the signing secret; verify deliveries with any Standard Webhooks library.
POST
/webhooksRequest body
requiredapplication/jsonurlstring<uri>requiredeventsstring[]requiredmin items 1
Responses
200OK
idstringrequiredurlstringrequiredeventsstring[]requiredenabledbooleanrequiredcreatedAtstring<date-time>requiredsecretstringrequired400400
One of:
object
definedanyrequiredcodeanyrequiredstatusanyrequiredmessagestringrequireddefault: "Webhook URLs must be https (plain http is allowed for localhost)."
dataanyobject
definedanyrequiredcodestringrequiredstatusnumberrequiredmessagestringrequireddataany401401
One of:
object
definedanyrequiredcodeanyrequiredstatusanyrequiredmessagestringrequireddefault: "Authentication required. Pass an organization API key in the `x-api-key` header."
dataanyobject
definedanyrequiredcodestringrequiredstatusnumberrequiredmessagestringrequireddataany429429
One of:
object
definedanyrequiredcodeanyrequiredstatusanyrequiredmessagestringrequireddefault: "The organization's API request limit for this period has been reached."
dataanyobject
definedanyrequiredcodeanyrequiredstatusanyrequiredmessagestringrequireddefault: "Too many requests. Try again shortly."
dataanyobject
definedanyrequiredcodestringrequiredstatusnumberrequiredmessagestringrequireddataanyRequest
curl -X POST "https://stetcms.com/api/v1/webhooks" \
-H "Content-Type: application/json" \
-d '{
"url": "<uri>",
"events": [
"content.changed"
]
}'const response = await fetch("https://stetcms.com/api/v1/webhooks", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"url": "<uri>",
"events": [
"content.changed"
]
})
});Response
{
"id": "string",
"url": "string",
"events": [
"content.changed"
],
"enabled": true,
"createdAt": "2024-01-01T00:00:00Z",
"secret": "string"
}{
"defined": true,
"code": "BAD_REQUEST",
"status": 400,
"message": "Webhook URLs must be https (plain http is allowed for localhost).",
"data": "string"
}{
"defined": true,
"code": "UNAUTHORIZED",
"status": 401,
"message": "Authentication required. Pass an organization API key in the `x-api-key` header.",
"data": "string"
}{
"defined": true,
"code": "QUOTA_EXCEEDED",
"status": 429,
"message": "The organization's API request limit for this period has been reached.",
"data": "string"
}