Skip to content

Documentation

API

REST API for external systems to create and manage Syrus Jobs.

REST API

Syrus exposes two REST surfaces. The user API under /api/v1/app/* is the programmatic version of the browser app: personal API tokens authenticate as their owning user and inherit that user's repository, Job, Epic, chat, and settings permissions. The operator API under /api/v1/admin/* is for instance-wide automation and requires an admin user's token.

curl -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  https://syrus.example.com/api/v1/admin/overview

Non-admin tokens are accepted on /api/v1/app/* endpoints and are scoped by the same authorization policies as the browser UI. /api/v1/admin/* endpoints reject non-admin tokens with 403 Forbidden; missing or invalid tokens return a JSON 401 error.

Payload version

Every JSON response includes a top-level v field. The current value is 1:

{ "v": 1, "jobs": [] }

Syrus has one current payload version and does not serve compatibility variants. The version changes only when a breaking payload change requires clients to update; the server, browser app, desktop app, and CLI ship together. Browser, installed PWA, and desktop-shell clients save drafts and show a visible countdown when versions differ. For compatible application revisions, they announce the update without interrupting the current page and pick it up when the user reloads or next navigates. Additive fields do not require a version bump, and clients continue to ignore fields they do not recognize.

The generated user API catalog lists every registered /api/v1/app/* endpoint. Operator/admin endpoint inventory lives with the engineering catalog in docs/engineering/architecture/admin_api_catalog.md.

Dashboard clients can fetch section=chrome and section=rows separately. Stable controls are available from GET /api/v1/app/dashboard/controls?subject=job|epic|workflow with private one-hour caching and ETag revalidation. Omitting section retains the merged response for compatibility; bulk responses expose affected and skipped IDs. Chrome omits each saved folder's filter tree; when a folder is selected, active_smart_folder_filter carries only that folder's definition.

Repeated invalid bearer tokens from the same source IP are rate-limited (20 per 5 minutes); once tripped, further bad-token attempts from that IP get a 429 Too Many Requests with error.code rate_limited until the window expires. A request with no Authorization header, or a valid token, never counts against or is blocked by this limit.

Command Line Client

The repository includes a standalone Go CLI under cli/. It sends the same bearer token header as the REST examples and exposes chat, inbox, checkout, Job, Epic, repository, and schedule commands. See Syrus CLI for installation, login, command reference, and terminal workflows.

Mobile Devices

First-party native apps (the iOS app under ios/) register their APNs device token so Syrus can push in-app notifications. Both endpoints act on the signed-in user and accept a browser session or a bearer token.

# Register or refresh a token (idempotent; the token moves to the caller if
# another user held it).
curl -X POST -H "Authorization: Bearer $SYRUS_API_TOKEN" -H "Content-Type: application/json" \
  -d '{"token":"<hex>","bundle_id":"app.syrus.ios","apns_environment":"sandbox"}' \
  https://syrus.example.com/api/v1/app/mobile_devices

# Remove a token you own.
curl -X DELETE -H "Authorization: Bearer $SYRUS_API_TOKEN" -H "Content-Type: application/json" \
  -d '{"token":"<hex>"}' https://syrus.example.com/api/v1/app/mobile_devices/unregister

Registration returns 201 with a mobile_device object; invalid tokens return 422. Two further calls help debug push setup:

# List your registered devices (tokens are masked to their last six characters)
# and whether the server has APNs credentials.
curl -H "Authorization: Bearer $SYRUS_API_TOKEN" https://syrus.example.com/api/v1/app/mobile_devices

# Send a test push to your own device(s); optionally narrow with {"token":"<hex>"}.
curl -X POST -H "Authorization: Bearer $SYRUS_API_TOKEN" -H "Content-Type: application/json" \
  -d '{}' https://syrus.example.com/api/v1/app/mobile_devices/test_notification

The test push deep-links to /notifications and creates no notification record. It answers 503 (apns_not_configured) when the server has no APNs credentials and 422 (no_registered_device) when you have no active device; otherwise results reports delivered, token_rejected, failed, or error per device. Delivery requires the APNs environment variables described in ios/README.md.

The native app also posts up to 100 locally delivered notification IDs to POST /api/v1/app/notifications/reconcile, optionally with up to 100 opened_notification_ids. The legacy scalar opened_notification_id remains accepted. The authenticated response returns unread_count and actionable_notification_ids, plus acknowledged_opened_notification_ids when opened alerts were processed; IDs belonging to another user are ignored.

Browser Sessions

Browser clients can end the current signed-cookie session with DELETE /api/v1/app/auth/session. The endpoint returns a JSON redirect path for the sign-in screen and clears the browser session cookie. Bearer tokens are not browser sessions, so bearer-token requests receive token_session_not_destroyable instead of silently succeeding.

Terminal Sessions

When the terminal plugin is enabled, user-scoped app API clients can manage their own interactive terminal sessions. GET /api/v1/app/terminal_sessions lists the authenticated user's running sessions (sessions only, with an ETag for cheap polling), GET /api/v1/app/terminal_sessions/workspaces?query= lists the workspace candidates for the new-session picker, and GET /api/v1/app/terminal_sessions/open_count returns just the count. With the plugin disabled these endpoints return plugin_disabled. Admins can use POST /api/v1/app/terminal_sessions to create a session with an optional workflow_id, candidate_key, and name. Syrus selects the working directory from the chosen workspace; scratch sessions use the app root, and caller-supplied filesystem paths are ignored.

curl -X POST https://syrus.example.com/api/v1/app/terminal_sessions \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "workflow_id": 8454, "name": "Workflow 8454" }'

GET /api/v1/app/terminal_sessions/:id returns one session scoped to the authenticated user, and POST /api/v1/app/terminal_sessions/:id/kill marks that session killed so the relay terminates the PTY. Session payloads include id, name, working_directory, relay_address, timestamps, outcome, and workflow_id; they never include the relay auth token.

Admin API clients get the same surface across every user: GET /api/v1/admin/terminal_sessions lists sessions, filterable by ?state=running|finished, ?user=<email substring>, and ?hostname=<relay host>; GET /api/v1/admin/terminal_sessions/:id returns one session; POST /api/v1/admin/terminal_sessions/:id/kill kills it through the same write path the app API uses. Admin payloads add state, hostname, age_s, and an owning user summary. With the plugin disabled, every endpoint — app and admin — returns plugin_disabled.

curl -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  "https://syrus.example.com/api/v1/admin/terminal_sessions?state=running"

MCP Bridge

/mcp/bridge serves Syrus's chat MCP tools over streamable HTTP for an external MCP client such as Claude Code. Authenticate with an MCP bridge token -- not your API token -- created under Account settings → MCP bridge or with POST /api/v1/app/mcp_bridge_tokens (name required; the plaintext is returned once). GET lists your tokens and DELETE /api/v1/app/mcp_bridge_tokens/:id revokes one.

claude mcp add --transport http syrus https://syrus.example.com/mcp/bridge \
  --header "Authorization: Bearer $SYRUS_MCP_TOKEN"

The client gets exactly the tools one of your chats would offer, through the same permission rules. Each token acts in its own MCP bridge chat, where its confirmation cards and authorization requests appear for you to decide; Syrus's own chat agent never replies in that chat.

Attention Report

When the optional Attention Report plugin is enabled, authenticated app clients can request GET /api/v1/app/insights/attention?window_days=7. The endpoint returns only the signed-in user's deciding, judging, and wasted-attention signals. Each inferred rule remains separately named and marked as an estimate; agent runtime and queue wait are separate machine-time fields and are never added to attention.

The response also includes p50 and p90 active time by page type when core page engagement telemetry is enabled. Every percentile includes its cleaned sample count, and small samples return not_enough_data instead of a number. The window defaults to 7 days and is limited to 1–90 days.

Review Workspace

When the bundled Review Workspace plugin is enabled, GET /api/v1/app/review_workspace returns the signed-in operator's actionable review stack and GET /api/v1/app/review_workspace/count returns the matching sidebar badge count. Both endpoints run the same eligibility query and revalidate visibility, write access, approval eligibility, and active runtime work on every request.

List entries contain compact Job, repository, priority, ready-time, dependency, and pull-request identifiers for opening the active review. Ordering is deterministic: dependency-ready first, then explicit priority, oldest ready time, and Job ID. Disabled plugins return a not-found response for both routes.

Repository API payloads

GET /api/v1/app/repositories returns the active and archived rows used by the web application. CLI clients request ?shape=cli to additionally receive the compact repositories list with active-job and latest-job summaries. Create and update responses are intentionally compact: they contain the saved repository id, localized message, redirect_to, and credential_status.

The repository owner, repository, and branch selector endpoints accept an optional q substring filter. Their responses are cached briefly per user and include ETags. Repository coverage trends also include ETags, and their days window is limited to 1–365 days.

Repository detail data is split by the section that consumes it. The base GET /api/v1/app/repositories/:id response carries shared repository metadata, tabs, actions, and paths. Paginated jobs, health history, delivery tracks, and the parsed .syrus.yml summary are available from /jobs, /health_history, /delivery, and /syrus_yml respectively. Callers that need a combined response may pass a comma-separated include list to the base endpoint. GET /api/v1/app/repositories/:id/cognitive_debt?view=summary returns the overview-sized rollups and top items; omit view for the complete tab payload.

Repository command endpoints return a localized confirmation message instead of re-rendering repository lists or detail payloads. Membership, team-access, final-approver, and document mutations return only the changed row or deleted ID so clients can patch their caches. Repository documents are paginated, and readiness clients can fetch a compact summary and poll an active execution probe separately with conditional requests.

Throughput Metrics

Authenticated app clients can read the versioned repository snapshot at GET /api/v1/app/repositories/:id/throughput_metrics. The payload's cache_status is fresh, computed, or stale; generated_at remains the time its metric windows were computed. If a cold snapshot is already being computed elsewhere, the endpoint returns 503 with throughput_snapshot_unavailable rather than an empty metric set.

When the throughput plugin is enabled, admin API clients can pull instance-wide throughput without writing SQL against production:

curl -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  "https://syrus.example.com/api/v1/admin/throughput?since=2026-08-30T00:00:00Z&until=2026-09-06T00:00:00Z"

GET /api/v1/admin/throughput returns Jobs created versus closed per bucket, Jobs reaching implemented per bucket, and the median/p90 cycle time from Job creation to pr_merged. The default response contains only non-empty daily buckets; pass granularity=hourly for incident-scale data. Pass repository (a numeric id or owner/name slug) to scope to one repository instead of the whole instance, and since/until (ISO-8601, consistent with /api/v1/admin/runs?since=) to bound the window -- default is the trailing 7 days, clamped to at most 90. All timestamps in the response are UTC. With the plugin disabled this endpoint returns plugin_disabled.

Heavy token-API fields are opt-in. GET /api/v1/admin/jobs/:id returns the latest three workflows by default; use workflows=latest or workflows=N, and verbose=1 for workflow artifacts and classifier inputs. The job list accepts fields=min to omit mergeability, emergency-landing, and provenance details. Run artifacts require include=diff, include=logs, or both.

Job and Epic list/detail payloads include proposer, either null or { type, id, label, handle }. Their admin list endpoints accept proposer=<handle>; an unknown handle returns an empty list.

Epic details cap descriptions at 4,000 bytes by default (description_max=N) and accept jobs=false to omit child Jobs. Epic owner data is returned once as owner: { status, user }. Chat details accept content_max=N and tool_results=false; attachments, bookmarks, and proposals are limited to a first page of 50 each, adjustable up to 100 with related_per=N, with totals in related_page.

Worker health omits raw_metrics unless include_raw_metrics=true; permission-parity grouping requires summary=1; and build-cache statistics require include_stats=true. Repository test details omit failure bodies unless include_failures=true.

Create a Direct Job

POST /api/v1/admin/jobs creates a direct Job and starts the normal initial workflow when the Job is not blocked by dependencies or an Epic. The Job belongs to the owner of the target repository, so the repository owner's GitHub and agent credentials are used.

curl -X POST https://syrus.example.com/api/v1/admin/jobs \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "job": {
      "repository": "acme/widgets",
      "title": "Update the README",
      "prompt": "Add API setup instructions to the README.",
      "priority": "high",
      "agent_provider": "codex"
    }
  }'

Use either repository_id or repository/repo as owner/name. Optional fields are title, priority (high, medium, low), agent_provider, epic_id, and owner_user_id. When title is blank or omitted, Syrus derives a short deterministic title from the prompt.

POST /api/v1/app/jobs is the non-admin equivalent — the Job belongs to the authenticated token user rather than the repository owner, and it accepts either repository_id or repository/repo as an owner/name slug for one of that user's own active repositories (the syrus job create CLI command posts here). It accepts the same optional title, prompt, priority (urgent, high, medium, low), agent_provider, epic_id, and owner_user_id fields; epic_id must reference an Epic in the same repository, and owner_user_id must reference a user who is a member of that repository.

Invoke an Operator Action

POST /api/v1/admin/pending_actions/invoke runs one registered PendingActions operation by action_key. This is the scriptable equivalent of confirming a chat pending action: there is no confirmation token or pending state, and the API call itself is the confirmation. The endpoint requires an admin API token and a non-blank reason; successful calls record an audit row with the acting user, action key, payload, reason, and result.

curl -X POST https://syrus.example.com/api/v1/admin/pending_actions/invoke \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "action_key": "reenqueue_work",
    "reason": "Queued run was left behind after worker restart.",
    "payload": { "job_id": 42, "run_id": 314 }
  }'

If the operation's own payload validation rejects the request, the response is 422 with error.code invalid_pending_action_payload. If an operation raises ArgumentError for a user-facing condition, such as a missing Run or an ineligible state, the response is also 422 with error.code pending_action_operation_failed. Chat-bound operations that require a live chat session or a persisted chat pending-action record, such as Coding Mode handoffs, are rejected before execution rather than being auto-confirmed through this endpoint.

Submit Job Feedback

All job and epic endpoints accept a numeric ID, the JOB-<n> / EPIC-<n> prefix format, or a human-readable slug derived from the issue or epic title (e.g. /api/v1/app/jobs/repair-aqueduct). Slugs are auto-generated at Job / Epic creation and are unique per instance.

GET /api/v1/app/slug_refs/:slug resolves canonical display refs such as JOB-<id>, EPIC-<number>, CHAT-<id>, and WF-<id> through the shared slug registry. The response includes the canonical ref, type, prefix, numeric id, access flag, app path, preview API path when available, copy/linkification defaults, and mobile interaction hints. Known-but-missing or inaccessible refs return a neutral payload with accessible: false and no app path; malformed known refs return 400, and unknown prefixes return 404. /api/v1/app/slugs/:slug is an alias, and browser navigation can use either /s/:slug or a bare root ref such as /JOB-<id> to redirect accessible refs to their app page.

GET /api/v1/app/workflows/:workflow_id/preview returns the focused workflow preview used by slug hover and touch interactions: canonical slug and path, human-readable workflow type, workflow state, and a compact projected step list. Access follows the parent Job's visibility rules.

POST /api/v1/app/jobs/:id/chat_feedback lets the authenticated job owner submit follow-up feedback directly, without confirming a chat pending action. The Job must belong to the token user and be in implemented or failed state. Syrus creates a chat_feedback Workflow on the existing branch.

curl -X POST https://syrus.example.com/api/v1/app/jobs/123/chat_feedback \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "body": "Please simplify the settings copy and keep the existing layout." }'

Blank feedback or a non-actionable Job returns 422 with a JSON error.

Run Artifacts

GET /api/v1/app/jobs/:job_id/runs/:run_id/artifacts returns one bounded Run artifact. Use artifact=transcript for paginated logs and after_sequence=N to poll only newer rows. Transcript responses include an ETag that changes for new logs and Run or Job state transitions. artifact=agent_diff and artifact=step_agent_diff are loaded separately; diffs over 2 MB return a bounded preview with a *_truncated marker, and full=true retrieves the complete diff on explicit request. run_id=latest selects the newest Run.

The legacy GET /api/v1/app/jobs/:id/transcript endpoint accepts limit (capped at 200) and tail=true|false, applies a 1 MB response cap, and reports lines_truncated. New clients should use the artifacts endpoint.

Target Graph Inspection

User-scoped app API clients can inspect compiled project and target graph data for repository and workflow debugging:

  • GET /api/v1/app/repositories/:id/target_graph
  • GET /api/v1/app/jobs/:job_id/target_graph
  • GET /api/v1/app/workflows/:workflow_id/target_graph

Read access follows the same repository and Job visibility rules as the app UI. The repository endpoint compiles the default branch. The Job endpoint uses the latest Workflow unless workflow_id is provided, and the Workflow endpoint inspects that concrete Workflow.

The endpoints accept limit, offset, project_id, kind, and q. limit defaults to 100 and is capped at 2,000. They also accept mode=neighborhood for progressive graph rendering. Neighborhood requests can send focus_label, focus_state (failing, selected, skipped, or cached), direction (both, dependencies, or dependents), and depth (capped at 4). selected, skipped, and cached come from workflow artifacts, so use the Job or Workflow endpoint for those runtime states; repository graphs support label, project/filter, and failing-health entry points. Responses include projects referenced by the current page, windowed or neighborhood targets, dependency edges, compiler diagnostics, and page-scoped target health. Selection explanations and the compiler's complete target-label list are opt-in through include=explanations,diagnostics so normal paging remains compact:

curl "https://syrus.example.com/api/v1/app/jobs/123/target_graph?limit=100&kind=grader" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

curl "https://syrus.example.com/api/v1/app/jobs/123/target_graph?mode=neighborhood&focus_state=selected&depth=2" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

Each target includes its label, kind, project id, source scope, dependencies, owning config path, executable flag, and executable metadata such as command, phases, requiredness, timeout, and raw target metadata. Workflow-scoped responses also include selection overlays when the Workflow recorded them: selected, skipped, or cached, with the recorded reason and any available target-health references.

health.targets and health.summary are scoped to the current target window, not the whole repository graph. Page through the target list to inspect more health rows without asking the server to serialize an unbounded graph.

Diff Review Comments

Diff and source browsing use compact, cacheable reads. GET /api/v1/app/jobs/:id/source_diff returns changed-file metadata including patch_bytes; fetch an individual text patch with source_file_diff using the returned exact base/head SHAs. Historical version lists come from diff_review_versions, and a selected version likewise returns file metadata without embedding every patch. Source trees come from source; selected file content comes from source_file?ref=<sha>&path=<path>. Exact-revision file and patch responses use private immutable caching.

User-scoped app API clients can persist Syrus-owned diff review comments without coupling the review UI to GitHub PR comments. GET /api/v1/app/jobs/:job_id/diff_review_comments lists comments visible for a Job. It accepts optional surface, base_ref, head_ref, path, and state, workflow_id, and run_id filters. Read access follows normal Job visibility. Source-browser diff comments use surface=job_source_diff; run artifact diffs use surface=run_agent_diff or surface=run_step_agent_diff, and should include workflow_id plus run_id when listing comments for a concrete artifact panel.

POST /api/v1/app/jobs/:job_id/diff_review_comments creates a comment, and PATCH /api/v1/app/jobs/:job_id/diff_review_comments/:id updates one. POST /api/v1/app/jobs/:job_id/diff_review_comments/:id/resolve marks a comment resolved. Mutations use the same Job write policy as approve, retry, and feedback actions: the job owner, an admin, or a write-tier repository member.

DELETE /api/v1/app/jobs/:job_id/diff_review_comments/:id hard-deletes a comment that is still in draft — once a comment has been submitted, resolved, or superseded it's part of the review history and the endpoint returns 422 instead. On success the response is { "job_id": ..., "deleted_id": ... }.

POST /api/v1/app/jobs/:job_id/diff_review_comments/submit accepts comment_ids and starts a chat_feedback workflow for the selected unresolved comments. The workflow receives both a readable feedback body and structured diff_comments artifacts containing the comment body, path, side, old/new line coordinates, base/head refs, hunk snapshot, optional Workflow/Run links, and context. Accepted comments are marked submitted and linked to the created workflow; duplicate active chat_feedback submissions for the same Job return a validation error.

curl -X POST https://syrus.example.com/api/v1/app/jobs/123/diff_review_comments \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "diff_review_comment": {
      "surface": "job_source_diff",
      "base_ref": "base-sha",
      "head_ref": "head-sha",
      "path": "app/models/widget.rb",
      "side": "right",
      "new_line": 42,
      "diff_hunk": "@@ -40,2 +40,3 @@",
      "body": "Please add a regression spec.",
      "context": { "symbol": "Widget#call" }
    }
  }'

Comment payloads include durable anchors (path, side, old_line, new_line, base/head refs, and hunk/context data), lifecycle state (draft, submitted, resolved, or superseded), timestamps, and author details. Responses include both a flat comments array and by_path, keyed by file path and an anchor key such as right::42 or left:38:.

Every comment also carries anchor_kind, either "line" (the default, tied to a specific file/side/line) or "review" for a whole-review comment that isn't anchored to any code line. Create a whole-review comment by posting anchor_kind: "review" with no path/side/old_line/new_line — Syrus clears those fields regardless of what's sent. Whole-review comments submit through the same submit endpoint alongside line-anchored ones and appear in by_path under the "__review__" group with anchor key "review".

File a Syrus Report Issue

POST /api/v1/app/report_issue lets the authenticated user file a GitHub issue against the configured Syrus report repository. The default target is tkadauke/syrus; operators can change AppSetting.report_issue_repo_slug. The user must have a connected GitHub token.

curl -X POST https://syrus.example.com/api/v1/app/report_issue \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Chat composer bug", "body": "Context and reproduction steps." }'

The response is { "issue_url": "https://github.com/..." }. Missing title or GitHub credentials returns 422 with a JSON error.

Create an Epic

POST /api/v1/admin/epics creates an Epic in a repository owned by the repository's Syrus user.

curl -X POST https://syrus.example.com/api/v1/admin/epics \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "epic": {
      "repository": "acme/widgets",
      "title": "Documentation cleanup",
      "description": "Group the docs polish work.",
      "auto_approve_mode": "never"
    }
  }'

Optional fields are github_issue_url, owner_user_id, and auto_approve_mode.

User-scoped clients can also create Epics through the app API with any user API token when the caller has write-tier repository access (directly, through a team grant, or as a global admin). Use repository/repo as an owner/name slug, or repository_id when the caller already has the database id:

curl -X POST https://syrus.example.com/api/v1/app/epics \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "epic": {
      "repository": "acme/widgets",
      "title": "Documentation cleanup",
      "description": "Group the docs polish work."
    }
}'

GET /api/v1/app/epics?compact=picker returns the small Epic shape used by selection controls. GET /api/v1/app/epics/:id/preview returns the bounded hover-card payload with aggregate Job state counts, while GET /api/v1/app/epics/:id/history loads the version history separately from the main detail response. The Dependencies and Jobs tabs similarly load GET /api/v1/app/epics/:id/dependencies and GET /api/v1/app/epics/:id/provider_availability only when needed.

Manage Design Docs

When the design_docs plugin is enabled, admin tokens can manage design docs through /api/v1/admin/design_docs instead of the SPA's session-shaped app API. GET /api/v1/admin/design_docs lists docs across every owner, filterable by state (draft/accepted/archived), visibility (private/public), and user (a substring match against the owner's email address). Results are paginated 50 at a time with page; the response includes pagination.page, per_page, total, and total_pages.

curl -X POST https://syrus.example.com/api/v1/admin/design_docs \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "design_doc": {
      "title": "Deploy runbook",
      "markdown": "# Deploy runbook\n\n..."
    }
  }'

GET /api/v1/admin/design_docs/:id returns the full detail payload including rendered_markdown (the editable body with internal anchor markers removed), but does not duplicate it under a second markdown key. It also includes canonical_revision, a SHA-256 fingerprint covering title, Markdown, state, visibility, repositories, and collaborators. Updates may send that fingerprint as base_revision; if an intervening suggestion review or canonical edit changed the document, Syrus returns 409 with error.code: "revision_conflict" without applying the stale body. Clients should fetch the current document, reconcile their draft, and retry with its new revision. PATCH /api/v1/admin/design_docs/:id updates title/markdown/state and, on a canonical edit, records a new version — every admin PATCH checkpoints by default, so it always produces a version row the way an explicit Save does in the editor. Archived docs are non-destructive records; owners can restore them to draft from the Design Docs editor. GET /api/v1/admin/design_docs/:id/versions returns paginated version metadata without document bodies. Pass include=markdown when a token client explicitly needs bodies for the returned page. App clients fetch one selected version's body from its version-threads endpoint. Mutation responses are deltas containing the new canonical_revision and any changed version or suggestion rather than echoing the full document; accepting a suggestion is the exception because it replaces the editor's canonical document. With the plugin disabled, every endpoint answers plugin_disabled.

Scheduled Tasks

When the scheduled_tasks plugin is enabled (on by default), admin tokens can inspect and operate ScheduledTasks instance-wide — the same pause/unpause/fire actions available from the Schedules UI, reachable without a browser session. With the plugin disabled these endpoints return plugin_disabled. Authoring (create/edit/delete) stays app-API/SPA-only.

GET /api/v1/admin/scheduled_tasks lists tasks across every repository and user, filterable by repository (owner/name), user (email substring), kind (cron or one_shot), paused (true/false), and due_before (ISO 8601 — tasks whose next fire time falls before it). Archived tasks are excluded by default.

curl "https://syrus.example.com/api/v1/admin/scheduled_tasks?paused=true" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

GET /api/v1/admin/scheduled_tasks/:id returns full detail, including the cron expression, pr_pileup_policy, consecutive_failure_count, schedule_timezone, last_fired_at, and next_fire_at. Recurring expressions are wall-clock rules in that stored IANA zone; returned occurrence instants are ISO 8601 UTC values.

POST /api/v1/admin/scheduled_tasks/:id/pause and .../unpause toggle a task the same way the operator UI does — useful for silencing a task that is filing broken Jobs every hour without waiting on AppSetting.max_job_failures to auto-pause it.

POST /api/v1/admin/scheduled_tasks/:id/fire fires the task once immediately, producing the same kind=cron Job the poller would (prompt rendered at fire time), without waiting for its next scheduled window. Useful for testing a task's prompt end-to-end.

curl -X POST https://syrus.example.com/api/v1/admin/scheduled_tasks/42/fire \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

GET /api/v1/admin/cron_templates and GET /api/v1/admin/cron_templates/:id are read-only lookups for the reusable schedule + prompt templates tasks can be created from, filterable by user.

Test Insights

Requires the test_insights plugin (bundled, on by default). It exposes an operator-facing admin twin of the read-only Test Insights MCP tools agents already use, so debugging a flaky or failing grader doesn't require scraping Run transcripts.

GET /api/v1/admin/repositories/:repository_id/tests lists a repository's tests, filterable by state (recently_seen, failing, flaky, slow) and sortable by sort/direction (last_seen, last_failed, last_duration, failure_rate, avg_duration, p50_duration, p95_duration):

curl -G https://syrus.example.com/api/v1/admin/repositories/123/tests \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -d state=flaky -d sort=failure_rate -d direction=desc

Each test row includes links to its latest Run, Workflow, and Job when those records are available.

GET /api/v1/admin/repositories/:repository_id/tests/:id returns one test's execution history, duration points, and related Run/Workflow/Job references.

GET /api/v1/admin/jobs/:job_id/test_results returns the ingested test results for a Job's most recent Workflow with test data — compact by default; pass include_suites=true or include_slow_cases=true for more detail, grader_name to scope to one grader, and case_limit to select up to 100 detailed cases per test run. The default is 20; the response's truncation object reports omitted cases. Failure text fields are limited to 2 KiB each.

curl https://syrus.example.com/api/v1/admin/jobs/456/test_results \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

All three read from the same TestInsights::Query/TestInsights::Detail/ TestInsights::RunResults service objects the list_repository_test_insights, read_test_insight, and read_job_test_results MCP tools call, so the admin API and agent tools never see different data. With the plugin disabled, all three answer 404 with { "error": { "code": "plugin_disabled" } }.

Rename a Chat

POST /api/v1/app/chats/:id/rename (also accepted as PATCH) renames one of the authenticated user's chat sessions. name is required and must be 120 characters or fewer.

curl -X POST https://syrus.example.com/api/v1/app/chats/123/rename \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Release planning" }'

Delete a Chat

DELETE /api/v1/app/chats/:id soft-deletes a chat owned by the authenticated user. Group members cannot delete the shared conversation. Audit records such as messages, stored attachment files, and proposals remain in the database, while search index entries and workspace files are cleaned up. A later hard purge of the chat destroys its attachment records and purges their Active Storage blobs (dependent: :purge). There is no UI undo — use hide/unhide for reversible cleanup. The request is refused with 409 Conflict (error.code turn_in_flight) while a turn is actively running.

curl -X DELETE https://syrus.example.com/api/v1/app/chats/123 \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

Pin or Unpin a Chat

PATCH /api/v1/app/chats/:id accepts { "pinned": true } or { "chat": { "pinned": true } } for a chat owned by the authenticated user. Use false to unpin. The pin is shared session state, so group members cannot change it through the API, sidebar, or chat-agent tools. Pinned chats sort ahead of unpinned chats in the sidebar.

curl -X PATCH https://syrus.example.com/api/v1/app/chats/123 \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "chat": { "pinned": true } }'

Chat providers are pinned when a chat is created. Switching an existing chat to another configured provider uses POST /api/v1/app/chats/:id/switch_provider with { "provider": "codex" } or another enabled provider slug such as "claude", "agy", or "muse" so Syrus can run the provider rehydration flow before updating the stored provider. A provider is eligible only when its plugin is enabled and the authenticated user has the required credentials saved.

Branch a Chat

POST /api/v1/app/chats/:id/branch creates a new chat session for the authenticated user, attached to the same repository, with the current transcript copied into it. The response includes the new chat id and app_path for navigation.

curl -X POST https://syrus.example.com/api/v1/app/chats/123/branch \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

Share a Chat

The chat Share dialog lets the owner grant another person live, read-only access. Recipients see the complete history, attachments, tool results, and later messages under Shared with me, but cannot post or start an agent turn. Only the owner can add or remove a recipient, and revocation takes effect immediately. The picker suggests people who share a repository or team with the owner and also accepts an exact @handle; it warns when the recipient cannot access the chat's attached repository.

The authenticated API exposes these named shares through GET/POST /api/v1/app/chats/:chat_id/shares, DELETE /api/v1/app/chats/:chat_id/shares/:id, and GET /api/v1/app/chats/:chat_id/share_candidates?q=....

The older link-sharing endpoint remains available:

POST /api/v1/app/chats/:id/share creates a stable same-instance share token for one of the authenticated user's chat sessions and returns share_url. Repeating the request returns the same link.

curl -X POST https://syrus.example.com/api/v1/app/chats/123/share \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

GET /api/v1/app/shared_chats/:token is available to any authenticated user on the same Syrus instance. It returns a read-only transcript payload with chat metadata and messages only; unknown tokens return 404.

curl https://syrus.example.com/api/v1/app/shared_chats/8b0d6a08-6f8d-4a2e-b2d8-0f2a2a2d8f6f \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

Archive a Chat

DELETE /api/v1/app/chats/:id archives a chat owned by the authenticated user. Archiving is a soft deletion: the database record and conversation data remain for audit, while active workspace artifacts and search-index entries are cleaned up. Pass include_archived=1 to the chat index to include archived rows.

curl -X DELETE https://syrus.example.com/api/v1/app/chats/123 \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

Chat Write Responses

Chat write endpoints answer with the chat's revision and the slices the write itself changed -- a queued-message write returns the queued list, a scratch-pad write returns the scratch pad, cancelling a coding checkout returns the pending actions it cancelled -- rather than re-rendering the transcript. New messages reach clients over the realtime channel. Clients patch their cached payload with whatever slices a response carries.

Read Chat Message History

GET /api/v1/app/chats/:id/messages?before=:message_id&limit=:count reads an older page of messages. limit is optional: without it the page is sized by the rows the stream will render rather than by a message count, so a collapsed run of tool calls does not spend the page on messages that draw as one row. A supplied limit bounds the page's message count instead, with a minimum of 1; the row target and the page's byte budget still apply, so a large limit does not widen the page beyond what it will draw. Large tool inputs/results and completed shell output are represented by bounded previews with a message content path; authenticated chat participants can follow that path to load the full filtered content on demand.

Resolved proposal bodies are likewise omitted from repeated message pages and include a proposal body path for on-demand expansion.

Search Chats

GET /api/v1/app/search searches the authenticated user's Jobs, Epics, and chat messages with one relevance-ranked result list. Pass q with at least two characters. Optional types[] values are job, epic, and chat; omit types[] to search all three. limit defaults to 30 and is capped at 100. Results include the result type, id, title, matched snippet, normalized rank, app navigation path, state and repository context for Jobs and Epics, and created_at. Job and Epic slugs such as JOB-123 and EPIC-56 return the matching record when it belongs to the authenticated user. Query terms use Google-style matching: foo bar requires both words in any order, "foo bar" searches for the exact phrase, and foo "bar baz" combines a required word with a required phrase. Chat results are grouped by conversation: the best matching message is the representative result, and grouped chat rows may include grouped_matches, total_match_count, and has_more_matches for inline expansion.

curl "https://syrus.example.com/api/v1/app/search?q=deploy&types[]=job&types[]=chat" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

GET /api/v1/app/chats/search searches the authenticated user's chats. Hidden chats are excluded. Pass q for full-text search, or omit it for a filter-only listing. The optional repository_id, epic_id, and job_id filters limit results to chats with matching attachments. Results are paginated with page and return chat-level cards with up to three matching message snippets.

curl "https://syrus.example.com/api/v1/app/chats/search?q=deploy&epic_id=456" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

GET /api/v1/app/chats/search/messages expands up to 50 matching messages for one chat and query. The response's has_more field reports whether the result was truncated:

curl "https://syrus.example.com/api/v1/app/chats/search/messages?chat_session_id=123&q=deploy" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

The app Epic detail API also supports dependency management when the authenticated user has write-tier access to the Epic's repository:

curl -X POST https://syrus.example.com/api/v1/app/epics/456/dependencies \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "depends_on_epic_id": 123 }'

POST /api/v1/app/epics/:id/dependencies returns a message and the updated Epic header fields. It rejects cycles and requires write access to both Epics' repositories. The client refreshes the independently loaded dependency data afterward. DELETE /api/v1/app/epics/:id/dependencies/:depends_on_epic_id removes that edge and is idempotent.

All app API mutations of an existing Epic—including edits, archive, ownership, state/start, and dependency changes—require the same effective repository write access. Read-tier access remains sufficient for viewing Epics. Reassignment additionally requires the selected owner to have effective write access to the Epic's repository.

Update Theme Preference

PATCH /api/v1/app/theme updates the authenticated user's app theme. Valid values are light, dark, and system. It can also set color_theme_id to one of the built-in color themes or a custom color theme owned by the authenticated user.

curl -X PATCH https://syrus.example.com/api/v1/app/theme \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "theme": "dark" }'

Manage Color Themes

GET /api/v1/app/themes lists built-in color themes plus custom, non-built-in themes owned by the authenticated user using picker-sized identity, position, and swatch fields. Pass full=1 when a client needs full token payloads for the complete list. GET /api/v1/app/themes/:id returns one selectable theme, plus a top-level contrast_warnings array (empty when the theme has no WCAG AA issues) so a draft theme's preview can show the same non-blocking contrast warnings the preview_theme chat tool returns, without gating the fetch on it. Full theme payloads include:

Token hashes are abbreviated below; real create requests must include every theme token key for both modes.

{
  "id": 123,
  "slug": "copper-night-42",
  "name": "Copper Night",
  "built_in": false,
  "position": 0,
  "tokens": {
    "light": { "brand": "#b6492e" },
    "dark": { "brand": "#dba28b" }
  }
}

Beyond the light/dark color hashes, every theme payload also includes five non-color token groups — shape (control/panel radius, border width), shadow (panel elevation), spacing (page/section spacing), density (control heights, table row height), and typography (font families, text sizes). Every theme, including ones created before this token expansion, gets Syrus's built-in defaults for these groups; the create/update endpoints below do not yet accept overrides for them.

POST /api/v1/app/themes creates a custom theme for the authenticated user. The request body must include name and a complete tokens object with light and dark token hashes covering the theme token schema.

curl -X POST https://syrus.example.com/api/v1/app/themes \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d @theme.json

PATCH /api/v1/app/themes/:id renames an owned custom theme and/or merges token overrides into its existing light/dark token hashes:

curl -X PATCH https://syrus.example.com/api/v1/app/themes/123 \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "theme": { "name": "Copper Night", "tokens": { "light": { "brand": "#0f766e" } } } }'

Create and update run the same WCAG AA contrast check used by the theming chat tools. A failing palette returns 422 with contrast_check_failed and an issues array naming the token pair, actual ratio, and required ratio.

DELETE /api/v1/app/themes/:id deletes an owned custom theme. If it is the user's active color theme, Syrus first falls back to the default built-in Terracotta theme. Built-in themes and another user's custom themes are not editable through these endpoints.

The equivalent delete_user_theme chat tool returns deleted_theme_id/deleted_theme_name and fallback_theme_id/fallback_theme_name on success. The fallback fields are null when deleting the theme did not change the user's active theme. This keeps transcripts readable after the deleted theme record no longer exists.

PATCH /api/v1/app/themes/reorder accepts ids, an ordered array of owned custom theme IDs, and persists their zero-based positions. Any custom themes owned by the user but omitted from ids are kept after the submitted order. Malformed IDs, duplicates, built-in theme IDs, and another user's theme IDs are rejected before positions are changed.

Manage Notifications

User-scoped clients can read and update the authenticated user's notifications through the app API. GET /api/v1/app/notifications returns newest-first paginated notifications and an unread_count envelope value. Each notification includes job_title when it is associated with a Job. Pass unread=true to list only unread notifications.

curl https://syrus.example.com/api/v1/app/notifications?unread=true \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

PATCH /api/v1/app/notifications/:id/mark_read marks one notification read and returns the updated notification plus unread_count. POST /api/v1/app/notifications/mark_all_read marks every unread notification for the authenticated user read and returns the refreshed list.

GET /api/v1/app/notification_preferences returns the authenticated user's merged notification category preferences. PATCH /api/v1/app/notification_preferences accepts a partial notification_preferences object and merges it into the saved preferences.

curl -X PATCH https://syrus.example.com/api/v1/app/notification_preferences \
  -H "Authorization: Bearer $SYRUS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "notification_preferences": { "epic_completed": true } }'

Manage Memories

User-scoped clients can manage agent memories through the app API with any user API token. GET /api/v1/app/memories returns paginated memory rows visible to that user. It accepts scope, kind, q, page, and per_page query parameters. Reusable kinds, scopes, repositories, and filter controls are available from GET /api/v1/app/memories/metadata.

Write endpoints are owner-only unless the authenticated user is an admin: POST /api/v1/app/memories, PATCH /api/v1/app/memories/:id, DELETE /api/v1/app/memories/:id, POST /api/v1/app/memories/:id/publish, and DELETE /api/v1/app/memories/:id/publish.

GET /api/v1/app/memories/:id/audit_events returns up to 50 audit events and provides next_cursor when another page can be requested with before.

Worker Timeline

When the worker_timeline plugin is enabled, admin API clients can read the same multi-lane worker activity data the Worker Timeline sidebar page renders. Both endpoints require an admin API token; a disabled plugin answers a plugin_disabled error.

GET /api/v1/admin/worker_timeline/macro returns worker lanes and pending Workflows for a time window. Query params: from/to (ISO8601, default window is the last hour), repository_id, epic_id, job_id, hostname, status (comma-separated Workflow states), and job_type (user or system, with infra/infrastructure accepted as aliases for system).

curl "https://syrus.example.com/api/v1/admin/worker_timeline/macro?status=running" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

GET /api/v1/admin/worker_timeline/workflow returns the ordered Step/Run waterfall for one Workflow, given ?id=<workflow_id>.

curl "https://syrus.example.com/api/v1/admin/worker_timeline/workflow?id=123" \
  -H "Authorization: Bearer $SYRUS_API_TOKEN"

Error localization and stable codes

API error responses include a stable machine-readable code beside a human-readable, localized message:

{ "error": { "code": "not_found", "message": "The requested record was not found." } }

Clients must branch on error.code, never on error.message. Message text can change with the signed-in user's locale and may be refined without changing the machine contract. Existing endpoints that predate this envelope retain their response shape until they are migrated explicitly.