Skip to content
sproutboatDocs
Esc
↑↓navigate↵open⌘Jpreview

Stream a running app's events live

text/event-stream, the frames sproutboat tail reads. Each data: line is one JSON object with a type:

  • ready, once, first.
  • event, with an event object shaped like a wrangler tail event: scriptName, outcome (ok, exception, exceededCpu, exceededWallTime, canceled, rateLimited, …), eventTimestamp (ms), event ({request: {url, method}, response: {status}} for a request, null otherwise), handler (fetch, scheduled or trigger: which handler ran; an addition to the Wrangler shape), cpuTime (always null), wallTime (ms), logs ([{level, message: [string], timestamp}]) and exceptions ([{name, message, timestamp, stack?}]). A request, a console line and an error are separate events: the host cannot tell which request printed a line, so lines are not grouped under their request, and their level is always log. url is the full request URL without its query string.
  • dropped, with count (events) or bytes, and reason (rate: over 100 events a second after the filters; backlog: the client or the host fell behind and output was skipped).
  • closed, with a reason (time: the session cap; host: the host closed its side; gone: the app was deleted). The stream then ends. A client reconnects.

A : keepalive comment arrives every 15 seconds. A session lasts at most 10 minutes; reconnect after closed. Events are live only: nothing is replayed (use GET /v1/apps/{project}/logs for what was printed before). Limits: 5 live viewers per app, 10 per team, and a bounded number per host (a 429 tail-viewers says which scope). Secret values of 8 characters or more are removed as in GET /v1/apps/{project}/logs.

The status, method, outcome and sampling-rate filters apply to request events; console lines and errors always pass them, so the lines of a failing request are not hidden. search applies to every event.

GET/v1/apps/{project}/tail
Authorization
AuthorizationBearer token · headerrequired

A team API key, sbk_..., from Settings, API keys.

or
x-api-keyAPI key · headerrequired

The same key, in a header of its own.

Path parameters
projectstringrequired

The app's name, unique within the team. 3 to 51 characters (or 1), lowercase letters, digits and dashes, not starting or ending with a dash.

matches ^[a-z0-9](?:[a-z0-9-]{1,49}[a-z0-9])?$
Query parameters
statusstring[]

ok (the outcome was ok), error (any other outcome but canceled), a code such as 404, or a class such as 5xx. Repeat the parameter or comma-separate.

methodstring[]

HTTP methods, repeated or comma-separated.

outcomestring[]

Outcome names, repeated or comma-separated.

sampling-ratenumber

Send only this fraction of request events, 0 to 1.

min 0 · max 1
searchstring

A text a message, URL or exception must contain (case-sensitive, at most 200 characters).

max length 200
Responses
200

The event stream.

string
400

The request is malformed. path names the field when one is at fault; some refusals (a digest mismatch, a body that is not JSON) carry a message only.

One of:
ErrorInvalid
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:invalid
ErrorPlain
errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
401

No key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
403

The key lacks a grant (reason: forbidden, need: "<resource>:<action>").

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:forbidden
needstringrequired

The grant, as <resource>:<action>, for example app:write.

404

No such app, build, secret, manifest or claim in this team (another team's resource looks the same).

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
429

Too many live tails (tail-viewers, with the scope that is full and Retry-After), or key-rate-limited.

One of:
ErrorKeyRateLimited
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:key-rate-limited
retry_after_sintegerrequired

Seconds to wait; also the Retry-After header.

ErrorTailViewers
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:tail-viewers
scopestringrequired

Which limit is full.

Allowed:appteamhostprocess
retry_afterintegerrequired

Seconds to wait; also the Retry-After header.

502

The host agent answered something the Cloud could not handle (reason: agent-error).

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:agent-error
503

The app's host is not reachable (host-unavailable), the app is not running on it yet (app-not-ready), or the audit log could not record the request (audit-unavailable). Retry shortly.

One of:
ErrorHostUnavailable
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:host-unavailable
ErrorAppNotReady
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:app-not-ready
ErrorAuditUnavailable
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:audit-unavailable
Request
curl -X GET 'https://dash.sproutboat.com/v1/apps/my-app/tail' \
  -H 'Authorization: Bearer YOUR_TOKEN'
Response
"data: {\"type\":\"ready\"}\n\ndata: {\"type\":\"event\",\"event\":{\"scriptName\":\"blog\",\"outcome\":\"ok\",\"eventTimestamp\":1795452909449,\"event\":{\"request\":{\"url\":\"http://blog.acme.sproutboat.app/log\",\"method\":\"GET\"},\"response\":{\"status\":200}},\"cpuTime\":null,\"wallTime\":12.3,\"logs\":[],\"exceptions\":[]}}\n\ndata: {\"type\":\"event\",\"event\":{\"scriptName\":\"blog\",\"outcome\":\"ok\",\"eventTimestamp\":1795452909448,\"event\":null,\"cpuTime\":null,\"wallTime\":0,\"logs\":[{\"level\":\"log\",\"message\":[\"hello from the log route\"],\"timestamp\":1795452909448}],\"exceptions\":[]}}\n"