notification configuration; see Run Agents with Triggers. These three notification mechanisms are independent of one another.
Register an endpoint
Use a project API key to manage Webhooks. Session work tokens and environment work keys cannot be used to manage Webhooks, and queries return only configurations belonging to the current project.Create a Webhook
CallPOST /v1/webhooks with the receiver URL and the events to subscribe to:
Prepare the receiver and enable the Webhook
The receiver must be an absolute HTTPS URL with a non-empty hostname. The default port is 443, and an explicit port must be between 1 and 65535. Domain names, IPv4/IPv6 literals, paths, and query parameters are supported. Userinfo, fragments, and IPv6 zone IDs are not accepted. Public targets are allowed by default, while loopback, link-local, cloud provider metadata, and other special-purpose addresses are rejected. The platform performs standard TLS certificate validation and does not follow redirects. Once your receiver is ready, callPATCH /v1/webhooks/{id} to explicitly enable the Webhook:
Verify the signature
Every HTTPS POST includes the following headers:whsec_<base64> secret format follow the Standard Webhooks specification. To verify a signature, strip the whsec_ prefix and decode the standard Base64 value to recover the 32-byte key. Use that key to compute HMAC-SHA256 over event ID + "." + timestamp + "." + raw request body bytes.
The example below shows a Node.js receiver with no web framework dependencies:
Node.js receiver example
Node.js receiver example
Handle events
The notification envelope contains the fixedtype: event, a unique event id, the occurrence time created_at, and the resource payload data:
id identifies the event, while data.id identifies the resource that changed. Different changes to the same resource produce different event IDs. project_id identifies the project that persistently owns the resource.
Receivers should process notifications in this order:
- Verify the signature and timestamp against the raw request body before parsing the JSON.
- Deduplicate by the top-level event
id. - Return any 2xx response once the event is reliably received, and handle time-consuming business logic asynchronously.
- Query the latest resource state using
data.typeanddata.idbefore updating business data. Late historical notifications must not overwrite newer resource state; treat a deletion notification as the final signal that the resource was permanently deleted.
Supported event types
When creating a Webhook, specify the events to subscribe to inevent_types. Each configuration must subscribe to at least one event type, without duplicates. For complete payload fields, see the Webhooks group and the Send a Webhook event callback in the API reference.
- Sessions and child threads
- Vaults and credentials
- Agents
- Triggers
- Trigger runs
- Execution environments
- Memory stores
Session events describe the state of the whole session, while child thread events describe an individual child thread. The resource ID in a child thread event is the child thread ID, and
session_id identifies the parent session.The initial
idle state at session creation does not send a separate notification. session.status_idled and session.thread_idled carry a stop reason of end_turn, canceled, internal_error, or requires_action; writes without an explicit reason do not emit these events.When a session is archived, separate notifications are sent for the session and for each child thread that actually terminates, but no event is sent for the coordinator thread. A single property-update transaction emits session.updated only once. An automatic title emits this event only when the previous title was empty and the title was written successfully. The deletion event retains the session ID and project ownership from before deletion as the final signal that the session was permanently deleted.Delivery behavior
- Duplicate deliveries: The same event may arrive more than once. All targets and retries for an event share the same top-level
id, which also matchesWebhook-Id. - Subscription scope: Each delivery task is created after the resource change is committed and captures the target’s URL and signing secret at that moment. Later configuration changes do not affect tasks that have already been created.
- Delivery order: Events are not guaranteed to arrive in the order they occurred. Drive business logic from the latest state returned by the resource API rather than relying on arrival order.
- Retries: Each event-target combination is attempted at most 3 times in total (including the initial attempt), with a 10-second timeout per request. Any 2xx response counts as success; non-2xx responses, temporary DNS or connection failures, and request timeouts are retried while attempts remain.
Retry-After: Parsed only for429and503responses. A valid value of up to 120 seconds sets the lower bound for the backoff delay; a value above 120 seconds stops retries and ends the task as a final delivery failure. Empty, malformed, zero-second, or expired values fall back to the standard backoff.- Redirects and rejected addresses:
3xxresponses are never followed and are treated as ordinary non-2xx responses. If the address policy rejects the target, the current task ends immediately without retries and does not count toward receiver failures. - Timestamps:
Webhook-Timestampis generated when each delivery attempt is signed and is updated on retries; use the payload’screated_atfor the event occurrence time. - Lost notifications: Platform failures, publication timeouts, or queue anomalies can cause notifications to be lost. Query the resource API when you need to reconcile business state; do not treat Webhooks as a complete change log.
disabled_reason to delivery_failures.
An actual URL change, signing secret rotation, or explicit enable resets the failure record for the new configuration; changing only the name or subscription list preserves the existing record. Automatic disabling only stops capturing new events; tasks that have already been created continue executing. Once you fix the receiver, you can re-enable the Webhook, but events that occurred while it was disabled are not replayed.
Manage Webhooks
Creation and signing-secret rotation responses additionally include
signing_secret and carry Cache-Control: no-store. For request fields, response fields, and error definitions, see the Webhook API reference. The update endpoint modifies only fields present in the request body; an empty request body, explicit null, empty URL, empty event list, or duplicate or unknown event types all return 400.
Changing the URL, rotating the signing secret, disabling, or deleting a Webhook affects only subsequent new events. Delivery tasks that have already been created, including their retries, continue using the original URL and secret. After rotating a secret, receivers should support verification with both the old and new secrets until in-flight tasks from the old configuration have drained. Deleting a configuration does not cancel delivery tasks that have already been created.
Next steps
View the Event Stream
Receive detailed real-time output from sessions and threads.
Configure scheduled tasks
Learn about triggers and their independent scheduled-run notifications.
Explore the API reference
View management endpoints, callbacks, and complete event schemas.