API and personal access tokens
Reflow executes flows on your device or in CI through reflow plan and reflow apply (or MCP manage_execution). The hosted HTTP API at https://app.reflow.io/v1 provides programmatic access to read runs, stream step events, fetch signed screenshot URLs, manage knowledge-base flow content, and mint personal access tokens.
Auth and automation surfaces
Section titled “Auth and automation surfaces”| Surface | Authentication | Executes flows? | Primary use case |
|---|---|---|---|
HTTP API (https://app.reflow.io/v1) | Personal access token (rfl_pat_* bearer token; read, run, or admin scopes) | No | CI scripts, run polling, signed screenshot retrieval, KB flow reads/writes, PAT provisioning |
Local CLI & stdio MCP (reflow mcp, reflow mcp call) | Saved reflow login profile (or PAT in CI) | Yes | Authoring, local/CI execution, --hold live debugging, coverage queries, Review Apps |
Hosted HTTP MCP (https://mcp.reflow.io/mcp) | OAuth 2.1 browser consent | No | Read runs/evidence, inspect flows, manage collections/preferences from remote MCP hosts |
PR reviews & CI reporting (reflow pr review, reflow ci report --post) | GitHub App (reflow-code-review[bot]) + CLI profile/PAT | CI runs via CLI | Inline PR diff comments, PR review summaries, and CI run reports (PR review) |
For shell automation that needs the full local MCP toolset without an agent host, use reflow mcp tools and reflow mcp call <tool> '<json>' (MCP reference).
Create a token
Section titled “Create a token”Open Settings → API tokens in the Reflow dashboard (https://app.reflow.io) and grant only the required scopes (read, run, or admin). Tokens begin with rfl_pat_ and the plaintext value is shown once at creation. (App access and test execution require an approved team during closed beta.)
Send the token as a bearer header against the API base URL (replace https://app.reflow.io/v1 only if using a custom deployment):
export REFLOW_API=https://app.reflow.io/v1export REFLOW_TOKEN=rfl_pat_...Every authenticated request sends:
Authorization: Bearer <token>An existing admin token can also mint scoped tokens programmatically:
curl --fail-with-body -X POST "$REFLOW_API/tokens" \ -H "Authorization: Bearer $REFLOW_TOKEN" \ -H "Content-Type: application/json" \ --data '{"name":"CI","scopes":["run"]}'Store the returned plaintext token immediately—it cannot be retrieved again.
Follow a run
Section titled “Follow a run”reflow apply prints the ID of each run it creates, and --result-file records them as JSON. Poll a run record, long-poll step events, or fetch a short-lived step screenshot URL:
curl --fail-with-body \ -H "Authorization: Bearer $REFLOW_TOKEN" \ "$REFLOW_API/runs/$RUN_ID"
curl --fail-with-body \ -H "Authorization: Bearer $REFLOW_TOKEN" \ "$REFLOW_API/runs/$RUN_ID/events?wait=20"
curl --fail-with-body \ -H "Authorization: Bearer $REFLOW_TOKEN" \ "$REFLOW_API/runs/$RUN_ID/screenshot?step_idx=0"GET /v1/runs/{run_id} is safe while a run is active. The events endpoint long-polls for up to 20 seconds and returns current status alongside new step events.
Endpoint reference
Section titled “Endpoint reference”| Method | Path | Purpose |
|---|---|---|
GET | /v1/runs | List recent runs, newest first. |
GET | /v1/runs/{run_id} | Read run status and step evidence. |
GET | /v1/runs/{run_id}/events | Long-poll the run timeline (?wait=20). |
GET | /v1/runs/{run_id}/screenshot | Fetch a short-lived step screenshot URL (?step_idx=N). |
GET | /v1/flows | List flows with version pointers (tags: latest, main) and flow-file tags (flow_tags). |
POST | /v1/flows | Create a knowledge-base flow with current collection and policy storage fields. |
PUT | /v1/flows/{slug}/content | Save full knowledge-base source with optimistic concurrency fields. |
POST | /v1/tokens | Mint a PAT with name and scopes (admin scope required). |
POST /v1/runs returns 410 Gone and points to reflow plan and reflow apply.
Concurrency and storage fields
Section titled “Concurrency and storage fields”For interactive authoring, prefer manage_flows, reflow flows create, or reflow flows save after refreshing get_reflow_context. When calling POST /v1/flows or PUT /v1/flows/{slug}/content directly:
| Operation | Required fields | Conflict / authority rule |
|---|---|---|
Create KB flow (POST /v1/flows, storage-enabled team) | Current storage.collectionId, storage.policyRevision, storage.sourceKind: "knowledge_base" | Read live values from get_reflow_context; never guess policy revisions. Storage-disabled teams may omit storage. |
Update collection-scoped KB flow (PUT /v1/flows/{slug}/content) | Freshly read source_revision and exact base_version_id | On 409 Conflict, re-read the flow, rebase your edits, and retry. Unscoped saves accept optional concurrency guards. |
| Repository-owned flows | N/A over HTTP | Must be created and saved on the connected author device with the Git checkout. |
For CI execution, PR progress comments, and automated reporting, see GitHub Actions and PR review.