Observability API
API endpoints for health overview, Vercel and Railway metrics, logs, Sentry issues, incident management, and real-time SSE events.
Observability API
Unified observability across your infrastructure. Query deployment health, service metrics, application logs, error tracking, and incidents from a single API surface. All endpoints require x-org-id for multi-tenant scoping.
Endpoints Overview
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/observability | Health overview across all sources |
| GET | /api/observability/vercel | Vercel deployment metrics |
| GET | /api/observability/railway | Railway service status |
| GET | /api/observability/logs | Aggregated logs |
| GET | /api/observability/sentry | Sentry issues |
| GET | /api/observability/incidents | Grouped incidents |
| POST | /api/observability/incidents/:id/acknowledge | Acknowledge an incident |
| GET | /api/events/stream | SSE real-time event stream |
Health Overview
Aggregate health status from all connected observability sources.
Request
Response
Response Schema
| Field | Type | Description |
|---|---|---|
status | string | Overall status: healthy, degraded, critical |
sources | object | Per-source health summary |
activeIncidents | number | Count of unresolved incidents |
lastUpdated | string | ISO 8601 timestamp of last data refresh |
Vercel Metrics
Retrieve deployment status and performance metrics from Vercel.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
projectId | string | — | Filter by Vercel project ID |
limit | number | 10 | Max deployments to return |
Request
Response
Railway Services
Retrieve service health and resource usage from Railway.
Request
Response
Logs
Retrieve aggregated logs from all services with filtering.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
project | string | — | Filter by project ID |
service | string | — | Filter by service name |
level | string | — | Filter by log level: info, warn, error, fatal |
search | string | — | Full-text search within log messages |
since | string | 1h ago | ISO 8601 start time |
until | string | now | ISO 8601 end time |
limit | number | 100 | Max log entries |
Request
Response
Sentry Issues
Retrieve unresolved Sentry issues. This endpoint proxies requests to the Sentry API with CodeSpar's stored credentials.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
project | string | — | Sentry project slug |
query | string | is:unresolved | Sentry search query |
limit | number | 25 | Max results |
Request
Response
Incidents
Incidents are auto-created when alerts fire from Sentry, PagerDuty, or deployment failures. They group related events for investigation.
List Incidents
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
status | string | open | Filter: open, acknowledged, resolved |
severity | string | — | Filter: critical, high, medium, low |
project | string | — | Filter by project ID |
limit | number | 25 | Max results |
Request
Response
Acknowledge Incident
Mark an incident as acknowledged, stopping further escalation.
Request
Response
Real-Time Events (SSE)
Subscribe to a Server-Sent Events stream for live observability updates. The connection stays open and pushes events as they occur.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
project | string | — | Filter events by project ID |
types | string | — | Comma-separated event types to subscribe to |
Request
Event Format
Each event follows the SSE specification:
Event Types
| Event Type | Description | Payload Fields |
|---|---|---|
deploy.status | Deployment state change | deployId, status, project, branch |
deploy.healthy | Post-deploy health check passed | deployId, project, checks |
deploy.unhealthy | Post-deploy health check failed | deployId, project, checks, reason |
sentry.error | New Sentry issue detected | issueId, title, level, project |
sentry.analyzed | Agent finished analyzing Sentry issue | issueId, agentId, summary, severity |
alert.analyzed | Agent analyzed an alert/incident | incidentId, agentId, summary |
log.entry | New log entry matching watch criteria | service, level, message |
Connection Notes
- The stream sends a
:keepalivecomment every 30 seconds to maintain the connection. - Clients should implement automatic reconnection with the
Last-Event-IDheader for resumption. - Events are scoped to the organization specified in
x-org-id.
Error Responses
Source not configured:
Incident not found:
Upstream timeout:
Next Steps
- Integrations API -- Configure third-party services
- A2A API -- Submit tasks via the A2A protocol
- Audit API -- Query the immutable audit trail