Create a webhook subscription
const url = 'http://localhost:8000/webhooks';
const options = {
method: 'POST',
headers: {'API-Key': '<API-Key>', 'Content-Type': 'application/json'},
body: '{"name":"example","url":"https://example.com","source":"keycloak","event_types":["example"],"signing_secret":"example","enabled":true,"cluster_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","realm_id":"123e4567-e89b-12d3-a456-426614174000","authorization_header":"example"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}curl --request POST \
--url http://localhost:8000/webhooks \
--header 'API-Key: <API-Key>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "url": "https://example.com", "source": "keycloak", "event_types": [ "example" ], "signing_secret": "example", "enabled": true, "cluster_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "realm_id": "123e4567-e89b-12d3-a456-426614174000", "authorization_header": "example" }'Creates a webhook subscription. Secrets are write-only and are never returned.
url must include an endpoint path (https://api.example.com/webhooks/events); a bare origin is rejected with 422 because no route on your server would receive the delivery.
cluster_id must name a cluster in your workspace, and realm_id a realm on that cluster; either one unknown returns 404. A realm_id sent without a cluster_id must be a realm on one of your workspace’s clusters. Omit both to subscribe to every cluster in the workspace.
Required scope: webhooks:write
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Delivery endpoint. Must be an http or https URL that includes an endpoint path, for example https://api.example.com/webhooks/events. A bare origin with no path (or a path of just /) is rejected.
Keycloak realm ID. This is a UUID generated by Keycloak.
Example
123e4567-e89b-12d3-a456-426614174000Responses
Section titled “Responses”The request has succeeded and a new resource has been created as a result.
Saved webhook subscription for the authenticated workspace.
object
Example
{
"source": "keycloak"
}The server could not understand the request due to invalid syntax.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Access is unauthorized.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Client error
Returned when a workspace plan quota would be exceeded. required_plan indicates the minimum plan needed to complete the request.
object
Machine-readable identifier of the quota that was hit, so a client can tell
quotas apart without parsing detail. Known values include cluster_limit
(the workspace’s total cluster allowance), cluster_size_quota (the
allowance for the requested cluster size) and cluster_size (the requested
size is not offered on the plan at all). New values may be added.
How many of the resource the workspace currently has.
Maximum allowed by the current plan. 0 means the plan does not include the resource at all.
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com",
"current_plan": "example",
"required_plan": "example",
"code": "example",
"current_usage": 1,
"current_limit": 1
}Access is forbidden.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}The server cannot find the requested resource.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Client error
object
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com",
"errors": [
{
"field": "example",
"detail": "example",
"code": "example",
"value": "example"
}
]
}Client error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Headers
Section titled “Headers”Server error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Server error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}