API reference
Watch an incident
- SSE
- GET https://api.inorbit.hr/v1/incidents/{incident_id}/eventsAccept: text/event-stream; one data: line of JSON per event
- WebSocket
- wss://api.inorbit.hr/v1/ws{"type":"call","id":"1","method":"iohr.incidents.v1.IncidentsService/WatchIncident","body":{…}}
- MQTT 5
- wss://api.inorbit.hr/v1/mqttsubscribe to incidents/{incident_id}/events
An incident as it changes, over server-sent events: a snapshot first, then each change with a gapless seq. A key sees status changes and monitor runs only, never the investigation. A lower seq than the last one means the incident was reopened: start again from the snapshot.
Needs scope incidents:read.
bearerAuthorizationBearer <JWT>An access token from the identity provider: a person's, or a customer's from the client credentials grant with an API key (developers.inorbit.hr). The gateway verifies it; the audience is iohr-api.
incident_id*stringThe incident's id, inc_ and 26 characters, from List incidents.
account_id?stringThe account; empty is the caller's own.
after_seq?stringThe last seq you applied; 0 starts with a snapshot.
int64A stream of iohr.incidents.v1.WatchIncidentResponse events, one JSON object per data:; a failure is an error event carrying Problem
text/event-stream- response
iohr.incidents.v1.WatchIncidentResponse
answer?iohr.incidents.v1.IncidentAnswer
at?stringdate-timefinding?iohr.incidents.v1.InvestigationFinding
keepalive?iohr.incidents.v1.StreamKeepalive
monitor_run?iohr.incidents.v1.MonitorRunSeen
pass?iohr.incidents.v1.InvestigationPass
report?iohr.incidents.v1.IncidentReportUpdated
seq*stringint64snapshot?iohr.incidents.v1.IncidentSnapshot
status?iohr.incidents.v1.IncidentStatusChanged
import { ApiError, Public } from "@inorbithr/sdk";// Reads INORBIT_TOKEN, or INORBIT_KEY_ID and INORBIT_KEY_SECRET.const api = Public.fromEnv();try { for await (const event of api.incidents.watchIncident("<incident_id>")) { console.log(event); }} catch (e) { if (!(e instanceof ApiError)) throw e; console.error(`${e.code}: ${e.problem} (request id ${e.raw.requestId})`); process.exitCode = 1;}npm install @inorbithr/sdk. Calls the package's public surface; an operation newer than your package needs the next release or a client generated for your account. The SDKs.
{ "answer": { "ai": true, "question": { "answer": "string", "answered_at": "string", "asked_at": "string", "asked_by": "string", "cites": [ "string" ], "model": "string", "pass": 0, "question_id": "string", "state": "string", "text": "string", "tier": "string", "tier_reason": "string", "tokens": 0 } }, "at": "2019-08-24T14:15:22Z", "finding": { "finding": { "cites": [ "string" ], "id": "string", "kind": "string", "rule": "string", "source": "string", "state": "string", "statement": "string" }, "pass": 0 }, "keepalive": {}, "monitor_run": { "at": "2019-08-24T14:15:22Z", "error_kind": "string", "from": "string", "latency_ms": 0, "monitor_id": "string", "ok": true, "run_id": "string", "status": "string" }, "pass": { "at": "string", "dropped": 0, "evidence": [ { "id": "string", "kind": "string", "label": "string", "observed_at": "string", "ref": "string", "values": { "property1": "string", "property2": "string" } } ], "findings": [ { "cites": [ "string" ], "id": "string", "kind": "string", "rule": "string", "source": "string", "state": "string", "statement": "string" } ], "missing": [ { "evidence_needed": "string", "id": "string", "why_missing": "string", "would_settle": "string" } ], "model": "string", "note": "string", "pass": 0, "tier": "string", "tier_reason": "string", "tokens": 0 }, "report": { "version": 0 }, "seq": "string", "snapshot": { "incident": { "acknowledged_at": "string", "acknowledged_by": "string", "acknowledged_by_email": "string", "category": "string", "created_at": "string", "created_by": "string", "detected_at": "string", "duration_secs": "string", "figures": { "acknowledge_secs": "string", "error_rate": 0.1, "failed_runs": "string", "runs": "string" }, "incident_id": "string", "linked_provider": "string", "linked_url": "string", "monitors": [ "string" ], "org_id": "string", "permissions": { "can_acknowledge": true, "can_delete": true, "can_edit": true, "can_publish": true }, "postmortem": { "action_items": [ { "due": "string", "item_id": "string", "link": "string", "owner": "string", "status": "string", "title": "string" } ], "contributing": "string", "detection": "string", "diagnosis": "string", "evidence": [ { "kind": "string", "label": "string", "ref": "string", "url": "string" } ], "impact": "string", "mistakes": "string", "open_items": "string", "record": { "evidence_json": "string", "preface": "string", "record_id": "string", "scenarios": "string", "source": "string" }, "repair": "string", "response": "string", "root_cause": "string", "summary": "string", "timeline": [ { "at": "string", "entry_id": "string", "evidence_ref": "string", "kind": "string", "label": "string", "text": "string" } ], "verification": "string", "went_badly": "string", "went_well": "string" }, "resolved_at": "string", "responders": [ "string" ], "severity": 0, "source": "string", "started_at": "string", "state": "string", "status": "string", "tags": { "property1": "string", "property2": "string" }, "title": "string", "updated_at": "string", "updated_by": "string", "updated_by_email": "string", "version": 0 }, "investigation": { "budget": { "llm_remaining": "string", "llm_unlimited": true, "tokens_per_account_day": "string", "tokens_per_incident": "string", "tokens_used_account_today": "string", "tokens_used_incident": "string" }, "error": "string", "incident_id": "string", "pass": { "at": "string", "dropped": 0, "evidence": [ { "id": "string", "kind": "string", "label": "string", "observed_at": "string", "ref": "string", "values": { "property1": "string", "property2": "string" } } ], "findings": [ { "cites": [ "string" ], "id": "string", "kind": "string", "rule": "string", "source": "string", "state": "string", "statement": "string" } ], "missing": [ { "evidence_needed": "string", "id": "string", "why_missing": "string", "would_settle": "string" } ], "model": "string", "note": "string", "pass": 0, "tier": "string", "tier_reason": "string", "tokens": 0 }, "passes": 0, "questions": [ { "answer": "string", "answered_at": "string", "asked_at": "string", "asked_by": "string", "cites": [ "string" ], "model": "string", "pass": 0, "question_id": "string", "state": "string", "text": "string", "tier": "string", "tier_reason": "string", "tokens": 0 } ], "started_at": "string", "state": "string", "updated_at": "string" }, "runs": [ { "at": "2019-08-24T14:15:22Z", "error_kind": "string", "from": "string", "latency_ms": 0, "monitor_id": "string", "ok": true, "run_id": "string", "status": "string" } ] }, "status": { "previous": "string", "status": "string" }}