Skip to content

Lifecycle Webhooks

Synapse can POST JSON payloads to your endpoint whenever lifecycle events occur — sandbox creation, execution completion, pause/resume, or kills.

EventDescription
cell.createdA new sandbox was created
cell.killedA sandbox was destroyed
cell.pausedA sandbox was paused (snapshot created)
cell.resumedA sandbox was resumed from snapshot
exec.completedCode execution finished
*Subscribe to all events
from synapse import Cell
webhook = Cell.register_webhook(
url="https://your-server.com/hooks/synapse",
events=["cell.created", "exec.completed"],
)
print(webhook["webhook_id"]) # "wh_a1b2c3..."

When an event fires, the gateway sends a POST request:

{
"event": "exec.completed",
"cell_id": "abc123-def456-...",
"detail": {
"execution_id": "exec_a1b2c3",
"exit_code": 0,
"latency_ms": 0.24
},
"timestamp": 1715702400000
}
webhooks = Cell.list_webhooks()
for wh in webhooks:
print(f"{wh['webhook_id']}: {wh['url']} -> {wh['events']}")
Cell.delete_webhook("wh_a1b2c3...")

You can also poll events directly without webhooks:

# Per-cell events
events = cell.get_lifecycle_events()
# Global events (last 100)
events = Cell.get_global_events()
  • Billing integration — Track exec.completed to count executions
  • Monitoring — Alert on cell.killed to detect unexpected terminations
  • CI/CD pipelines — Trigger downstream jobs when exec.completed
  • Audit logging — Archive all lifecycle events for compliance