{"openapi":"3.1.0","info":{"title":"sigiro API Reference","description":"Send OpenTelemetry to sigiro and query tenant-scoped raw telemetry.","license":{"name":"Apache-2.0","identifier":"Apache-2.0"},"version":"0.1.0"},"paths":{"\/":{"post":{"tags":["Pyroscope ingest"],"summary":"Ingest Pyroscope profiles at the server root","description":"Accept a Pyroscope PushRequest or raw pprof profile. With `name`, the payload is raw pprof and the service name is the part before the first `{`; without `name`, the payload is a PushRequest whose series require a `service_name` label. Binary bodies may be gzip-compressed. Multipart bodies must carry the payload in the `profile` field. A missing Content-Type is also accepted as a binary body. See the [profile ingest guide](https:\/\/sigiro.com\/docs\/how-to\/send-profiles).","operationId":"ingestPyroscopeRoot","parameters":[{"name":"name","in":"query","description":"When present, the body is a raw pprof profile and the service name is the\npart before the first `{`. When absent, the body is a Pyroscope\nPushRequest and each series must contain a `service_name` label.","required":false,"schema":{"type":"string"}}],"requestBody":{"description":"Pyroscope PushRequest or raw pprof bytes. For multipart\/form-data, put the binary payload in the `profile` field.","content":{"application\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"application\/proto":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"binary\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"multipart\/form-data":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}}},"required":true},"responses":{"200":{"description":"Profile accepted"},"400":{"description":"Unsupported media type, malformed payload, missing service name, or empty profile"},"401":{"description":"Missing, expired, revoked or invalid credential; the plain-text body says which"},"403":{"description":"The credential lacks telemetry:ingest"},"413":{"description":"Request body exceeds the configured ingest limit"},"429":{"description":"Ingest rate limit exceeded"},"500":{"description":"Ingest failed"},"507":{"description":"Storage cannot currently accept ingest"}},"security":[{"bearer":[]}]}},"\/ingest":{"post":{"tags":["Pyroscope ingest"],"summary":"Ingest Pyroscope profiles","description":"Accept a Pyroscope PushRequest or raw pprof profile. With `name`, the payload is raw pprof and the service name is the part before the first `{`; without `name`, the payload is a PushRequest whose series require a `service_name` label. Binary bodies may be gzip-compressed. Multipart bodies must carry the payload in the `profile` field. A missing Content-Type is also accepted as a binary body. See the [profile ingest guide](https:\/\/sigiro.com\/docs\/how-to\/send-profiles).","operationId":"ingestPyroscope","parameters":[{"name":"name","in":"query","description":"When present, the body is a raw pprof profile and the service name is the\npart before the first `{`. When absent, the body is a Pyroscope\nPushRequest and each series must contain a `service_name` label.","required":false,"schema":{"type":"string"}}],"requestBody":{"description":"Pyroscope PushRequest or raw pprof bytes. For multipart\/form-data, put the binary payload in the `profile` field.","content":{"application\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"application\/proto":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"binary\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"multipart\/form-data":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}}},"required":true},"responses":{"200":{"description":"Profile accepted"},"400":{"description":"Unsupported media type, malformed payload, missing service name, or empty profile"},"401":{"description":"Missing, expired, revoked or invalid credential; the plain-text body says which"},"403":{"description":"The credential lacks telemetry:ingest"},"413":{"description":"Request body exceeds the configured ingest limit"},"429":{"description":"Ingest rate limit exceeded"},"500":{"description":"Ingest failed"},"507":{"description":"Storage cannot currently accept ingest"}},"security":[{"bearer":[]}]}},"\/ingest\/pyroscope":{"post":{"tags":["Pyroscope ingest"],"summary":"Ingest Pyroscope profiles at the \/ingest\/pyroscope alias","description":"Accept a Pyroscope PushRequest or raw pprof profile. With `name`, the payload is raw pprof and the service name is the part before the first `{`; without `name`, the payload is a PushRequest whose series require a `service_name` label. Binary bodies may be gzip-compressed. Multipart bodies must carry the payload in the `profile` field. A missing Content-Type is also accepted as a binary body. See the [profile ingest guide](https:\/\/sigiro.com\/docs\/how-to\/send-profiles).","operationId":"ingestPyroscopeAlias","parameters":[{"name":"name","in":"query","description":"When present, the body is a raw pprof profile and the service name is the\npart before the first `{`. When absent, the body is a Pyroscope\nPushRequest and each series must contain a `service_name` label.","required":false,"schema":{"type":"string"}}],"requestBody":{"description":"Pyroscope PushRequest or raw pprof bytes. For multipart\/form-data, put the binary payload in the `profile` field.","content":{"application\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"application\/proto":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"binary\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"multipart\/form-data":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}}},"required":true},"responses":{"200":{"description":"Profile accepted"},"400":{"description":"Unsupported media type, malformed payload, missing service name, or empty profile"},"401":{"description":"Missing, expired, revoked or invalid credential; the plain-text body says which"},"403":{"description":"The credential lacks telemetry:ingest"},"413":{"description":"Request body exceeds the configured ingest limit"},"429":{"description":"Ingest rate limit exceeded"},"500":{"description":"Ingest failed"},"507":{"description":"Storage cannot currently accept ingest"}},"security":[{"bearer":[]}]}},"\/push.v1.PusherService\/Push":{"post":{"tags":["Pyroscope ingest"],"summary":"Ingest Pyroscope profiles over the Push API","description":"Accept a Pyroscope PushRequest or raw pprof profile. With `name`, the payload is raw pprof and the service name is the part before the first `{`; without `name`, the payload is a PushRequest whose series require a `service_name` label. Binary bodies may be gzip-compressed. Multipart bodies must carry the payload in the `profile` field. A missing Content-Type is also accepted as a binary body. See the [profile ingest guide](https:\/\/sigiro.com\/docs\/how-to\/send-profiles).","operationId":"ingestPyroscopePush","parameters":[{"name":"name","in":"query","description":"When present, the body is a raw pprof profile and the service name is the\npart before the first `{`. When absent, the body is a Pyroscope\nPushRequest and each series must contain a `service_name` label.","required":false,"schema":{"type":"string"}}],"requestBody":{"description":"Pyroscope PushRequest or raw pprof bytes. For multipart\/form-data, put the binary payload in the `profile` field.","content":{"application\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"application\/proto":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"binary\/octet-stream":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}},"multipart\/form-data":{"schema":{"$ref":"#\/components\/schemas\/PyroscopeProfileBody"}}},"required":true},"responses":{"200":{"description":"Profile accepted"},"400":{"description":"Unsupported media type, malformed payload, missing service name, or empty profile"},"401":{"description":"Missing, expired, revoked or invalid credential; the plain-text body says which"},"403":{"description":"The credential lacks telemetry:ingest"},"413":{"description":"Request body exceeds the configured ingest limit"},"429":{"description":"Ingest rate limit exceeded"},"500":{"description":"Ingest failed"},"507":{"description":"Storage cannot currently accept ingest"}},"security":[{"bearer":[]}]}},"\/v1\/alerts":{"get":{"tags":["Telemetry"],"summary":"List alerts","operationId":"list-alerts","parameters":[{"name":"status","in":"query","description":"Filter by lifecycle status: `firing` or `resolved`.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Alert instances","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AlertsResponse"}}}},"400":{"description":"Invalid status filter"},"401":{"description":"Missing or invalid bearer token"}},"security":[{"bearer":[]}]}},"\/v1\/ingest-keys":{"get":{"tags":["Ingest keys"],"summary":"List ingest keys","description":"Every ingest key of the workspace, newest first, revoked ones included. The secret is never returned.","operationId":"list-ingest-keys","responses":{"200":{"description":"The workspace's ingest keys","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/IngestKeysResponse"}}}},"401":{"description":"Missing or invalid bearer token"},"403":{"description":"Not a user's own OAuth access token"}},"security":[{"bearer":[]}]},"post":{"tags":["Ingest keys"],"summary":"Create an ingest key","description":"Create a fixed key for a long-running service. Send it as `Authorization: Bearer <key>` (for example `OTEL_EXPORTER_OTLP_HEADERS=\"Authorization=Bearer <key>\"`). It sends telemetry to this workspace and cannot read anything. The response is the only time the key is shown: only its hash is stored.","operationId":"create-ingest-key","requestBody":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateIngestKeyRequest"}}},"required":true},"responses":{"201":{"description":"The new key, shown once","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreatedIngestKey"}}}},"400":{"description":"Invalid name, or the workspace already has 50 active keys"},"401":{"description":"Missing or invalid bearer token"},"403":{"description":"Not a user's own OAuth access token"}},"security":[{"bearer":[]}]}},"\/v1\/ingest-keys\/{id}":{"delete":{"tags":["Ingest keys"],"summary":"Revoke an ingest key","description":"Revoke a key by its id. Senders using it get 401 \"The ingest key has been revoked\" from then on. Revoking a revoked key succeeds again.","operationId":"revoke-ingest-key","parameters":[{"name":"id","in":"path","description":"The key id: the middle part of `sigiro_<id>_<secret>`","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Revoked"},"401":{"description":"Missing or invalid bearer token"},"403":{"description":"Not a user's own OAuth access token"},"404":{"description":"The workspace has no key with this id"}},"security":[{"bearer":[]}]}},"\/v1\/query":{"post":{"tags":["Telemetry"],"summary":"Run a SQL query","description":"Readable tables, optionally qualified `lake.*` or `main.*`:\n\n- `sigiro_spans`\n- `sigiro_logs`\n- `sigiro_metrics_gauge`\n- `sigiro_metrics_sum`\n- `sigiro_metrics_histogram`\n- `sigiro_metrics_exp_histogram`\n- `sigiro_profiles`\n\n## Bound `timestamp` with a literal, not `now()`\n\nStatistics pruning only happens when the comparison value is a constant the\nplanner can fold. `now()` is volatile, so any predicate built from it is\nevaluated per row and every file in the table is opened.\n\n```sql\n-- prunes: the planner folds the constant and skips whole files\nWHERE timestamp > TIMESTAMP '2026-08-31 08:00:00'\n\n-- does not prune: opens every file, then filters\nWHERE timestamp > (now() - INTERVAL 1 HOUR)::TIMESTAMP\n```\n\nCompute the bound in your client and send it as a literal.\n\n## If you must use `now()`, cast it\n\nThe `timestamp` columns are `TIMESTAMP` (no timezone) and `now()` returns\n`TIMESTAMPTZ`. Comparing them directly makes DuckDB cast the **column**,\nwhich adds a per-row conversion on top of the missing pruning. Measured\nagainst production on 2026-08-31, same table and window:\n\n| predicate | result |\n|---|---|\n| `timestamp > TIMESTAMP '2026-08-31 08:00:00'` | 200 in 2.48s |\n| `timestamp > (now() - INTERVAL 5 MINUTE)::TIMESTAMP` | 200 in 0.65s |\n| `timestamp > now() - INTERVAL 5 MINUTE` | 400 `INTERRUPT` at 10.98s |\n| `timestamp > TIMESTAMPTZ '2026-08-31 08:00:00+00'` | 400 `INTERRUPT` at 10.65s |\n\nSo the cast is worth having, but it is a mitigation and not the fix: the\nliteral is.","operationId":"run-query","requestBody":{"description":"One SELECT statement. No WITH\/CTE clauses \u2014 rewrite them as derived-table subqueries. Scalar functions are allowlisted; file and network readers are blocked. Bound timestamp columns with a literal TIMESTAMP rather than an expression built from now(), or statistics pruning is lost and the query reads every file.","content":{"text\/plain":{"schema":{"type":"string"},"example":"SELECT service_name, count(*) AS errors FROM sigiro_spans WHERE status_code = 2 AND timestamp >= TIMESTAMP '2026-09-11 12:00:00' AND timestamp < TIMESTAMP '2026-09-11 13:00:00' GROUP BY 1 ORDER BY 2 DESC"}},"required":true},"responses":{"200":{"description":"Query results \u2014 one object per row, keyed by your SELECT's column names","content":{"application\/json":{"schema":{"type":"array","items":{}},"example":[{"errors":128,"service_name":"checkout"},{"errors":4,"service_name":"cart"}]}}}}}},"\/v1\/services":{"get":{"tags":["Telemetry"],"summary":"List services","description":"Every service that has reported telemetry, with the first and last timestamp seen for each (UTC text such as `2026-01-01 12:00:00.123`). The entry point of an agent loop: pick a service here, then query its telemetry. Returns an error, never a partial list, if the number of services exceeds SIGIRO_MAX_RESULT_ROWS.","operationId":"list-services","responses":{"200":{"description":"Complete list of services","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ServicesResponse"}}}},"400":{"description":"Service count exceeds SIGIRO_MAX_RESULT_ROWS"}}}},"\/v1\/traces\/{trace_id}":{"get":{"tags":["Telemetry"],"summary":"Fetch one whole trace","description":"Every span of one trace, parent links included, so a caller can rebuild the tree. Trace IDs come from any SQL query over `sigiro_spans`.","operationId":"get-trace","parameters":[{"name":"trace_id","in":"path","description":"Trace ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Trace detail","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TraceDetailResponse"}}}}}}}},"components":{"schemas":{"AlertInstance":{"type":"object","required":["fingerprint","rule_id","status","service_name","container_name","starts_at","occurrence_count"],"properties":{"container_name":{"type":"string"},"ends_at":{"type":["string","null"]},"fingerprint":{"type":"string"},"occurrence_count":{"type":"integer","format":"int64","minimum":0},"rule_id":{"type":"string"},"service_name":{"type":"string"},"starts_at":{"type":"string"},"status":{"type":"string"}}},"AlertsResponse":{"type":"object","description":"GET \/v1\/alerts","required":["alerts"],"properties":{"alerts":{"type":"array","items":{"$ref":"#\/components\/schemas\/AlertInstance"}}}},"CreateIngestKeyRequest":{"type":"object","description":"Body of `POST \/v1\/ingest-keys`.","properties":{"name":{"type":["string","null"],"description":"A label to tell keys apart, such as the service that uses it. 1 to 64\ncharacters; defaults to \"ingest key\"."}}},"CreatedIngestKey":{"allOf":[{"$ref":"#\/components\/schemas\/IngestKeyInfo"},{"type":"object","required":["key"],"properties":{"key":{"type":"string","description":"The full key. Shown once; only its hash is stored."}}}],"description":"The one response that carries a secret."},"IngestKeyInfo":{"type":"object","description":"What a client may see about a key. Never carries the secret or its hash.","required":["id","name","created_at","created_by"],"properties":{"created_at":{"type":"string","description":"RFC 3339."},"created_by":{"type":"string","description":"Subject of the OAuth token that created the key."},"id":{"type":"string","description":"Public key id: the middle part of `sigiro_<id>_<secret>`."},"last_used_at":{"type":["string","null"],"description":"RFC 3339; updated at most once a minute per key."},"name":{"type":"string"},"revoked_at":{"type":["string","null"],"description":"RFC 3339; set once the key is revoked."}}},"IngestKeysResponse":{"type":"object","required":["keys"],"properties":{"keys":{"type":"array","items":{"$ref":"#\/components\/schemas\/IngestKeyInfo"}}}},"PyroscopeProfileBody":{"type":"string","format":"binary"},"ServiceBreakdownEntry":{"type":"object","description":"Service duration breakdown with percentages.","required":["service","duration_us","percentage"],"properties":{"duration_us":{"type":"integer","format":"int64","description":"Cumulative inclusive duration of the service's spans, in microseconds."},"percentage":{"type":"number","format":"double","description":"Percentage of cumulative inclusive span duration across all services."},"service":{"type":"string"}}},"ServiceEntry":{"type":"object","required":["name","signals","totalCount"],"properties":{"firstSeen":{"type":["string","null"]},"lastSeen":{"type":["string","null"]},"name":{"type":"string"},"signals":{"$ref":"#\/components\/schemas\/ServiceSignals"},"totalCount":{"type":"integer","format":"int64"}}},"ServiceSignals":{"type":"object","required":["spans","logs","metrics","profiles"],"properties":{"logs":{"type":"integer","format":"int64"},"metrics":{"type":"integer","format":"int64"},"profiles":{"type":"integer","format":"int64"},"spans":{"type":"integer","format":"int64"}}},"ServicesResponse":{"type":"object","description":"GET \/v1\/services \u2014 complete result only; exceeding SIGIRO_MAX_RESULT_ROWS\nreturns an error rather than a partial list.","required":["services"],"properties":{"services":{"type":"array","items":{"$ref":"#\/components\/schemas\/ServiceEntry"}}}},"SpanDetail":{"type":"object","description":"Individual span detail in trace detail response.","required":["trace_id","span_id","span_name","duration_us","status_code","service_name","timestamp"],"properties":{"duration_us":{"type":"integer","format":"int64"},"events_json":{"type":["string","null"]},"links_json":{"type":["string","null"]},"parent_span_id":{"type":["string","null"]},"resource_attributes":{"type":["string","null"]},"scope_name":{"type":["string","null"]},"scope_version":{"type":["string","null"]},"service_name":{"type":"string"},"span_attributes":{"type":["string","null"]},"span_id":{"type":"string"},"span_kind":{"type":["integer","null"],"format":"int32"},"span_name":{"type":"string"},"status_code":{"type":"integer","format":"int32"},"timestamp":{"type":"string"},"trace_id":{"type":"string"},"trace_state":{"type":["string","null"]}}},"TraceDetailResponse":{"type":"object","description":"Complete trace detail response with critical path and service breakdown.","required":["trace_id","total_duration_us","root_span","span_count","error_count","services","spans","critical_path","service_breakdown"],"properties":{"critical_path":{"type":"array","items":{"type":"string"}},"error_count":{"type":"integer","format":"int64"},"root_span":{"$ref":"#\/components\/schemas\/SpanDetail"},"service_breakdown":{"type":"array","items":{"$ref":"#\/components\/schemas\/ServiceBreakdownEntry"}},"services":{"type":"array","items":{"type":"string"}},"span_count":{"type":"integer","format":"int64"},"spans":{"type":"array","items":{"$ref":"#\/components\/schemas\/SpanDetail"}},"total_duration_us":{"type":"integer","format":"int64","description":"Elapsed wall-clock time from the earliest span start to the latest span end, in microseconds."},"trace_id":{"type":"string"}}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"prefixed-api-key"}}},"tags":[{"name":"Telemetry","description":"Read the telemetry of your workspace."},{"name":"Ingest keys","description":"Fixed, revocable keys that let a long-running service send telemetry."},{"name":"Pyroscope ingest","description":"Send profiles in Pyroscope's own wire format."}]}