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 aneventobject shaped like awrangler tailevent:scriptName,outcome(ok,exception,exceededCpu,exceededWallTime,canceled,rateLimited, …),eventTimestamp(ms),event({request: {url, method}, response: {status}}for a request,nullotherwise),handler(fetch,scheduledortrigger: which handler ran; an addition to the Wrangler shape),cpuTime(alwaysnull),wallTime(ms),logs([{level, message: [string], timestamp}]) andexceptions([{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 theirlevelis alwayslog.urlis the full request URL without its query string.dropped, withcount(events) orbytes, andreason(rate: over 100 events a second after the filters;backlog: the client or the host fell behind and output was skipped).closed, with areason(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.
/v1/apps/{project}/tailAuthorizationBearer token · headerrequiredA team API key, sbk_..., from Settings, API keys.
x-api-keyAPI key · headerrequiredThe same key, in a header of its own.
projectstringrequiredThe 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.
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-ratenumberSend only this fraction of request events, 0 to 1.
searchstringA text a message, URL or exception must contain (case-sensitive, at most 200 characters).
The event stream.
stringThe 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.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredinvaliderrorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerNo key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.
errorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerThe key lacks a grant (reason: forbidden, need: "<resource>:<action>").
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredforbiddenneedstringrequiredThe grant, as <resource>:<action>, for example app:write.
No such app, build, secret, manifest or claim in this team (another team's resource looks the same).
errorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerToo many live tails (tail-viewers, with the scope that is full and Retry-After), or key-rate-limited.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredkey-rate-limitedretry_after_sintegerrequiredSeconds to wait; also the Retry-After header.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredtail-viewersscopestringrequiredWhich limit is full.
appteamhostprocessretry_afterintegerrequiredSeconds to wait; also the Retry-After header.
The host agent answered something the Cloud could not handle (reason: agent-error).
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredagent-errorThe 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.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredhost-unavailableerrorstringrequiredA message for people. Do not parse it.
reasonstringrequiredapp-not-readyerrorstringrequiredA message for people. Do not parse it.
reasonstringrequiredaudit-unavailable