API reference

The endpoints for your team's runs, diagnostics, usage, billing, keys and settings. Start with the API page for the key, errors and conventions.

All paths are relative to https://api.ci-router.com. Read API first for how to send a key, page through a list and read an error. The examples use made-up values.

#Service and public data

These endpoints need no key.

GET/v1/health

Answers when the service is up.

Response
{ "ok": true }

GET/v1/public/providers

The providers, their sizes and the list price per minute of each size.

Response (shortened)
{
  "generatedAt": "2026-03-10T10:00:00.000Z",
  "providers": [
    {
      "id": "provider-a",
      "name": "Provider A",
      "status": "up",
      "imageClasses": ["base", "docker"],
      "capabilities": { "arch": "x64", "docker": true, "kvm": false, ... },
      "sizes": [
        {
          "id": "size-1",
          "sizeClass": "medium",
          "arch": "x64",
          "vcpu": 4,
          "memoryMb": 16384,
          "region": "eu",
          "listPriceMicroUsdPerMinute": 1000,
          "billingIncrementSec": 1,
          "capabilities": { ... }
        }
      ]
    }
  ]
}

Prices are whole micro-dollars per minute. billingIncrementSec is the step a run is billed in. arch is x64 or arm64. An arm64 size is its own route with its own price. capabilities says what the machines offer, such as Docker, KVM and sudo. See Runners. The answer is cached for a short time.

GET/v1/public/providers/{id}

One provider with its sizes, seven days of monitoring uptime, three days of availability, and its price changes.

Returns generatedAt, provider and history. history.uptime7d gives the provider's probe uptime and hourly history; hours without probes have no value. history.sizes retains each size's three-day hourly uptime and availability. history.prices lists list-price changes, oldest first. An hour with too few teams behind it shows no availability. An unknown id answers 404.

GET/v1/public/stats

Jobs routed, job minutes, success share and pickup time per provider and size, per day.

Query
NameTypeDescription
daysintegerDays to cover, 1 to 90. Default 30.

Only final days are published. Counts are rounded. Every provider and size is included, whatever the number of teams behind it.

GET/v1/public/usage

Job minutes per provider, per week or per day.

Query
NameTypeDescription
weeksintegerWeeks to cover, 1 to 52. Default 26.
daysintegerDays to cover, 1 to 366. Replaces weeks when set.

Each provider row has customerMinutes, under the same rules as GET /v1/public/stats, and houseMinutes, the minutes of CI Router's own jobs. partial marks the week or day in progress.

#Team

GET/v1/me

The team the key belongs to.

Response
{
  "team": {
    "id": "team_...",
    "name": "Platform",
    "plan": "standard",
    "stripeCustomerId": "cus_...",
    "cardAttached": true,
    "allowedProviders": null,
    "createdAt": "2026-02-01T09:30:00.000Z"
  }
}

allowedProviders is null when any provider may run your jobs. plan is the account type, standard or dedicated. Your subscription plan is in GET /v1/billing.

PATCH/v1/me/team

Rename the team.

Body
NameTypeDescription
namerequiredstring1 to 100 characters.
Example
curl -X PATCH https://api.ci-router.com/v1/me/team \
  -H "Authorization: Bearer sk-cir_..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "Platform CI" }'

Returns the team, like GET /v1/me. A dashboard sign-in needs the owner role. An API key always works.

PATCH/v1/me/providers

Limit which providers may run your jobs, or lift the limit.

Body
NameTypeDescription
providersrequiredstring[] | nullProvider ids from GET /v1/public/providers, or null for no limit. Ids are not checked, so an unknown id matches no provider.
Bodies
# Allow two providers
{ "providers": ["provider-a", "provider-b"] }

# Back to any provider
{ "providers": null }

Returns the team. A list narrows where jobs can run. A job with no allowed provider available waits or is refused, and the reason shows in the notices. A dashboard sign-in needs the owner role. An API key always works.

PATCH/v1/me/run-phases

Turn the tool phases on a run's profile on or off. They are on by default.

Body
NameTypeDescription
enabledrequiredbooleanfalse deletes the phases already stored for the team and stops storing new ones. The resource samples stay.

Returns { "enabled": boolean }. GET /v1/me/run-phases reads the setting. A dashboard sign-in needs the owner role. An API key always works.

GET/v1/notices

Open notices for your team, such as a refused job. Up to 20.

Response
{
  "notices": [
    {
      "id": "ntc_...",
      "kind": "job_refused",
      "repo": "your-org/web",
      "reason": "insufficient_credits",
      "permission": null,
      "createdAt": "2026-03-10T10:00:00.000Z"
    }
  ]
}

kind is job_refused, job_held, public_repo_unverifiable, no_fallback_route or placement_stalled. reason is a stable code to match on. placement_stalled shows while jobs wait for a machine longer than usual, and clears on its own.

POST/v1/notices/{id}/dismiss

Dismiss a notice. Answers 204 with no body, or 404 for an unknown id.

#GitHub

GET/v1/installations

The GitHub accounts connected to your team, with their public repository policy.

Query
NameTypeDescription
summary1Only ids and account names. Faster, and makes no call to GitHub.
Response
{
  "installations": [
    {
      "installationId": "12345678",
      "orgLogin": "your-org",
      "publicRepoPolicy": { "mode": "off", "allowlist": [] },
      "anyoneAllowed": true,
      "repos": { "public": 2, "private": 14, "truncated": false },
      "repositoryAccess": { "names": ["your-org/web", "your-org/api"], "truncated": false },
      "runnerGroup": {
        "id": 1,
        "allowsPublicRepos": false,
        "settingsUrl": "https://github.com/organizations/your-org/settings/actions/runner-groups/1"
      }
    }
  ]
}

repos counts the repositories the app can access, and repositoryAccess names them. repos, repositoryAccess and runnerGroup come from GitHub. They are null when GitHub did not answer. runnerGroup is also null for a personal account.

PUT/v1/installations/{installationId}/public-repo-policy

Choose whether public repositories can run on your account.

Body
NameTypeDescription
moderequiredoff | allowlist | anyoneWho may run jobs from public repositories. See Public repositories.
allowlistrequiredobject[]Up to 100 GitHub users, each once: userId (a numeric string), login and avatarUrl (an https URL or null). Used when mode is allowlist.
Body
{
  "mode": "allowlist",
  "allowlist": [
    { "userId": "1234", "login": "octocat", "avatarUrl": "https://avatars.githubusercontent.com/u/1234" }
  ]
}

Returns the installation with its new policy. Jobs refused under the old policy are checked again. A body that does not fit answers 400 invalid, with the problems in issues. A dashboard sign-in needs the owner role. An API key always works.

GET/v1/installations/{installationId}/github-users/{login}

Look up a GitHub login to get the numeric id the allowlist needs.

Returns { "user": { ... } }. A malformed login answers 400 invalid. A login that does not exist answers 404. Lookups are limited per team: a limited request answers 429 with retry-after. 502 means GitHub did not answer.

#API keys

Creating, renaming, rotating and revoking a key needs the owner role on a dashboard sign-in. An API key always works. See API keys.

GET/v1/keys

List your team's keys.

Response
{
  "keys": [
    {
      "id": "key_...",
      "name": "deploy-script",
      "createdAt": "2026-02-01T09:30:00.000Z",
      "lastUsedAt": "2026-03-10T09:58:00.000Z"
    }
  ]
}

The secret is never listed.

POST/v1/keys

Create a key. The secret is returned once.

Body
NameTypeDescription
namestringA label. Default "key".
Example
curl -X POST https://api.ci-router.com/v1/keys \
  -H "Authorization: Bearer sk-cir_..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "deploy-script" }'

# 201
{
  "key": { "id": "key_...", "name": "deploy-script", "createdAt": "...", "lastUsedAt": null },
  "secret": "sk-cir_..."
}

The team's owners get an email about the new key. It never contains the secret.

PATCH/v1/keys/{id}

Rename a key.

Body
NameTypeDescription
namerequiredstring1 to 100 characters.

Returns the key.

DELETE/v1/keys/{id}

Revoke a key. It stops working at once.

Returns { "ok": true }, also for an id that does not exist.

POST/v1/keys/{id}/rotate

Give a key a new secret. The id and name stay.

Returns the key and the new secret, shown once. The old secret stops working, and so does every dashboard sign-in made with it.

#Runs and jobs

A job is one job of a GitHub Actions workflow that asked for a ci-router runner. A run is one attempt to run it on a machine. A job that is retried has several runs.

GET/v1/runs

Your latest runs, newest first.

Query
NameTypeDescription
limitintegerHow many rows to return, from 1 to 500. Default 100.
groupjobOne row per job, with its attempts, instead of one row per run. limit then counts jobs.
repo, workflow, jobstringWith group=job, keep only the jobs that match.
sinceISO timeStart of the window. Turns on paging, see Pagination on the API page.
untilISO timeEnd of the window. Default now.
cursorstringnextCursor from the previous page.
Response
{
  "runs": [
    {
      "id": "run_...",
      "jobId": "job_...",
      "repo": "your-org/web",
      "workflow": "ci.yml",
      "jobName": "test",
      "labels": ["ci-router", "8cpu"],
      "providerId": "provider-a",
      "sizeClass": "large",
      "arch": "x64",
      "status": "done",
      "outcomeClass": "ok",
      "outcomeReason": null,
      "durationSec": 412,
      "billedMicroUsd": 38000,
      "cpuStealPct": 0.4,
      "memPeakPct": 61,
      "createdAt": "2026-03-10T10:00:00.000Z"
    }
  ]
}
  • status is booting, running, done, failed or destroyed.
  • outcomeClass says how the run ended: ok, job, resource, infra, cancelled or refused. outcomeReason is a stable code with more detail, or null.
  • billedMicroUsd is what the run cost you. durationSec is how long it ran.
  • arch is the runner's architecture. cpuStealPct is the CPU time the host took from the machine. memPeakPct is the peak memory use.
Response with group=job (shortened)
{
  "jobs": [
    {
      "jobId": "job_...",
      "repo": "your-org/web",
      "workflow": "ci.yml",
      "jobName": "test",
      "labels": ["ci-router", "8cpu"],
      "latest": { "id": "run_...", "status": "done", "durationSec": 412, ... },
      "attemptCount": 1,
      "totals": { "billedMicroUsd": 38000 },
      "firstAt": "2026-03-10T10:00:00.000Z",
      "attempts": [ { "id": "run_...", "attemptNo": 1, ... } ],
      "git": { "branch": "main", "sha": "4f2a...", "actorLogin": "octocat", "pullRequests": [], ... }
    }
  ]
}

A job row lists up to 20 attempts, the newest ones. attemptCount and totals count them all. git has the branch, commit, pull requests and actor on GitHub. Paging does not combine with group.

GET/v1/runs/{id}/profile

CPU, memory and network use over a run, with the usual numbers for the same job.

Response (shortened)
{
  "run": { "id": "run_...", "repo": "your-org/web", "jobName": "test", "status": "done", "durationSec": 412, "vcpus": 4, "memTotalMb": 16384 },
  "samples": [ ... ],
  "phases": [ ... ],
  "network": { ... },
  "median": { ... }
}

An unknown id, or one from another team, answers 404.

GET/v1/jobs

Your latest jobs, including refused and failed ones.

Query
NameTypeDescription
limitintegerHow many rows to return, from 1 to 500. Default 100.
sinceISO timeStart of the window. Turns on paging, see Pagination on the API page.
untilISO timeEnd of the window. Default now.
cursorstringnextCursor from the previous page.
Response
{
  "jobs": [
    {
      "id": "job_...",
      "repo": "your-org/web",
      "workflow": "ci.yml",
      "jobName": "test",
      "labels": ["ci-router", "8cpu"],
      "runId": "1234567890",
      "githubJobId": "9876543210",
      "status": "ended",
      "conclusion": "success",
      "refusalCode": null,
      "error": null,
      "receivedAt": "2026-03-10T09:59:58.000Z",
      "createdAt": "2026-03-10T09:59:58.000Z"
    }
  ]
}

status is queued, placing, placed, failed, retrying, refused, held or ended. conclusion is what GitHub reported at the end. refusalCode is a stable code when the job was refused. error is a fixed sentence that says why the job did not start.

GET/v1/jobs/receipt

What happened to every job of one GitHub Actions run, and what each cost.

Query
NameTypeDescription
githubRunIdrequiredstringThe numeric id of the workflow run, as in its URL on GitHub.
githubJobIdstringNarrow the answer to one job of that run.
Response (shortened)
{
  "githubRunId": "1234567890",
  "truncated": false,
  "jobs": [
    {
      "githubJobId": "9876543210",
      "jobName": "test",
      "labels": ["ci-router", "8cpu"],
      "routerJobId": "job_...",
      "status": "ended",
      "conclusion": "success",
      "receivedAt": "2026-03-10T09:59:58.000Z",
      "githubRunAttempt": 1,
      "refusal": null,
      "createAttempted": true,
      "runs": [
        {
          "routerRunId": "run_...",
          "placement": {
            "placementId": "plc_...",
            "provider": "provider-a",
            "sizeClass": "large",
            "providerSizeId": "size-3",
            "providerRef": "vm-...",
            "placedAt": "2026-03-10T10:00:00.000Z"
          },
          "createAttempted": true,
          "createEvidence": ["boot_admitted", "provider_ref", "vm_started"],
          "boot": {
            "vmUptimeAtStartSec": 9.2,
            "runnerUpSec": 3.1,
            "jobStartSec": 4.0,
            "placedToRunnerUpSec": 21.5,
            "placedToJobStartedSec": 22.4
          },
          "terminal": {
            "runStatus": "done",
            "outcomeClass": "ok",
            "outcomeReason": null,
            "outcomeAt": "2026-03-10T10:07:15.000Z",
            "bootFailureCode": null,
            "conclusion": "success",
            "exitCode": 0,
            "durationSec": 412,
            "startedAt": "2026-03-10T10:00:22.000Z",
            "endedAt": "2026-03-10T10:07:14.000Z",
            "cleanup": {
              "confirmed": true,
              "evidence": "destroyed",
              "confirmedAt": "2026-03-10T10:07:30.000Z",
              "destroyRequestedAt": "2026-03-10T10:07:15.000Z",
              "unresolved": false
            },
            "settlement": {
              "settled": true,
              "kind": "job",
              "absorbedReason": null,
              "billableSeconds": 450,
              "vmSeconds": 450,
              "customerChargeMicroUsd": 38000,
              "settledAt": "2026-03-10T10:07:31.000Z"
            },
            "reservation": {
              "state": "settled",
              "released": true,
              "closedAt": "2026-03-10T10:07:31.000Z"
            }
          }
        }
      ]
    }
  ]
}

Each run gives the machine it got (placement), its boot times (boot), how it ended and what it cost (terminal). A run that used a volume also has volume. A list longer than 300 jobs is cut, and truncated is true.

A run that is unknown, or belongs to another team, answers an empty jobs list. A malformed id answers 400.

#Workflows

GET/v1/workflows

Runs, failures, time and spend per repository, workflow and job over the last 30 UTC days.

Response (shortened)
{
  "from": "2026-02-09",
  "to": "2026-03-10",
  "windowDays": 30,
  "truncated": false,
  "totals": { "runs": 1240, "failed": 31, "failingRate": 0.026, "costMicroUsd": 48200000, ... },
  "projects": [
    {
      "repo": "your-org/web",
      "runs": 1240,
      ...,
      "workflows": [
        {
          "workflow": "ci.yml",
          "runs": 1240,
          ...,
          "jobs": [ { "job": "test", "runs": 620, ... } ],
          "branches": [ { "branch": "main", "runs": 410 } ],
          "branchCount": 37,
          "lastGithubRunId": "1234567890"
        }
      ]
    }
  ]
}

Repositories and workflows come most expensive first. Each level has the same numbers: runs, failed, failingRate, avgDurationSec, costMicroUsd, and the jobs queued and running now. failingRate counts only jobs that succeeded, failed or timed out. truncated is true when the counts are a lower bound.

GET/v1/workflow-runs/{githubRunId}

The jobs of one GitHub Actions run, with the job graph of its workflow file.

Response
{
  "githubRunId": "1234567890",
  "repo": "your-org/web",
  "workflow": "ci.yml",
  "git": null,
  "jobs": [
    {
      "jobId": "job_...",
      "githubJobId": "9876543210",
      "jobName": "test",
      "labels": ["ci-router", "8cpu"],
      "status": "ended",
      "conclusion": "success",
      "runAttempt": 1,
      "latest": null,
      "attemptCount": 1,
      "billedMicroUsd": 38000,
      "startedAt": "2026-03-10T10:00:22.000Z",
      "completedAt": "2026-03-10T10:07:14.000Z"
    }
  ],
  "specs": [
    { "id": "build", "name": "Build", "needs": [], "matrix": false, "calls": false },
    { "id": "test", "name": null, "needs": ["build"], "matrix": false, "calls": false }
  ]
}

jobs holds the newest attempt of each job. latest is the run that ran it, or null when none started. specs is the workflow file's jobs and their needs, or null when the file could not be read. An unknown run answers 404.

#Routing

CI Router keeps a route per job: a provider and a size. See How it works.

GET/v1/routing/decisions

Each time a job's route was set or changed, newest first.

Query
NameTypeDescription
repoowner/nameOnly this repository.
limitintegerHow many rows to return, from 1 to 500. Default 100.
Response
{
  "decisions": [
    {
      "id": "dec_...",
      "key": { "repo": "your-org/web", "workflow": "CI", "jobKey": "test", "labelsKey": "8cpu,ci-router" },
      "kind": "change",
      "fromRoute": { "providerId": "provider-a", "sizeClass": "large" },
      "toRoute": { "providerId": "provider-b", "sizeClass": "large" },
      "createdAt": "2026-03-10T10:00:00.000Z"
    }
  ]
}

kind is initial, change, trial_passed, trial_failed, rebaseline, held, no_alternative, hedge or reset. fromRoute or toRoute is null when there is none.

DELETE/v1/routing/policies

Forget one job's route. Its next run is placed from scratch.

Body or query
NameTypeDescription
reporequiredowner/nameThe repository.
workflowrequiredstringThe workflow name, not its file path.
jobrequiredstringThe job name, without the matrix suffix.
labelsstring[]The runs-on labels. Or send label, a comma list. Send one of the two.
Example
curl -X DELETE https://api.ci-router.com/v1/routing/policies \
  -H "Authorization: Bearer sk-cir_..." \
  -H "Content-Type: application/json" \
  -d '{ "repo": "your-org/web", "workflow": "CI", "job": "test", "labels": ["ci-router", "8cpu"] }'

# 200
{
  "ok": true,
  "key": { "repo": "your-org/web", "workflow": "CI", "jobKey": "test", "labelsKey": "8cpu,ci-router" },
  "previousRoute": { "providerId": "provider-a", "sizeClass": "large" }
}

A job with no route answers 404. Send an API key. A dashboard sign-in needs the owner role. An API key always works.

#Diagnostics

Read-only answers about your runs, built for scripts and coding agents: why a job failed or did not start, where its time went, why it got its machine, and where your minutes and spend go. The dashboard shows the same answers.

Every response has "version": 1. Fields are only added. Unknown values are null. Times are seconds unless a field says minutes. Money is micro-dollars. A run that is unknown or belongs to another team answers an empty jobs list. A bad query answers 400 invalid_query, with a message that says what to fix. Only jobs that ran on CI Router are covered.

GET/v1/diagnostics/why

What happened to each job of a run, the evidence, and what to do next.

Query
NameTypeDescription
githubRunIdrequiredstringThe numeric id of the workflow run, as in its URL on GitHub.
githubJobIdstringNarrow the answer to one job of that run.
Response
{
  "version": 1,
  "githubRunId": "1234567890",
  "truncated": false,
  "jobs": [
    {
      "githubJobId": "9876543210",
      "jobName": "test",
      "labels": ["ci-router"],
      "routerJobId": "job_...",
      "class": "oom",
      "summary": "The job ran out of memory on 4cpu.",
      "evidence": [
        { "kind": "oom_kills", "value": 3, "threshold": null, "source": "vm" },
        { "kind": "mem_peak_pct", "value": 99, "threshold": 90, "source": "vm" }
      ],
      "action": {
        "code": "raise_size",
        "summary": "The job ran on 4cpu. The router places the next run of this job one size up automatically. To set a size now, add a size tag: runs-on: [ci-router, 8cpu].",
        "command": null,
        "docs": "/docs/runs-on"
      }
    }
  ]
}

class is not_started, in_progress, ok, cancelled, oom, disk_full, timeout, hang, step_failure, infra or unknown. action.code is a stable code to branch on. action.command, when set, is a gh command to run with your own GitHub access. Evidence with source: "vm" was reported by the job's machine. Step logs stay on GitHub: read them with gh run view --log-failed.

GET/v1/diagnostics/time

Where the time of a run and of each of its jobs went.

Query
NameTypeDescription
githubRunIdrequiredstringThe numeric id of the workflow run, as in its URL on GitHub.
githubJobIdstringNarrow the answer to one job of that run.
Response (shortened)
{
  "version": 1,
  "githubRunId": "1234567890",
  "truncated": false,
  "coverage": "router_jobs_only",
  "run": {
    "createdAt": "2026-03-10T10:00:00.000Z",
    "completedAt": "2026-03-10T10:07:30.000Z",
    "wallSec": 450,
    "criticalPath": ["9876543210"],
    "blockingJob": {
      "githubJobId": "9876543210",
      "wallSec": 450,
      "largestPhase": "steps"
    },
    "parallelism": 1
  },
  "jobs": [
    {
      "githubJobId": "9876543210",
      "jobName": "test",
      "labels": ["ci-router"],
      "routerJobId": "job_...",
      "sizeClass": "medium",
      "status": "ended",
      "countsInRun": true,
      "createdAt": "2026-03-10T10:00:00.000Z",
      "startedAt": "2026-03-10T10:00:40.000Z",
      "completedAt": "2026-03-10T10:07:30.000Z",
      "wallSec": 450,
      "phases": {
        "queue_wait": 3,
        "provision": 25,
        "runner_start": 12,
        "setup": 60,
        "steps": 340,
        "post": 10
      },
      "stepTimes": [
        {
          "name": "Run tests",
          "phase": "steps",
          "sec": 340,
          "conclusion": "success"
        }
      ],
      "truncated": { "sec": 0, "reasons": [] },
      "afterJob": { "teardownSec": 6 }
    }
  ]
}

A job's time is split into fixed phases, in order: queue_wait, provision, runner_start, setup, steps or post. The first three are waiting for a machine, the machine starting and the runner connecting to GitHub. A phase that cannot be measured is null. Time no phase explains is in truncated.sec with its reasons. criticalPath is inferred from timing.

GET/v1/diagnostics/placement

The machine each job of a run got, and why.

Query
NameTypeDescription
githubRunIdrequiredstringThe numeric id of the workflow run, as in its URL on GitHub.
githubJobIdstringNarrow the answer to one job of that run.
Response
{
  "version": 1,
  "githubRunId": "1234567890",
  "truncated": false,
  "jobs": [
    {
      "githubJobId": "9876543210",
      "jobName": "test",
      "labels": ["ci-router"],
      "routerJobId": "job_...",
      "status": "ended",
      "placed": true,
      "machine": {
        "provider": "provider-a",
        "size": "medium",
        "vcpus": 4,
        "memoryGb": 16,
        "arch": "x64"
      },
      "reason": {
        "code": "learned_from_memory",
        "summary": "4cpu (16 GB): 8 of the last 10 runs peaked at 97% memory on 2cpu, so the job moved to a machine with more memory."
      },
      "evidence": {
        "runs": 8,
        "of": 10,
        "from": "2026-03-01T00:00:00.000Z",
        "to": "2026-03-09T18:00:00.000Z"
      },
      "failoverAttempts": 0,
      "explanation": {
        "mode": "auto",
        "sizePinned": false,
        "providerPinned": false,
        "candidates": [
          {
            "provider": "provider-a",
            "size": "medium",
            "vcpus": 4,
            "memoryGb": 16,
            "score": 0.82,
            "priceMicroUsdPerMinute": 4000,
            "sticky": true,
            "probeOk": true,
            "outcome": "chosen"
          },
          {
            "provider": "provider-b",
            "size": "medium",
            "vcpus": 4,
            "memoryGb": 16,
            "score": 0.74,
            "priceMicroUsdPerMinute": 5000,
            "sticky": false,
            "probeOk": true,
            "outcome": "fallback"
          }
        ],
        "breakerOpen": [],
        "winnerMargin": 0.08
      }
    }
  ]
}

reason.code is the field to branch on. It is one of first_run_default, size_floor, objective_cost, objective_speed, learned_from_memory, learned_from_disk, learned_from_cpu, learned_from_usage, slower_than_before, host_contention_moved, slow_start_moved, network_bound_moved, starved_failures_moved, provider_errors_moved, provider_unavailable_failover, limits_changed, trial, trial_confirmed, trial_reverted, route_kept, reset_by_user or not_recorded. summary is for people and can change. evidence names the runs the reason rests on, or is null. machine is null when no machine started.

GET/v1/diagnostics/profile

A short summary of a run's CPU, memory, disk and network use.

Query
NameTypeDescription
runIdrequiredstringA run id, run_...
Response
{
  "version": 1,
  "runId": "run_...",
  "profileUrl": "/v1/runs/run_.../profile",
  "truncated": false,
  "cpu": { "avgPct": 62, "peakPct": 100 },
  "memory": { "peakPct": 71, "above90Sec": 0 },
  "disk": { "peakPct": 40 },
  "setupNetwork": { "rxBytesPerSec": 52000000 },
  "cohort": { "runs": 12, "cpuAvgPct": 58, "memPeakPct": 69 }
}

cohort compares with recent runs of the same job. profileUrl points at the full run profile. An unknown id, or one from another team, answers 404.

GET/v1/diagnostics/top

Your biggest workflows, jobs, labels or repositories by a metric, biggest first.

Query
NameTypeDescription
byworkflow | job | label | repoWhat to rank. Default workflow.
metricminutes | cost | runs | p95 | queue_waitWhat to rank by. p95 is the slow total job time, queue included. queue_wait is the slow wait for a machine. Default minutes.
window7d | 30dThe last 7 or 30 UTC days, today included. Default 7d.
limitintegerRows per page. See Pagination on the API page.
cursorstringnextCursor from the previous page, with the same query.
Response
{
  "version": 1,
  "by": "workflow",
  "metric": "minutes",
  "unit": "minutes",
  "window": "7d",
  "from": "2026-03-04",
  "to": "2026-03-10",
  "previousFrom": "2026-02-25",
  "previousTo": "2026-03-03",
  "truncated": false,
  "rows": [
    {
      "rank": 1,
      "repo": "your-org/app",
      "workflow": "CI",
      "job": null,
      "labels": null,
      "value": 1240,
      "runs": 310,
      "trend": { "previous": 1100, "changePct": 12.7, "direction": "up" }
    }
  ],
  "nextCursor": null
}

unit says what value is: minutes, micro_usd, runs or seconds. trend compares with the window before: up, down, flat (under 1%), new or unknown. truncated is true when a very large team's list was cut, so the values are a lower bound.

GET/v1/diagnostics/usage

Runs, minutes and spend per repository, workflow, job, label or day, with your plan.

Query
NameTypeDescription
window7d | 30dThe last 7 or 30 UTC days, today included. Default 7d.
groupByrepo | workflow | job | label | dayDefault repo.
limitintegerRows per page. See Pagination on the API page.
cursorstringnextCursor from the previous page, with the same query.
Response
{
  "version": 1,
  "window": "7d",
  "from": "2026-03-04",
  "to": "2026-03-10",
  "groupBy": "repo",
  "truncated": false,
  "totals": {
    "runs": 420,
    "minutes": 1710,
    "costMicroUsd": 10260000,
    "absorbedRuns": 2
  },
  "plan": {
    "state": "active",
    "plan": "starter",
    "subscription": {
      "status": "active",
      "currentPeriodEnd": "2026-04-01T00:00:00.000Z",
      "cancelAtPeriodEnd": false
    },
    "balance": {
      "availableMicroUsd": 14740000,
      "paidMicroUsd": 0,
      "includedMicroUsd": 14740000,
      "includedExpiresAt": "2026-04-01T00:00:00.000Z",
      "suspended": false
    }
  },
  "rows": [
    {
      "repo": "your-org/app",
      "workflow": null,
      "job": null,
      "labels": null,
      "day": null,
      "runs": 310,
      "minutes": 1240,
      "costMicroUsd": 7440000,
      "absorbedRuns": 1
    }
  ],
  "nextCursor": null
}

Rows come largest spend first, or newest day first. totals cover the whole window, not just the page. absorbedRuns are attempts that were not billed. truncated is true when the list was cut. plan is your plan and available balance. The full balance is in GET /v1/billing.

GET/v1/diagnostics/time/repo

Typical (p50) and slow (p95) time per job or label set in one repository.

Query
NameTypeDescription
reporequiredowner/nameThe repository.
window7d | 30dThe last 7 or 30 UTC days, today included. Default 7d.
byjob | labelDefault job.
limitintegerRows per page. See Pagination on the API page.
cursorstringnextCursor from the previous page, with the same query.
Response (shortened)
{
  "version": 1,
  "repo": "your-org/app",
  "window": "7d",
  "from": "2026-03-04",
  "to": "2026-03-10",
  "by": "job",
  "sampled": 120,
  "truncated": false,
  "coverage": "router_jobs_only",
  "rows": [
    {
      "workflow": "CI",
      "job": "test",
      "labels": ["ci-router"],
      "runs": 120,
      "wall": { "p50": 410, "p95": 620, "n": 120 },
      "phases": {
        "queue_wait": { "p50": 3, "p95": 9, "n": 120 },
        "provision": { "p50": 24, "p95": 41, "n": 118 },
        "runner_start": { "p50": 11, "p95": 18, "n": 118 },
        "setup": { "p50": 55, "p95": 90, "n": 120 },
        "steps": { "p50": 300, "p95": 470, "n": 120 },
        "post": { "p50": 9, "p95": 14, "n": 120 }
      }
    }
  ],
  "nextCursor": null
}

Rows come slowest p95 first. Each row gives the job's wall time and each phase of diagnostics/time as p50, p95 and the number of jobs n, over completed jobs that were not cancelled or skipped. truncated is true when not every job of the window was read.

#Usage and spend

GET/v1/stats/usage

Runs, minutes and amount billed per day, provider or size.

Query
NameTypeDescription
groupByprovider | size | dayHow to split the points. Default provider.
fromYYYY-MM-DDFirst day, UTC. Default: 13 days before today.
toYYYY-MM-DDLast day, UTC, included. Default: today. A range covers at most 366 days.
Response
{
  "from": "2026-02-25",
  "to": "2026-03-10",
  "groupBy": "day",
  "points": [
    { "day": "2026-03-10", "providerId": null, "sizeClass": null, "runs": 42, "minutes": 310, "billedMicroUsd": 1860000 }
  ]
}

GET/v1/stats/jobs

How many jobs your team received each UTC day, by repository and provider.

Query (both dates required)
NameTypeDescription
fromYYYY-MM-DDFirst UTC date, inclusive.
toYYYY-MM-DDLast UTC date, inclusive; up to 366 days.
Response
{ "from": "2026-11-01", "to": "2026-11-01", "points": [{ "day": "2026-11-01", "repo": "org/repo", "providerId": "boat", "jobs": 12 }] }

A job counts once, even with retries or without an attempt. The provider is from the newest attempt that ran the job, or the newest attempt if none ran it. Jobs without an attempt have providerId: null.

GET/v1/usage/costs

What you were charged, per day, split by the dimensions you choose.

Query
NameTypeDescription
groupBystringA comma list of repo, workflow, job, provider, sizeClass. Empty gives one total per day.
fromYYYY-MM-DDFirst day, UTC. Default: 13 days before today.
toYYYY-MM-DDLast day, UTC, included. Default: today. A range covers at most 366 days.
Response
{
  "from": "2026-02-25",
  "to": "2026-03-10",
  "groupBy": ["repo"],
  "points": [
    {
      "day": "2026-03-10",
      "repo": "your-org/web",
      "runs": 42,
      "billableSeconds": 18600,
      "customerChargeMicroUsd": 1860000,
      "absorbedRuns": 0
    }
  ],
  "totals": { "runs": 42, "billableSeconds": 18600, "customerChargeMicroUsd": 1860000, "absorbedRuns": 0 }
}

absorbedRuns counts runs you were not charged for. It is a count, never an amount. Points are ordered by day, oldest first. A bad date, a range that ends before it starts or one that is too long answers 400.

#Billing

GET/v1/billing

Your plan, balance and automatic top-up settings.

Response (shortened)
{
  "plan": "standard",
  "paymentManagementAvailable": true,
  "cardAttached": true,
  "stripeCustomerId": "cus_...",
  "credits": { ... },
  "prepaid": {
    "state": "active",
    "plan": "starter",
    "feeBps": 2500,
    "subscription": {
      "status": "active",
      "currentPeriodEnd": "2026-04-10T00:00:00.000Z",
      "cancelAtPeriodEnd": false
    },
    "balance": {
      "availableMicroUsd": 14200000,
      "paidMicroUsd": 4200000,
      "includedMicroUsd": 10000000,
      "includedExpiresAt": "2026-04-10T00:00:00.000Z",
      "reservedMicroUsd": 0,
      "frozen": false,
      "suspended": false,
      "shortfallMicroUsd": 0
    },
    "autoTopup": {
      "enabled": true,
      "thresholdMicroUsd": 5000000,
      "maxAmountCents": 2500,
      "monthlyCapCents": 12500,
      "consentText": "...",
      "consentedAt": "2026-03-01T08:00:00.000Z",
      "consentCurrent": true
    },
    "unresolvedAutoPurchase": null,
    "minTopupCents": 2000,
    "defaultTopupCents": 2000
  }
}

state is none before the first subscription, active while one is paid and lapsed after it ended. availableMicroUsd is what new jobs can spend. credits repeats the balance; read prepaid.balance.

autoTopup is null until you set it. Its threshold reads back in micro-dollars as thresholdMicroUsd. consentCurrent is false when the consent text changed since you agreed; nothing is charged until you agree again. unresolvedAutoPurchase is set when an automatic payment failed or waits for the bank. It has status, amountCents and failureCode.

The calls below change how you pay. A dashboard sign-in needs the owner role. An API key always works. Each answers 503 payment_management_unavailable where payments are not set up. paymentManagementAvailable in GET /v1/billing tells you first. The ones that return a url send you to a hosted payment page; open it in a browser.

POST/v1/billing/subscribe

Start a subscription with fixed legal details. Returns the Checkout session ID.

Body
NameTypeDescription
planrequiredstarter | proThe plan to start. See Plans and credit.
profilerequiredobjectThe full legal buyer, sent with this call: legalName, business (boolean), address (line1, city and ISO country required; line2, state and postal_code optional), and taxIds (an array of {type, value}, empty for an individual). A company also sends businessName. These details are fixed for this payment. A later billing-details write does not change them.

Returns { "sessionId": "cs_..." } for on-page Checkout Elements. After payment, call POST /v1/billing/sync to read the subscription straight away. A missing plan or profile answers 400 invalid_plan.

POST/v1/billing/topup

Top up with fixed legal details. Returns the Checkout session ID.

Body
NameTypeDescription
amountCentsintegerThe compute credit to buy, in whole cents, between 2,000 and 1,000,000. The service fee (feeBps from GET /v1/billing) is added to the charge as a separate line. The balance gets the compute credit only. Left out, it is defaultTopupCents from GET /v1/billing.
profilerequiredobjectThe full legal buyer, sent with this call: legalName, business (boolean), address (line1, city and ISO country required; line2, state and postal_code optional), and taxIds (an array of {type, value}, empty for an individual). A company also sends businessName. These details are fixed for this payment. A later billing-details write does not change them.
Example
curl -X POST https://api.ci-router.com/v1/billing/topup \
  -H "Authorization: Bearer sk-cir_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amountCents": 5000,
    "profile": {
      "legalName": "Alex Martin",
      "business": false,
      "address": {
        "line1": "1 rue Exemple",
        "city": "Paris",
        "postal_code": "75001",
        "country": "FR"
      },
      "taxIds": []
    }
  }'

# 200
{ "sessionId": "cs_..." }

A top-up needs a subscription. Without one the call answers 400 no_subscription. An amount out of range, or a missing profile, answers 400 invalid_amount. Billing details that are not complete answer 409 billing_details_required.

GET/v1/billing/billing-details

The country and company details used for tax. POST sets them.

POST body
NameTypeDescription
countryrequiredstringTwo-letter country code.
businessrequiredbooleantrue for a company.
businessNamestringUp to 200 characters.
vatNumberstringAn EU VAT number, up to 40 characters.

POST /v1/billing/billing-details returns the stored details. A body that does not fit answers 400 invalid_billing_details. These details do not change an open Checkout, nor replace the profile a subscription or top-up start needs.

POST/v1/billing/card-checkout

Add a card. Returns the checkout page.

Returns { "sessionId": "...", "url": "..." }.

POST/v1/billing/portal

Open the page where you manage cards and invoices.

Returns { "url": "..." }.

POST/v1/billing/cancel

Cancel the subscription at the end of the period.

Returns status, cancelAtPeriodEnd and currentPeriodEnd. It also turns off automatic top-up. Without a subscription it answers 400 no_subscription.

GET/v1/billing/plan-change

Read the plan, a change set for the period end, and what each other plan costs.

Returns plan, periodEnd, pending (a cancel or a downgrade with its date, or null) and one quote per other plan: kind (upgrade or downgrade), effectiveAt, dueNowCents (VAT included), dueNowExcludingTaxCents, creditCents, renewalCents, renewsAt and prorationDate. Owner only.

POST/v1/billing/plan-change

Upgrade now or downgrade at the next renewal.

Body: { "plan": "pro", "prorationDate": 1795000000 }. Send the quote's prorationDate to pay the quoted amount; a quote older than 30 minutes is priced again. An upgrade charges the prorated difference at once and adds its compute part to the period's included usage, which ends at the renewal; a declined card answers 400 payment_failed and changes nothing. A downgrade starts at the next renewal. While the plan is set to end it answers 409 cancel_pending. Returns the same body as the GET.

POST/v1/billing/keep-plan

Undo a cancel or a downgrade set for the end of the period.

Returns the same body as the plan-change GET. Auto top-up stays off until you turn it on again.

POST/v1/billing/sync

Read the subscription again after a checkout.

Returns { "status": "active" }. status is null when there is no subscription.

PUT/v1/billing/auto-topup

Top up automatically when the balance runs low.

Body
NameTypeDescription
thresholdCentsrequiredintegerTop up when the balance falls to this amount. More than 0.
maxAmountCentsrequiredintegerThe most one automatic charge may take from the card before VAT, service fee included. From 2,500 to 1,250,000 on Starter, 2,400 to 1,200,000 on Pro.
monthlyCapCentsrequiredintegerThe most automatic charges may take from the card in a calendar month, on the same basis (fee included, before VAT). At least maxAmountCents.
consentrequiredbooleantrue when the team agrees to be charged automatically. Shown to the owner as the consent text.
Body
{
  "thresholdCents": 500,
  "maxAmountCents": 2500,
  "monthlyCapCents": 12500,
  "consent": true
}

Returns enabled, thresholdMicroUsd, maxAmountCents, monthlyCapCents and consentText. It needs an active subscription that renews. Errors answer 400 with one of these codes: no_subscription, consent_required, invalid_threshold, invalid_max_amount or invalid_cap.

DELETE /v1/billing/auto-topup turns it off and returns { "enabled": false }. If a bank asks to confirm an automatic payment, POST /v1/billing/auto-topup/recover requires the same complete legal profile in its JSON body, { "profile": { ... } }. It returns { "sessionId": "cs_..." } for a recovery Checkout, or 404 when there is nothing to recover. An automatic payment still settling answers 409. Recovery opens a second payment only once the first one is safe.

#Dependency cache

The cache is on by default. Jobs use CI Router's cache on routes where it is measured faster than GitHub's cache, and GitHub's cache elsewhere. activeRoutes counts the routes that use CI Router's cache. available is false when no route serves it for your team. See Dependency cache.

GET/v1/cache/usage

How much of your allowance the cache uses, per repository, and a 14 day history.

Response
{
  "available": true,
  "enabled": true,
  "activeRoutes": 3,
  "allowanceBytes": 100000000000,
  "usedBytes": 2147483648,
  "entries": 31,
  "expiresAfterDays": 7,
  "repos": [
    { "repoId": "123456", "repo": "your-org/web", "bytes": 1073741824, "entries": 14, "lastAccessedAt": "2026-03-10T09:40:00.000Z" }
  ],
  "moreRepos": 0,
  "daily": [ { "day": "2026-03-09", "storedBytes": 2000000000 } ]
}

Sizes are bytes. Repositories are listed biggest first, up to 50. moreRepos counts the rest. repo is null when its name could not be read. An entry is deleted expiresAfterDays days after it was last used.

GET/v1/cache/jobs

How your latest jobs used the cache, and why some did not write to it.

Response
{
  "total": 120,
  "readWrite": 104,
  "readOnly": 12,
  "noToken": 4,
  "jobs": [
    {
      "repo": "your-org/web",
      "workflow": "ci.yml",
      "job": "test",
      "at": "2026-03-10T10:00:00.000Z",
      "scope": { "status": "scoped", "kind": "pull_request", "reason": "pull_request", "access": "read_only" }
    },
    {
      "repo": "your-org/api",
      "workflow": "ci.yml",
      "job": "lint",
      "at": "2026-03-10T09:30:00.000Z",
      "scope": { "status": "no_token", "reason": "provider_unsupported" }
    }
  ]
}

The counts cover your last 500 jobs. readWrite jobs read and saved entries. readOnly jobs only read, such as a pull request reading its base branch. noToken jobs did not use CI Router's cache. jobs lists up to 50 of the read-only and no-cache jobs, newest first, each with a stable reason code.

GET/v1/cache/settings

The cache switch and who may use it.

Response
{
  "available": true,
  "enabled": true,
  "branchProtection": true,
  "repositoryAccess": "all",
  "repositories": [ { "id": 123456, "name": "your-org/web" } ],
  "allowanceBytes": 100000000000
}

A repository name is null when GitHub did not return it.

PATCH/v1/cache/settings

Change the cache settings. Send only the fields to change.

Body
NameTypeDescription
enabledbooleanTurn the cache on or off.
branchProtectionbooleanOn by default. Off lets a job on a branch other than the default one read entries written by other branches.
repositoryAccessall | selectedEvery repository, or only the ones listed in repositories.
repositoriesinteger[]GitHub repository ids. This is the whole list after the change, not an addition. Up to 5,000.
Body
{ "enabled": true, "repositoryAccess": "selected", "repositories": [123456] }

Returns the settings, like the GET. An empty body or a field it does not know answers 400 invalid_request. An id that is not in one of your installations answers 400 unknown_repository. When GitHub cannot confirm the ids, it answers 503 repositories_unavailable. A dashboard sign-in needs the owner role. An API key always works.

#Volumes

The volume endpoints read and change the volume setting, list and clear volumes, and read volume usage. They are documented on Volumes.

API reference | CI Router docs