SynaptraDocs

    Reference

    HTTP API

    JSON over HTTPS at https://synaptra.my/api, with an API token. Everything the SDK does, from any language.

    #

    Basics

    • Base URL: https://synaptra.my/api.
    • Auth: Authorization: Bearer syn_... (an API token). The web app uses its session cookie instead.
    • Bodies are JSON (Content-Type: application/json). Errors are JSON {code, detail} (Errors).
    Terminal
    curl https://synaptra.my/api/me -H "Authorization: Bearer $SYNAPTRA_TOKEN"
    #

    Account and workspaces

    MethodPathReturns
    GET/api/me{user {id, email, name}, role, via, workspace, workspaces}. via is session or token.
    GET/api/workspaces{workspaces: [{id, name, kind, role}], current}
    GET/api/tokensYour tokens without the secrets: {tokens: [{id, name, prefix, workspace_id, created_at, last_used_at, revoked_at}], max}. Session only.
    POST/api/tokens{name} → 201 with the token, shown once. Session only.
    DELETE/api/tokens/{id}Revokes it → the token's record with revoked_at. Session only.
    http
    GET /api/me HTTP/1.1
    Host: synaptra.my
    Authorization: Bearer syn_...
    
    HTTP/1.1 200 OK
    {"user": {"id": "u_…", "email": "ada@example.com", "name": ""},
     "role": "member", "via": "token",
     "workspace": {"id": "ws_…", "name": "ada's workspace", "kind": "personal", "role": "owner"},
     "workspaces": [{"id": "ws_…", "name": "ada's workspace", "kind": "personal", "role": "owner"}]}
    #

    Harnesses

    {id} is the harness id (letters, digits, -, _, .). Writes answer 201 when they create something. Every harness belongs to the workspace your session or token acts in; another workspace's harness is a 404.

    MethodPathBody / returns
    GET/api/harnesses{workspace_id, harnesses: [{id, name, template, base, base_outdated, status, versions, tools, current_version, top_tier, last_score, open_experiments, spend_usd, updated_at}]}. status: setup, needs_baseline, ready, experimenting or parked
    GET/api/harnesses/{id}id, name, description, template, base {name, version, follows}, current_version, versions, tools, readiness, next_step, layer (your own settings), tiers [{id, name}]
    POST/api/harnesses{name, description?, objective?, metric?, direction?, bar?, template?, id?, max_cost_usd?, base?: {follows, version?}} → 201, as GET one. template: harness (default), llm_agent or pipeline
    PATCH/api/harnesses/{id}{status: "parked" | "active"} → the harness as listed
    POST/api/harnesses/{id}/base{follows: "latest" | "pinned", version?} → {name, version, follows}. A harness never changes base during an open experiment
    GET/api/harnesses/{id}/specThe harness as one JSON document (as the export, without the version stamp)
    GET/api/harnesses/{id}/tools?include_removed={tools: [{id, name, kind, description, schema, config, created_at}]}
    POST/api/harnesses/{id}/tools{name, kind, description, schema?, config?} → 201, the tool. kind: action, scorer, dataset or runner
    DELETE/api/harnesses/{id}/tools/{tool_id}Soft remove → the tool with status: removed
    GET/api/harnesses/{id}/versions?limit=&cursor={versions: [{version, created_at, experiment_id, variant, score, score_tier, metric, note, spec}], next_cursor}, oldest first
    GET/api/harnesses/{id}/exportThe spec as portable JSON (format: synaptra.harness/1) with version and exported_at
    #

    Experiments and runs

    MethodPathBody / returns
    POST/api/harnesses/{id}/experiments{title, hypothesis, variant, predictions: {tier: {key: number}}, treatment_axes?, max_cost_usd?, change?, confidence?} → 201, the experiment
    GET/api/harnesses/{id}/experiments?status=&limit=&cursor={experiments: [...], next_cursor}, newest first. status: open or closed
    GET/api/experiments/{id}One experiment: predictions, actuals per tier, decision, result line, max_cost_usd, and spent_usd (its runs' cost plus spend metered during them)
    GET/api/harnesses/{id}/gate?variant=&tier=&n_runs=&experiment_id=allowed, reasons, warnings, estimated_cost_usd, passes_own_gate, prerequisites, budget. Read-only
    POST/api/harnesses/{id}/runs{experiment_id?, variant?, tier?, rows: [...]} (at most 5,000 rows) → {recorded, by_variant, ungated, errors, warnings, first_run_id, last_run_id}. Send an Idempotency-Key
    GET/api/harnesses/{id}/runs?tier=&variant=&experiment_id=&status=&limit=&cursor={runs: [...], next_cursor}, newest first
    POST/api/runs/{run_id}/resolve{metrics, status?, cost_usd?, note?}: settles a provisional run (the old row is kept, superseded)
    POST/api/experiments/{id}/close{decision, note, variant?, override_reason?} (note is required) → {experiment, harness_version} for every decision: the closed experiment, and the new version {version, variant, score, …} on adopt, else null. 409 GATE when an adopted variant fails its gate or hasn't passed the held-out test set; override_reason adopts anyway, logged and shown on the version
    POST/api/experiments/{id}/spendFrom Meter: {meter_key, total_usd, calls, by, cap_usd, note, final, host, at, stopped?}, the meter's running total. One total per meter_key; a total lower than the one on record is ignored, so resending is safe. Counted as the experiment's spend by budgets, caps and gates → {experiment_id, meter_key, total_usd, applied, final, spent_usd, max_cost_usd, over_cap}
    GET/api/harnesses/{id}/compare?tier=&incumbent=&challenger=&metric=&conf=The paired verdict: mean_delta, lower, upper, p_not_better, tasks, wins, losses
    GET/api/harnesses/{id}/recommend?k=Suggested next steps. GET previews; POST logs them so they're graded when a following experiment closes
    GET/api/harnesses/{id}/hit-rateHow often the recommendations proved right (/api/hit-rate for the workspace)
    GET/api/harnesses/{id}/lint{findings: [{severity, tier, check, message}]}: problems on the harness's settings
    GET/api/harnesses/{id}/memory?query={memory: [...]}: why past changes were made and what they did
    GET/api/harnesses/{id}/events?limit={events: [...]}, newest first (/api/events for the workspace)
    GET/api/harnesses/{id}/decision-log{text}: the decision log as Markdown
    Terminal
    curl https://synaptra.my/api/harnesses/support-bot/runs \
      -H "Authorization: Bearer $SYNAPTRA_TOKEN" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: 7b1f0c52-run-batch-3" \
      -d '{"experiment_id": 42, "variant": "prompt-v2", "tier": "T1",
           "rows": [{"task": "t-118", "metrics": {"accuracy": 1}, "cost_usd": 0.004}]}'
    #

    Live runs

    MethodPathBody / returns
    POST/api/track/push (or /api/live){run_key, records: [...]} from track → {run_id, points, alerts, finished, stop_requested}. The first push carries the init record; records are kept once per seq, so a retried push is safe. stop_requested is the stop message once someone asked the run to stop, else null
    GET/api/live?harness_id=&status=&limit={runs: [{id, name, variant, status, steps, last, alerts, stop_asked}]}
    GET/api/live/{run_id}One run: its series, summary, alerts and how it compares with earlier runs
    POST/api/live/{run_id}/stop{reason} → the run's should_stop() turns true at its next check
    #

    Workspace

    MethodPathReturns
    GET/api/usage{workspace_id, usage: {harnesses, runs_today, rows, bytes}, limits: {max_harnesses, ...}, requests_per_minute}
    GET/api/examplesThe example harnesses you can load
    POST/api/examples{example: "support-agent"} → 201: a demo harness with synthetic runs in your workspace, labelled as example data (id example-…)
    #

    Lessons

    MethodPathBody / returns
    GET/api/lessons{lessons, sharing: {workspace, harnesses: {id: bool}}, summary}. Reading writes nothing
    GET/api/lessons/previewExactly what would be shared
    POST/api/lessons/sharing{on, harness_id?}: sharing on or off for the workspace or one harness → {sharing, scope, lessons_withheld, settings}
    #

    From TypeScript

    The TypeScript SDK (npm install synaptra-sdk) does this for you, with retries, idempotency keys and batching. Without it, plain fetch works anywhere:

    report.ts
    const SYNAPTRA = "https://synaptra.my/api";
    const headers = { Authorization: `Bearer ${process.env.SYNAPTRA_TOKEN}`, "Content-Type": "application/json" };
    
    const res = await fetch(`${SYNAPTRA}/harnesses/support-bot/runs`, {
      method: "POST",
      headers,
      body: JSON.stringify({ variant: "prompt-v2", tier: "T1", rows }),
    });
    if (!res.ok) throw new Error((await res.json()).detail);

    Something unclear or missing? Email support@synaptra.my.