---
title: "Get a play session by ID"
method: GET
path: "/sessions/{id}"
tags: ["sessions"]
---

# Get a play session by ID

`GET /sessions/{id}`

## Path parameters

- `id` string, required

## Response `200`

OK

- DomainPlaySession
  - `bytes` integer — Bytes is the cumulative bytes sent to this client since session open. HLS/DASH: sum of segment + manifest response bodies. RTMP/SRT: write bytes from the publisher's outbound pipeline.
  - `close_reason` 'idle' | 'max_lifetime' | 'client_gone' | 'shutdown' | 'kicked'
  - `closed_at` string — ClosedAt is set when the session ends. nil while active.
  - `country` string — Country is an ISO 3166-1 alpha-2 country code from the configured GeoIP resolver, or "" when GeoIP is disabled / lookup failed.
  - `dvr` boolean — DVR is true when the playlist request carried any timeshift query parameter (from / delay / dur / ago) — false for live-edge hits. Set by sessions.HTTPMiddleware after detecting the query shape. The flag also participates in the session fingerprint, so a viewer watching both live and timeshift gets two distinct session records.
  - `id` string — ID uniquely identifies the session across the server's lifetime. For segment protocols (HLS/DASH) it is the deterministic fingerprint hash (so reconnects within the idle window collapse onto one session); for connection-bound protocols (RTMP/SRT/RTSP) it is a random UUID.
  - `ip` string — IP is the remote peer address (no port). For HTTP-based protocols this is the X-Forwarded-For head when present, otherwise the RemoteAddr.
  - `named_by` 'token' | 'config' | 'fingerprint'
  - `opened_at` string — OpenedAt is the time the first activity for this session was observed.
  - `proto` 'hls' | 'dash' | 'rtmp' | 'srt' | 'rtsp' | 'mpegts'
  - `query_string` string — QueryString is the raw query of the FIRST request that opened the session (HLS/DASH) — useful when token/abr-variant info is encoded there.
  - `referer` string — Referer is the HTTP Referer when present (HLS/DASH only).
  - `secure` boolean — Secure is true when the underlying transport was TLS / SRTS / RTMPS.
  - `started_at` string — StartedAt is when the first byte of media was delivered (segment data for HLS/DASH, first frame after RTMP play handshake). Zero before media flows.
  - `stream_code` string — StreamCode is the foreign key to Stream.Code.
  - `token` string — Token is the value of `?token=` from the first request, when present. When set, NamedBy is SessionNamedByToken.
  - `updated_at` string — UpdatedAt is the time of the most recent activity. Idle reaper closes sessions whose UpdatedAt is older than (now - idle_timeout).
  - `user_agent` string — UserAgent is the browser/player User-Agent (HTTP) or the equivalent flashVer field for RTMP. May be empty.
  - `user_name` string — UserName is a human label. Resolved from token claims if available, otherwise the fingerprint hash short form. Empty when no identity could be resolved.

## Other responses

- `404` — Not Found

---

[API](https://skmtc.net/datvietvac-techhub/apis/open-streamer-api.md) · [All operations](https://skmtc.net/datvietvac-techhub/apis/open-streamer-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datvietvac-techhub/open-streamer-api/revisions/9f723293b698/schema)
