Create a webhook endpoint (admin)
const url = 'https://example.com/v1/orgs/example/webhooks';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"format":"standard","url":"example","description":"example","event_types":["finding.new"],"locale":"en","header_name":"example","header_value":"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 https://example.com/v1/orgs/example/webhooks \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "format": "standard", "url": "example", "description": "example", "event_types": [ "finding.new" ], "locale": "en", "header_name": "example", "header_value": "example" }'The API checks the URL (https, a host name, port 443 or 8443, no user info, and every address the host resolves to public), seals it, the generated secret and the header value to the worker’s key, and answers with the secret: the only time it is shown. Event types default to every finding type and release.matched (the chat formats slack, teams and google_chat: finding.known_exploited and release.matched); proposal.filed and org.feed_subscription_changed only when listed. The language defaults to the creator’s. The format decides the hosts the URL may name (teams: logic.azure.com or api.powerplatform.com subdomains; google_chat: chat.googleapis.com; github_dispatch: api.github.com with the path /repos/{owner}/{repo}/dispatches, and it needs the extra header Authorization: Bearer …). The worker checks them again when it sends. At most 10 per organization.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Organization (tenant) slug, e.g. alpenrobotik
Request Bodyrequired
Section titled “Request Bodyrequired”object
What the request body looks like and which hosts it may go to. It can’t change after create. webhook.formatUnavailable is no longer answered (an unknown format is request.invalid).
Https, a host name, port 443 or 8443, no user info or fragment
Default every finding type and release.matched
A language Affectra is available in
An extra header for receivers that take a token that way: Authorization or an X- name, not one Affectra sets (webhook-*, Content-Type, Host and the like)
Sealed; never shown again
Responses
Section titled “Responses”Created, with the secret
object
What the request body looks like and which hosts it may go to. It can’t change after create. webhook.formatUnavailable is no longer answered (an unknown format is request.invalid).
The scheme, the host and the last four characters of the path; never the URL
A language Affectra is available in
The extra header’s name; its value is never shown
Why it is off: an admin turned it off, the receiver answered 410 Gone, or every delivery failed for 3 days
After a rotation, deliveries are signed with the previous secret too until then
The user who created it
Whsec_ and 32 random bytes in base64, for Standard Webhooks signatures. Shown only in this answer.
Example
{ "format": "standard", "event_types": [ "finding.new" ], "locale": "en", "disabled_reason": "admin"}Webhook.urlRejected (params.reason; format_host and format_path name the format’s host and path rules), webhook.headerInvalid (params.reason; github_required and github_bearer for github_dispatch), webhook.eventTypesInvalid (params.type), locale.invalid, request.fieldRequired, request.invalid, or request.invalidJson
Auth.roleTooLow, or auth.csrfMissing (no X-Affectra-CSRF header)
No such object in this organization, no such organization, or the caller does not belong to it
Webhook.limitReached (params.limit): the organization has 10 endpoints
Over the operation’s rate-limit budget (x-affectra-budget): code request.rateLimited with params.budget. Wait Retry-After seconds before trying again.
Every error answer, Content-Type
application/problem+json. The web app and integrations translate code; detail is English,
for people reading curl output or CI logs, and may change wording at
any time. Match on code, never on detail.
object
The HTTP status
Stable error codes. A code is never renamed; new ones may be added, so
a client falls back to detail for a code it doesn’t know. Another
organization’s object answers notFound, the same as a missing one.
What went wrong
Values the code’s message needs, e.g. {“field”: “version”}. Only values the caller sent or may see. Empty when the message needs none.
object
Example
{ "code": "notFound"}Headers
Section titled “Headers”Seconds until a request would be allowed again, at least 1
Notifications.unavailable (no database