Developer docs · v0.2

CLI & Overlay 0.2.0 · Schema 23step.run/v4 /docs/http-api.md

Writing runs over the HTTP API

Use the API when your agent or test harness is not one of the supported agents: create a run, add frames, commands, and artifacts as they happen, then finalize it and share the link. The CLI, hooks, and overlay use these same endpoints.

Base URL and keys

The base URL is https://api.23step.com. Send Authorization: Bearer st_... on every call. A key in a query string is rejected. Create keys on Account from a signed-in session: runs:write creates and writes runs, runs:read reads manifests/frames and connects to MCP, and ui opens the web viewer and /s/{share_id} routes (via Authorization: Bearer or POST https://app.23step.com/auth/token). Write and ui tokens cannot create or revoke API keys or mint upload tokens. Requests are rate limited per key and per organization, and image uploads have a daily byte allowance; both depend on the plan. Over a limit the API answers 429 with Retry-After.

New runs get your organization's default visibility (set in Settings, private unless an admin changed it). Change it per step in the browser or with PATCH /s/{share_id}. Secrets (API keys, tokens, passwords, cookies, private keys) are always redacted before storage; PII redaction (email addresses across prompts, commands, traces, session titles, notes, and DOM snapshots) is enabled by default and can be toggled on or off per organization in Settings.

Endpoints

Runs https://api.23step.com
Method and pathScopePurpose
POST /runsruns:writeCreate a run. Returns run_id and viewer_url.
POST /runs/{id}/framesruns:write or up_Describe one frame (or up to 50 as {"frames":[…]}) and get an upload URL for each PNG.
PUT <upload_url>noneUpload the PNG. The URL is valid for 15 minutes.
POST /runs/{id}/commandsruns:write or up_Record one shell command: text, cwd, exit code, timing. Never stdout or stderr.
POST /runs/{id}/artifactsruns:writeAttach a Markdown document or a PNG the agent produced.
POST /runs/{id}/frames/{seq}/noteruns:writeAdd an agent note to a frame ({"text":"…"}).
POST /runs/{id}/heartbeatruns:writeMark a long, quiet run as alive.
POST /runs/{id}/upload-tokensession (owner)Mint an up_ token for a subagent that may write only to this run. Write and ui tokens cannot mint tokens.
POST /runs/{id}/finalizeruns:writeClose the run and write its manifest.
POST /runs/{id}/shareruns:writeGet the step link (step_url).
GET /runs/{id}runs:readManifest: frames in seq order, gaps, finalized.
GET /runs/{id}/frames/{seq}runs:read or uiDownload the stored PNG for one frame.
GET /runs/{id}/feedbackruns:read or runs:writeReview comments left on the step. ?include_session=1 adds the session's other runs.
DELETE /runs/{id}runs:write (owner)Delete the run and its images. Returns 204.
Steps (browser session, `ui` key, or unauthenticated when public) https://app.23step.com
Method and pathPurpose
GET /s/{share_id}.jsonThe step as JSON (schema 23step.run/v4). Public steps need no auth; private/org steps accept a browser session or a ui-scoped API key.
GET /s/{share_id}.mdThe step as Markdown, for handing to another AI.
PATCH /s/{share_id}Owner session or ui key: change visibility (private, squad, team, org, public), discoverability, or retention (retention_mode: default, days, forever, with retention_days). apply_to_session: true updates every run in the session.
POST /s/{share_id}/commentsViewer in the org (session or ui key): comment on the step ({"text":"…"}). Comments reach a running agent through feedback.
POST /auth/tokenExchange a ui-scoped st_ key ({"token":"st_…"}) for an HttpOnly browser session cookie on https://app.23step.com.

1. Create a run

screen_w, screen_h, and scale describe the coordinate space of the frames you will send (scale must be above 0). Everything else is optional. prompt is redacted and capped at 16 KB. session_id chains successive prompts of one conversation; previous_step names an earlier run explicitly; correlation_id puts a parent agent and its subagents in one run. Set join_session: true to attach to a run already open for session_id instead of creating a second one.

Terminal POST /runs
curl -sS https://api.23step.com/runs \
  -H "Authorization: Bearer $STEP23_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "run_name": "nightly-e2e",
    "screen_w": 1280, "screen_h": 720, "scale": 1,
    "source": "my-harness",
    "prompt": "Check that checkout totals include tax",
    "session_id": "conv-8812",
    "agent_name": "e2e-bot",
    "git_repo": "github.com/acme/shop", "git_branch": "main"
  }'
# {"run_id":"6f0c2a7e-...","viewer_url":"https://api.23step.com/runs/6f0c2a7e-.../view"}
Optional run metadata
FieldMeaning
run_name, source, hostnameLabel, the client that recorded it, and the machine.
agent_name, agent_role, session_title, conversation_idShown on the run and the session.
git_repo, git_branch, workspaceWhere the agent worked.
is_background, background_kindBackground task: command, subagent, schedule, workflow, swarm.

2. Add frames

Each frame is two requests: a JSON description, then a PUT of the PNG to the upload_url it returns. seq runs from 1 to 5000, orders the timeline, and is the idempotency key: sending the same seq again returns the same object and a fresh URL. Send Content-Type: image/png and x-goog-if-generation-match: 0 on the PUT; a 412 means the image is already stored and counts as success.

Required fields: seq, trigger (click, key, or timer), ts (RFC 3339), x, y, window_title, app. Optional: url, button, key_category (a class such as letter or enter, never the key), description, and dom_snapshot (page text, so an AI can read the frame without the image).

Terminal POST /runs/{id}/frames + PUT
RUN=6f0c2a7e-5d1b-4c39-9a51-0b7f3f8e2c11

# 1. Describe the frame. The response holds a short-lived upload URL.
UP=$(curl -sS https://api.23step.com/runs/$RUN/frames \
  -H "Authorization: Bearer $STEP23_TOKEN" -H "Content-Type: application/json" \
  -d '{"seq":1,"trigger":"click","ts":"2026-11-23T10:00:00Z","x":640,"y":360,
       "window_title":"Checkout","app":"chrome","url":"https://shop.example/checkout","button":1}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["upload_url"])')

# 2. PUT the PNG there. No bearer on this request.
curl -sS -X PUT "$UP" -H "Content-Type: image/png" \
  -H "x-goog-if-generation-match: 0" --data-binary @frame-0001.png

3. Record commands and artifacts

Commands go on the same timeline as frames. They are redacted and capped at 8 KB, and limited to 10 per second per key. Artifacts are files the agent produced: kind is markdown (with text, up to 256 KB) or image (with base64 png). Each becomes one or more frames.

Terminal POST /runs/{id}/commands
curl -sS https://api.23step.com/runs/$RUN/commands \
  -H "Authorization: Bearer $STEP23_TOKEN" -H "Content-Type: application/json" \
  -d '{"command":"npm test","cwd":"/src/shop","shell":"bash","exit_code":0,
       "started_at":"2026-11-23T10:00:05Z","duration_ms":8120}'
# {"seq":2,"branch":"main","received_at":"..."}
Terminal POST /runs/{id}/artifacts
curl -sS https://api.23step.com/runs/$RUN/artifacts \
  -H "Authorization: Bearer $STEP23_TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"REPORT.md","kind":"markdown","text":"# Result\n\nAll 14 checks passed."}'
# {"seqs":[4001]}

4. Finalize and share

A run that stops receiving anything is eventually closed by the server. Send a heartbeat during long quiet stretches. finalize takes an optional body: outcome (such as completed, error, or stopped_by_user), reason, killed, and the same session and git metadata as POST /runs. A run that was never finalized still has a manifest from GET /runs/{id}.

Terminal heartbeat, finalize, share
# Keep a long run from being reaped as idle
curl -sS -X POST https://api.23step.com/runs/$RUN/heartbeat -H "Authorization: Bearer $STEP23_TOKEN"

# Close it
curl -sS https://api.23step.com/runs/$RUN/finalize -H "Authorization: Bearer $STEP23_TOKEN" \
  -H "Content-Type: application/json" -d '{"outcome":"completed"}'
# {"ok":true,"frame_count":3,"gaps":[]}

# Get the step link
curl -sS -X POST https://api.23step.com/runs/$RUN/share -H "Authorization: Bearer $STEP23_TOKEN"
# {"share_id":"9b1c...","step_url":"https://app.23step.com/s/9b1c...","visibility":"private",...}

Subagents

From a signed-in session, mint an up_ token for a subagent instead of handing out your key (write and ui API keys cannot mint new tokens). It lasts one hour by default and at most 24 hours (ttl_seconds, up to 86400) and can only add frames and commands to that one run: it cannot read, delete, mint tokens, or touch another run. Send it as Authorization: Bearer up_.... Mark the subagent's entries with branch and parent_branch so the step draws them as their own lane.

Terminal POST /runs/{id}/upload-token
curl -sS -X POST https://app.23step.com/runs/$RUN/upload-token \
  -b "step23_session=..." -H "Content-Type: application/json" \
  -d '{"ttl_seconds":3600}'
# {"token":"up_...","expires_at":"2026-11-23T11:00:00Z","run_id":"6f0c..."}

Read a step back

Terminal
# API-key reads (runs:read)
curl -sS https://api.23step.com/runs/$RUN           -H "Authorization: Bearer $STEP23_READ_KEY"
curl -sS https://api.23step.com/runs/$RUN/frames/1  -H "Authorization: Bearer $STEP23_READ_KEY" -o frame-1.png
curl -sS https://api.23step.com/runs/$RUN/feedback  -H "Authorization: Bearer $STEP23_TOKEN"

# Step viewer routes (public without auth, or private/org with a ui-scoped key or browser session)
curl -sS https://app.23step.com/s/<share_id>.json -H "Authorization: Bearer $STEP23_UI_KEY"
curl -sS https://app.23step.com/s/<share_id>.md   -H "Authorization: Bearer $STEP23_UI_KEY"

OpenTelemetry (OTLP)

Agents that already emit OpenTelemetry can send it directly: POST https://api.23step.com/v1/traces and POST /v1/logs accept OTLP/HTTP as protobuf (application/x-protobuf) or JSON, optionally gzip-compressed, with the same bearer key. Spans are mapped with the GenAI semantic conventions: gen_ai.conversation.id groups a session, prompts, thoughts, tool calls and results, responses, and token counts (gen_ai.usage.*) become the step's timeline.

OTel exporter
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.23step.com
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer st_REPLACE_WITH_YOUR_WRITE_KEY"
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf