Events (SSE)
Several long-running operations stream progress over Server-Sent Events. The SSE stream for a resource is always at:
GET /api/v1/{resource-type}/{id}/events Because the browser EventSource API does not support custom headers, SSE endpoints use a one-time ticket for authentication instead of the Authorization header:
Event types vary by resource. Common event shapes:
// Build log line
{ "type": "log", "stream": "stdout", "data": "Installing dependencies...", "ts": 1748390460 }
// Status change
{ "type": "status_changed", "previous": "building", "current": "ready", "ts": 1748390462 }
// Error
{ "type": "error", "code": "BUILD_FAILED", "message": "Exit code 1", "ts": 1748390465 } Sandbox lifecycle events
| Event | When |
|---|---|
sandbox.created | Sandbox resource created (not yet booted) |
sandbox.ready | Boot complete, exec and file endpoints available |
sandbox.error | Fatal boot or runtime error |
sandbox.destroyed | Sandbox stopped and resources released |
sandbox.share.created | A share token was minted for the sandbox |
sandbox.share.revoked | A share token was revoked |
Deployment lifecycle events
| Event | When |
|---|---|
deployment.created | Deployment object created |
deployment.build_started | Builder VM booted, build in progress |
deployment.build_succeeded | Release artifact ready |
deployment.build_failed | Build exited non-zero |
deployment.published | Active version updated, traffic cut over |
deployment.rollback | Active version reset to a prior version |
Tenant-wide SSE stream
To receive all lifecycle events for your organization without polling per-resource endpoints, subscribe to the tenant stream:
# Mint a ticket
TICKET=$(curl -s -X POST https://api.miosa.ai/api/v1/events/ticket
-H "Authorization: Bearer msk_u_..." | jq -r '.ticket')
# Stream all org events
curl -N "https://api.miosa.ai/api/v1/events?ticket=$TICKET" Each event on the tenant stream includes a resource_type and resource_id field so you can route to the right handler:
{
"type": "sandbox.ready",
"resource_type": "sandbox",
"resource_id": "sbx_abc123",
"external_user_id": "alice@acme.com",
"ts": 1748390462
} See Events (SSE) API Reference and Tenant Events for the complete event catalog and filtering options.