For the complete documentation index, see llms.txt. This page is also available as Markdown.

POST /v2/webhooks/subscriptions

Create Webhook Subscription

post

Register a webhook endpoint and return its signing secret.

The secret is returned only here. It cannot be recovered later, so a caller that loses it has to delete the subscription and create a new one.

How to use

Configure and test an HTTPS receiver first. Capture the returned signing secret immediately; it is returned only at creation. Use an authorized administrator session for org.webhooks.manage, which is not an assignable restricted API-key scope. Verify event emission in your deployment before relying on callbacks.

Authentication and permissions

Required permissions: org.webhooks.manage. Resource and owner access checks also apply.

Prepare request.json

Save the example body below as request.json for the curl sample. Replace example IDs, node keys, and dynamic configuration with values for your organization; these are illustrative, not pre-existing resources.

{
  "url": "https://your-service.example.com/webhooks/stackai",
  "event_types": [
    "run.succeeded",
    "run.failed"
  ]
}
Authorizations
AuthorizationstringRequired

Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header.

Body

A new webhook subscription on the public v2 surface.

urlstringRequired

The HTTPS endpoint that receives the signed event payloads.

Responses
201

Successful Response

application/json
response_codestring · nullableOptional

Machine-readable response code, when provided.

post/v2/webhooks/subscriptions
curl
curl --fail-with-body -sS \
  "$STACKAI_BASE_URL/v2/webhooks/subscriptions" \
  -H "Authorization: Bearer $STACKAI_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @request.json
{
  "response_code": "text",
  "meta": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "data": {
    "subscription_id": "text",
    "url": "text",
    "event_types": [
      "run.started"
    ],
    "created_at": "2026-01-01T00:00:00.000Z",
    "secret": "text"
  }
}

Last updated

Was this helpful?