HTTP API
The espresso CLI uses this API, and you can call it too. All paths are relative to your server's base
URL. Requests and responses are JSON unless noted.
Authentication
Send an API token as a bearer token:
Authorization: Bearer esp_…
Tokens are created on the Settings page or with espresso-server admin create-token. There are two
scopes:
| Scope | Can |
|---|---|
full (default) |
everything the owner can do through the API |
upload |
only POST /api/v1/recordings, GET /api/v1/streams (start a stream) and GET /api/v1/me; reading also works for GET requests |
Browser pages use a session cookie instead. An API call made with the session cookie also needs an
X-CSRF-Token header.
Errors have the form {"error": "message"}. Reads that aren't allowed return 404, so they look the
same as a missing recording.
Who am I
GET /api/v1/me
→ 200 {"username": "alice"}. For an upload-scope token: {"username": "alice", "scope": "upload"}.
401 if the token is wrong.
Upload a recording
POST /api/v1/recordings?visibility=unlisted|public|private&title=<url-encoded>
Content-Type: application/x-asciicast
Authorization: Bearer …
<the .cast file>
Both query parameters are optional. Visibility defaults to unlisted, and the title defaults to the one in
the file. The body may be gzip-compressed (Content-Encoding: gzip).
To send an exec trace along, use multipart/form-data with a part cast (first, required) and a part
trace (the .trace.jsonl file).
curl -fsS -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/x-asciicast' \
--data-binary @demo.cast 'https://casts.example.org/api/v1/recordings?visibility=unlisted'
→ 201 {"id": "…", "url": "https://casts.example.org/r/…", "visibility": "unlisted"}
| Status | Meaning |
|---|---|
| 400 | bad visibility |
| 401 | missing or wrong token |
| 413 | too large (50 MB raw, 10 MB compressed), too long (6 h), too many events, or over quota |
| 415 | unsupported Content-Encoding or multipart layout |
| 422 | not a valid asciicast v2/v3 file, or an invalid trace |
| 429 | upload rate limit; see Retry-After |
Download
GET /api/v1/recordings/<id>.cast[?download=1]
GET /api/v1/recordings/<id>.trace.jsonl[?download=1]
Returns the file (application/x-asciicast, application/jsonl). download=1 makes it an attachment. Public
and unlisted recordings are readable by anyone with the id. Private ones only by their owner.
Metadata
GET /api/v1/recordings/<id>
{"id": "…", "url": "…", "owner": "alice", "title": "…", "description": "…", "visibility": "public",
"cols": 120, "rows": 40, "duration": 83.2, "poster_time": 0, "size": 48211, "has_trace": false,
"created_at": "2026-12-03T02:41:07Z"}
PATCH /api/v1/recordings/<id>
{"title": "…", "description": "…", "visibility": "public", "poster_time": 12.5}
Owner only, full scope. Any subset of the fields. The description can be up to 5000 characters, and
poster_time must be between 0 and the duration. → 200 with the new metadata; 422 for bad values.
DELETE /api/v1/recordings/<id>
Owner only, full scope → 204. Deletes the recording and its trace.
Edit on the server
POST /api/v1/recordings/<id>/edit
{"cut": ["0:10-0:42"], "redact": ["hunter2"], "redact_default": true, "speed": 1.5, "idle_limit": 2}
Owner only, full scope. Any subset of the fields. They work like the flags of
espresso edit: cut times are measured in the original recording, regular expressions use
RE2 syntax, and redaction also covers the title and the trace. The recording is replaced in place and keeps
its id and URL. → 200 {"id", "url", "visibility", "duration"}. Errors: 400 bad JSON, 403 upload-scope
token, 404 not yours, 422 bad values.
Search
GET /api/v1/search?q=<words>[&page=N]
→ {"query": "…", "page": 1, "more": false, "results": [{…metadata…, "snippet": "…"}]}
Searches titles, descriptions and the text of the recordings. Every word must match, as a prefix. Results include public recordings, plus the caller's own unlisted and private ones. Limited to 60 searches per IP per minute by default.
Live streams
Live streams use WebSockets and the espresso-stream/1 protocol:
GET /api/v1/streams?visibility=…with a bearer token: a producer (espresso stream) connects here. It sends a v3 header, gets{"type": "ready", "id", "url"}, then sends one v3 event array per message.GET /api/v1/streams/<id>/watch: viewers connect here and get the header, a replay of the screen since its last full clear, then live events. When the stream ends they get{"type": "end", "recording", "url"}.
Limits: 3 concurrent streams per user, 6 hours, 50 MB, and an end after 10 minutes without output, by default (see Configuration). Each message is at most 1 MiB. A viewer that can't keep up is disconnected and reconnects with a fresh replay.
Other endpoints
| Path | What |
|---|---|
GET /healthz |
200 when the server is up |
GET /oembed?url=… |
oEmbed, see Embedding |
GET /r/<id>, /e/<id>, /s/<id>, /u/<name>, /search?q= |
web pages: recording, embed, live stream, user, search |