inis.run
API reference

Events and webhooks

Stream your account's session events over SSE, or receive them as signed webhook deliveries.

Two ways to follow what happens to your sessions: a live SSE stream, and webhooks. Both carry the same event envelope.

All requests require Authorization: Bearer inis_....

Event envelope

{
  "seq": 41,
  "ts": "2026-11-22T10:00:00Z",
  "session_id": "l9iqiaagldxawxg9glc7i",
  "customer_id": "...",
  "actor_id": "...",
  "event_type": "session.paused",
  "data": {}
}

session_id is omitted for events that belong to no session. seq is per node and not a resume cursor: resume with the SSE id. Event types are listed in Execution log.

Live stream

GET/v1/events?stream=sessions

A Server-Sent Events stream of your account's session events.

ParamDescription
streamRequired. Must be sessions; it is the only supported value. Without it the response is 400 {"error":"stream must be \"sessions\" (only session lifecycle events are supported in v1)"}.
typesOptional, comma-separated event_type values, for example session.paused,session.resumed. Unknown values are ignored; if none are known, every type is sent.
last_event_idOptional resume cursor, equivalent to the Last-Event-ID header.
curl -N -H "Authorization: Bearer $INIS_API_KEY" \
  "https://api.inis.run/v1/events?stream=sessions"
: connected

id: 1795341600000000000.l9iqiaagldxawxg9glc7i.41
event: session.created
data: {"seq":41,"ts":"2026-11-22T10:00:00Z","session_id":"l9iqiaagldxawxg9glc7i","event_type":"session.created",...}

: ping
  • The stream opens with : connected and sends : ping every 20 seconds.
  • Each event is one frame: id, event (the event_type) and data (the envelope as JSON).
  • It carries session lifecycle, exec, file and data-teardown events, plus live-only hints such as session.pausing (details). It does not carry egress.* events.
  • To resume after a disconnect, send the last id you saw as Last-Event-ID. Events from the previous 15 minutes, up to 500, are replayed before the live tail. Live-only hints are not replayed.
  • A session-bound or capability-restricted token gets 401. Use an account-level key.

Webhooks

Register an HTTPS endpoint and it receives the same envelope as a POST with Content-Type: application/json.

Endpoint
POST /v1/org/webhooksCreate. Body {"url": "...", "event_types": ["session.created"]}; omit event_types for every type. The response includes secret once. Owner or admin only
GET /v1/org/webhooksList. The secret is never returned again, only secret_last4
DELETE /v1/org/webhooks/{id}Delete
POST /v1/org/webhooks/{id}/testSend one signed webhook.test event now
GET /v1/org/webhooks/{id}/deliveriesDelivery log. With ?since_id=N, deliveries after N, oldest first, with next_since_id, to catch up after downtime
POST /v1/org/webhooks/{id}/deliveries/{delivery_id}/redeliverRetry one delivery now

A 2xx response counts as delivered. Anything else is retried with backoff (5 s, 20 s, 80 s, 320 s, then 1280 s up to a 1 hour cap), up to 30 attempts over about 24 hours. After that the delivery is dead; fetch it with ?since_id.

Verify the signature

Every delivery carries two headers:

HeaderValue
Inis-Signaturet=<unix seconds>,v1=<hex>
Inis-Webhook-IdThe id of the endpoint that received the delivery

v1 is the lowercase hex HMAC-SHA256 of the string "<t>." + <raw request body>, keyed with the endpoint's secret.

  1. Read the raw body bytes. Do not re-serialise parsed JSON.
  2. Parse t and v1 from the header.
  3. Compute HMAC-SHA256(secret, t + "." + body) and compare it with v1 in constant time.
  4. Reject if t is more than a few minutes from your clock, to block replays.
import hashlib, hmac, time

def verify(secret: str, header: str, raw_body: bytes, tolerance: int = 300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    t, v1 = parts.get("t", ""), parts.get("v1", "")
    if not t.isdigit() or abs(time.time() - int(t)) > tolerance:
        return False
    expected = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, v1)
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(secret: string, header: string, rawBody: Buffer, toleranceSec = 300): boolean {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2) as [string, string]));
  const t = parts.t ?? "";
  const v1 = parts.v1 ?? "";
  if (!/^\d+$/.test(t) || Math.abs(Date.now() / 1000 - Number(t)) > toleranceSec) return false;
  const expected = createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest("hex");
  return expected.length === v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}

The org request endpoint used by the self API is signed the same way.

On this page