Skip to content

Create a webhook endpoint (admin)

POST
/v1/orgs/{org}/webhooks
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.

org
required
string

Organization (tenant) slug, e.g. alpenrobotik

Media typeapplication/json
object
format

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).

string
Allowed values: standard github_dispatch slack teams google_chat
url
required

Https, a host name, port 443 or 8443, no user info or fragment

string
<= 2048 characters
description
string
<= 200 characters
event_types

Default every finding type and release.matched

Array<string>
Allowed values: finding.new finding.known_exploited finding.resolved release.matched proposal.filed org.feed_subscription_changed
locale

A language Affectra is available in

string
Allowed values: en de fr it
header_name

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)

string
<= 64 characters
header_value

Sealed; never shown again

string
<= 2048 characters

Created, with the secret

Media typeapplication/json
object
id
required
string format: uuid
format
required

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).

string
Allowed values: standard github_dispatch slack teams google_chat
url_display
required

The scheme, the host and the last four characters of the path; never the URL

string
description
required
string
event_types
required
Array<string>
Allowed values: finding.new finding.known_exploited finding.resolved release.matched proposal.filed org.feed_subscription_changed
locale
required

A language Affectra is available in

string
Allowed values: en de fr it
header_name
required

The extra header’s name; its value is never shown

string | null
enabled
required
boolean
disabled_reason
required

Why it is off: an admin turned it off, the receiver answered 410 Gone, or every delivery failed for 3 days

string | null
Allowed values: admin gone failing
previous_secret_expires_at
required

After a rotation, deliveries are signed with the previous secret too until then

string | null format: date-time
created_by

The user who created it

string
created_at
required
string format: date-time
updated_at
required
string format: date-time
secret
required

Whsec_ and 32 random bytes in base64, for Standard Webhooks signatures. Shown only in this answer.

string

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.

Media typeapplication/problem+json

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
status
required

The HTTP status

integer
code
required

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.

string
Allowed values: notFound internal request.invalidJson request.invalid request.alreadyExists request.timeInvalid auth.required auth.csrfMissing email.invalid accounts.passwordUnavailable locale.invalid request.rateLimited auth.sessionRequired auth.roleTooLow auth.githubTokenUploadOnly org.suspended org.required request.fieldRequired request.textInvalid request.timeout server.notReady catalog.unavailable report.invalid report.wrongTenant settings.csafNamespaceInvalid settings.digestHourInvalid settings.timeZoneInvalid sbom.invalid sbom.limitExceeded sbom.signatureInvalid sbom.signatureRequired sbom.signatureUnavailable upload.hardwareRevisionRenamed upload.malformed upload.unexpectedPart upload.sbomMissing upload.tooLarge upload.unreadable provenance.invalid provenance.sbomAttestation provenance.signatureRequired provenance.unavailable vex.vulnerabilityInvalid vex.statusInvalid vex.justificationUnknown vex.justificationNotAllowed vex.justificationRequired vex.actionRequired vex.statementTooLong vex.csafNamespaceRequired vex.csafNoStatements release.hasVexStatements finding.refInvalid mapping.purlInvalid mapping.purlVersioned mapping.purlCoveredByOsv mapping.cpeFieldInvalid mapping.builtIn mapping.csafProviderUnknown mapping.csafKindInvalid mapping.csafValueInvalid feeds.notSubscribable accounts.setupEmailLimit member.exists member.joined member.roleInvalid member.ownerGrantDenied member.ownerChangeDenied member.ownerRemoveDenied member.lastOwner github.orgInvalid github.teamInvalid github.roleInvalid github.adminRequired key.nameInvalid key.roleInvalid key.purposeInvalid product.keyInvalid product.keyExists product.keyLocked product.supportEndsInvalid alias.reportedInvalid alias.exists publisher.repositoryInvalid publisher.fieldTooLong publisher.idsIncomplete publisher.repositoryNotFound publisher.githubUnreachable publisher.workflowInvalid publisher.refPatternPrefix publisher.refPatternInvalid publisher.exists graph.vulnerabilityUnknown graph.timeout proposal.evidenceUnknown proposal.evidenceTooLarge proposal.kindInvalid proposal.basisInvalid proposal.notCarryOver proposal.basisMismatch proposal.notPending proposal.sourceSuperseded proposal.ownProposal proposal.fourEyes proposal.personRequired proposal.batchTooLarge proposal.vulnerabilityChanged proposal.reportedChanged proposal.releaseUnknown proposal.evidenceMissing notifications.unavailable notifications.findingsInvalid notifications.tokenInvalid webhook.urlRejected webhook.limitReached webhook.formatUnavailable webhook.headerInvalid webhook.eventTypesInvalid webhook.disabled events.cursorInvalid
detail
required

What went wrong

string
params
required

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
key
additional properties
any

Example

{
"code": "notFound"
}
Retry-After
integer
>= 1

Seconds until a request would be allowed again, at least 1

Notifications.unavailable (no database