NylorunDocsBeta
Runtime APISessions

Follow a session's events

GET
/v1/sessions/{sessionId}/events

Server-sent events, each with its type as event and its cursor as id, from the cursor on. Events are on the nylorun.event/2 envelope, typed by SessionEvent; a client ignores a type it does not know. A trusted issuer's token's stream ends with event: nylorun.closed when the token expires. A : keepalive comment every 15 seconds.

Authorization

headerAuthorizationBearer <token>

An application key of the Tenant (PUT /v1/tenant/keys/{keyId}), or Studio's key, derived from the admin key. With Nylorun-Subject and Nylorun-Scopes, it acts for that person, narrowed to those scopes. Never accepted from a browser (Origin).

Path Parameters

sessionId*string

Query Parameters

cursor?string

Continue after this event's cursor; Last-Event-ID works too

Header Parameters

Nylorun-Protocol*string

The protocol version, 8

Nylorun-Subject?string

The person an application key acts for

Nylorun-Scopes?string

The subject's space-separated scopes; required with a subject

Response Body

The session's events

text/event-stream
import { createClient } from "@nylorun/agents";const client = await createClient();for await (const event of client.session("ses_123").observe()) {  console.log(event.type);}
Empty