Goal
Automate Events from your own code.Prerequisites
- An API token. Add team_id to work on a team’s events.
Workflow
1
GET /api/v1/events/catalog to list event types.
2
POST /api/v1/events/subscriptions to add a webhook destination and receive its secret once.
3
POST /api/v1/events/rules to send matching events to a target.
4
GET /api/v1/events/deliveries?dead_letter=true to find what gave up, then POST /api/v1/events/deliveries/{id}/replay.
Endpoints
- GET /catalog, GET / (recent events: type, product, project_id, since, cursor, limit), GET /{eventId}, GET /stats?days=7.
- GET /stream: a server-sent event stream of event: platform.event messages. Resume with Last-Event-ID. Each connection ends after 10 minutes; reconnect. Up to 5 open streams per user.
- GET, POST /subscriptions; GET, PATCH, DELETE /subscriptions/{id}; POST /subscriptions/{id}/rotate-secret; POST /subscriptions/{id}/test.
- GET, POST /rules; POST /rules/preview; GET, PATCH, DELETE /rules/{id}; POST /rules/{id}/test.
- GET /deliveries (status, dead_letter, subscription_id, rule_id, event_id, cursor, limit); GET /deliveries/{id} with its attempts; POST /deliveries/{id}/replay.
Create a rule
- target_type is webhook, function, queue, job_event, agent, notification or automation.
- target_config: webhook { subscription_id }; function { project_id, function }; queue { queue, job }; job_event { name, correlation_path }; agent { agent_id } or { stackie: true, prompt }; notification { channels, title }; automation { automation_id }.
POST /api/v1/events/rules
SDKs and agents
The JavaScript, Python and Go SDKs wrap these endpoints in an events client. Agents and Stackie use the actions events.catalog.inspect, events.recent.inspect, events.subscription.create, events.subscription.delete, events.rule.create, events.rule.update, events.rule.delete and events.delivery.replay. In n8n, the StackShift Trigger node subscribes a webhook and lists the catalog.Expected result
Your code manages the same rules and destinations shown in the dashboard.
Related guides
Rules and filters
A rule matches events by type pattern, project, subject and data conditions, then sends each match to one target.
Verify webhook signatures
Every webhook is signed with HMAC-SHA256 of the timestamp and raw body. Verify it with the SDK for JavaScript, Python, Go, Ruby or PHP.