POST /v2/webhooks/subscriptions
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"
]
}Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header.
A new webhook subscription on the public v2 surface.
The HTTPS endpoint that receives the signed event payloads.
Successful Response
Machine-readable response code, when provided.
Validation Error
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?

