Stream logs
TrueTick gives you two ways to read container logs: a snapshot (one request, recent lines) and a
live stream over Server-Sent Events (SSE). Both need only servers:read.
Snapshot
GET /v1/servers/{id}/logs?tail={n}&cursor={c} returns recent lines plus a cursor. Pass the returned
cursor back to poll incrementally for just the new lines since last time:
curl -s -H "x-api-key: $TRUETICK_API_KEY" \
"https://api.truetick.gg/v1/servers/my-smp/logs?tail=100"
# → { "lines": [...], "cursor": "...", "containerMissing": false }containerMissing: true means there's no running container to read from (hibernated / not yet started).
Live stream (SSE)
GET /v1/servers/{id}/logs/stream?tail={n} opens a Server-Sent Events stream. Each log line arrives as
one SSE event; the server also sends a heartbeat comment so the connection stays open through quiet
periods.
Frame format:
data: [12:00:01] [Server thread/INFO]: Done (12.3s)! For help, type "help"
: ping
data: [12:00:05] [Server thread/INFO]: player joined the gamedata: <line>— one log line.: ping— a heartbeat comment every 15 s. Ignore lines starting with:.
curl -N -H "x-api-key: $TRUETICK_API_KEY" \
"https://api.truetick.gg/v1/servers/my-smp/logs/stream?tail=50"-N disables curl buffering so lines print as they arrive. Ctrl-C to stop.
CLI shortcut:
truetick logs my-smp --follow # live stream, Ctrl-C to stop
truetick logs my-smp --tail 100 # snapshotBehavior & limits
- Backlog then live. The stream first replays
tailrecent lines, then follows new ones. - Non-running servers get the backlog, then the stream closes — there's no live tick loop to follow on a hibernated server.
- Concurrency caps: 3 concurrent streams per key and 10 per account. Exceeding either
returns
429(Too Many Requests). - Max duration: a stream is held open up to 30 minutes, then closes — reconnect to continue.
tailis clamped to[0, 1000](default 100).
The SSE stream is a raw streaming endpoint, so it isn't part of the JSON API Reference
(which renders only the request/response OpenAPI surface). It's a first-class, supported endpoint —
documented here and wrapped by streamLogs in the SDK.