Help / CLI and API
Command line and REST API
Everything you read in the console, and the monitors and warm pools you manage there, from a terminal, a script or a coding agent.
The drcli command
Install it with one line. It needs Python 3.9 or newer, which macOS, Linux and every GitHub-hosted runner already have.
curl -fsSL https://discountrunners.io/cli/install.sh | sh
The script puts drcli in ~/.local/bin; set DR_INSTALL_DIR to choose another folder. To read the program before you run it, download /cli/drcli instead.
Sign in
drcli login
Your browser opens on the same GitHub sign-in as the console. Pick the account to connect, and tick allow changes if you want the CLI to change monitors and warm pools as well as read. One sign-in covers one account. Run drcli login again to add another, drcli accounts to list them, and drcli switch <account> or --account to choose. The sign-in is saved in ~/.config/discountrunners/credentials.json, readable only by you, and renews itself for 30 days. drcli logout revokes it, and so does Settings → App connections in the console.
Commands
| Command | What it shows or does |
|---|---|
drcli whoami | The account, its balance and holds, this month's spend, caps and concurrency limit. |
drcli jobs | Jobs across every repository, newest first. Filter with --status failed, --search "deploy main" and --days 30. |
drcli jobs <job id> | One job: its runner class, VMs, queue and boot time, charge and timeline. Add --explain for why it is waiting or how it ended. |
drcli runs, drcli runs <run id> | Workflow runs, or one run's jobs on our runners. |
drcli usage --month 2026-10 | A month's charges by product, repository, day and runner class. |
drcli ledger | Your balance and every top-up, charge, refund and credit. |
drcli repos, drcli repos owner/name --view profile, drcli repos owner/name --disconnect | Repositories, or one repository's job history, per-job profile or runner choices; disconnect a repository or --connect it again. |
drcli recommend owner/name | Smaller or bigger runners, warm pools and jobs to move, with the expected saving. |
drcli classes, drcli quote <class> <minutes> | Runner classes and prices, and what a job would cost against GitHub-hosted runners with the same physical cores. No sign-in needed. |
drcli labels "<runs-on>" | The class a runs-on value maps to. Give a second value to check a rewrite. |
drcli monitors, drcli pools | List monitors and warm pools; drcli pools on|off|delete <id> and drcli monitors delete <id> change them. |
drcli telemetry | Show the OpenTelemetry export; drcli telemetry set --endpoint <url> --headers-stdin [--logs], test, on|off and delete change it. |
drcli api GET /v1/jobs -f status=failed | Any route below, with -d '{…}' for a JSON body. |
In a terminal, output is a table. When piped, or with --json, it is the API's JSON, ready for jq or an agent. Lists come a page at a time; the CLI prints the --cursor for the next page. Exit status is 0 on success, 4 when you need to sign in again, and 1 for any other error.
REST API
The API lives at https://api.discountrunners.io/v1 and speaks JSON. Its OpenAPI 3.1 description is at /v1/openapi.json, so you can generate a client or load it into an API tool.
Authentication
Send a bearer token: Authorization: Bearer dra_…, or an API token drk_… in CI. The quickest way to get one is drcli login and then drcli api, or read access_token from the credentials file for a quick script. Apps sign users in with OAuth 2.1: the authorization code flow with PKCE, dynamic client registration and refresh tokens, discovered from https://api.discountrunners.io/.well-known/oauth-protected-resource. A token covers one account and lasts an hour; refresh it with its refresh token. Two scopes exist:
runners:read: repositories, jobs, runs, usage, ledger, monitors and warm pools.runners:write: also create, change and delete monitors and warm pools.
Every request with a sign-in token is checked against the signer's current GitHub rights: someone who stops being an admin of the account loses access at once, whatever token they hold.
Tokens for CI and scripts
For a workflow, a bot or a cron job, an admin makes an API token under Settings → API tokens. Give it a name, choose 30 days, 90 days or a year, and tick Allow changes only if it needs to change monitors or warm pools. The token, starting drk_, is shown once; we keep only a hash of it. It belongs to the account rather than to the admin who made it, so it keeps working when people come and go, until it expires or an admin revokes it on the same page, which also shows when each token was last used. Closing the account revokes every token. An account can hold 20 tokens.
Put it in your repository's Actions secrets as DR_TOKEN; drcli uses DR_TOKEN whenever it is set.
- name: Stop if this month's spend is over $50
env:
DR_TOKEN: ${{ secrets.DR_TOKEN }}
run: |
curl -fsSL https://discountrunners.io/cli/install.sh | sh
~/.local/bin/drcli usage --json | jq -e '(.charged_usd | tonumber) < 50'
Changes that are off until you turn them on
Some changes are riskier for an app or a token to make on its own, so they are off for every account and do not appear in the API, the MCP tool list, the sign-in consent page or the token form until an admin of the account turns them on under Settings → Risky permissions for apps and tokens:
- Spending and placement controls (
PATCH /v1/account/controls): set or remove the monthly spending cap, change the concurrency limit, the repository allow-list and the size-trial cap, and turn machine upgrades on or off. - Delete storage (
POST /v1/storage/delete,DELETE /v1/history-import): delete cache entries, sticky disk snapshots and repository images, by id or all that match, or the imported Actions history. Deletions can't be undone. - Telemetry export (
PATCHandDELETE /v1/telemetry-export,POST /v1/telemetry-export/test): choose where the account's OpenTelemetry traces and metrics go. Reading the export (GET /v1/telemetry-export) needs onlyrunners:read; header values are never returned. - Job log export (the
logsfield ofPATCH /v1/telemetry-export): send every line of the account's job logs to its telemetry endpoint. A token or app needs both permissions to enable logs or change an export that sends them. - SSH debugging (
PATCH /v1/account/ssh,POST /v1/jobs/{job_id}/ssh): turn SSH debugging on or off and ask to SSH into a job as yourself. Only a person's own sign-in gets this; an API token never does. - Network (
POSTandDELETE /v1/static-ip,PATCH /v1/account/egress,POST /v1/captures,DELETE /v1/captures/{capture_id}): reserve or release the static egress IP, which is billed monthly (releasing it needs the address asconfirm), change the egress allow-list, and start or stop packet captures.
Everyday settings need only runners:write: PATCH /v1/account/settings (job log costs, automatic re-runs, package mirrors, credit emails), PATCH /v1/repositories/{owner}/{name}/pr-cost-comments, PATCH /v1/repositories/{owner}/{name}/connection to disconnect a repository or connect it again, POST /v1/monitors/{monitor_id}/test, POST /v1/access-requests to ask for a runner class, and PATCH /v1/history-import to start, pause or resume the history import. GET /v1/account/settings reads them all with runners:read. In the terminal: drcli settings set --no-job-log-costs, drcli storage delete --kind cache --id 12, drcli ssh ask 4321.
Turning one on does not hand it to anything already connected: an app gets it only when someone signs in again and ticks it on the consent page, and a token only when an admin makes a new one with it ticked. Turning one off revokes, at once, every sign-in and token that holds it. Every change is recorded in the account's settings history with who made it. Payments and top-ups are never available through the API.
Requests and errors
GET and DELETE take query parameters; POST and PATCH take a JSON object. Unknown parameters are refused. Lists return a next_cursor (the ledger a next_before); pass it back to get the next page. Money is in US dollars as decimal strings, and times are ISO 8601 in UTC. Names that come from your repositories (workflow, job, branch, labels) are trimmed to one printable line of up to 120 characters.
Errors carry an HTTP status and {"error": {"code": "…", "message": "…"}}: 400 invalid_request, 401 unauthorized or invalid_token, 403 insufficient_scope, 404 not_found, 429 rate_limited (with Retry-After), and 503 when sign-in cannot be checked for a moment. Each signed-in account may make 600 requests a minute; anonymous callers 60 a minute per address.
curl -s -H "Authorization: Bearer $TOKEN" \
"https://api.discountrunners.io/v1/jobs?status=failed&days=7" | jq '.jobs[].job_id'
Routes
| Method | Path | What | Needs |
|---|---|---|---|
GET | /v1/classes | List runner classes | nothing |
GET | /v1/quote | Price a job | nothing |
POST | /v1/labels/map | Map runs-on to a class | nothing |
POST | /v1/labels/check | Check a runs-on rewrite | nothing |
GET | /v1/account | Account status | read |
GET | /v1/usage | Monthly usage | read |
GET | /v1/ledger | Balance and ledger entries | read |
GET | /v1/activity | Summarize recent activity | read |
GET | /v1/repositories | List repositories | read |
GET | /v1/repositories/{owner}/{name}/runners | Each job's runner | read |
GET | /v1/repositories/{owner}/{name}/jobs | A repository's job runs | read |
GET | /v1/repositories/{owner}/{name}/profile | Profile a repository's jobs | read |
GET | /v1/repositories/{owner}/{name}/recommendations | Recommend runner changes | read |
GET | /v1/repositories/{owner}/{name}/parallel-plan | Plan a faster workflow | read |
GET | /v1/jobs | List jobs | read |
GET | /v1/jobs/{job_id} | Show a job | read |
GET | /v1/jobs/{job_id}/network | A job's network traffic | read |
GET | /v1/jobs/{job_id}/explanation | Explain a job's state | read |
GET | /v1/runs | List workflow runs | read |
GET | /v1/runs/{run_id} | Show a workflow run | read |
GET | /v1/monitors | List monitors | read |
POST | /v1/monitors | Create a monitor | changes |
PATCH | /v1/monitors/{monitor_id} | Change a monitor | changes |
DELETE | /v1/monitors/{monitor_id} | Delete a monitor | changes |
POST | /v1/variable-changes | Record an Actions variable change | changes |
GET | /v1/storage | List caches, sticky disks or images | read |
GET | /v1/account/settings | Show the account's settings | read |
PATCH | /v1/account/settings | Change the account's settings | changes |
PATCH | /v1/repositories/{owner}/{name}/pr-cost-comments | Turn pull-request cost comments on or off | changes |
PATCH | /v1/repositories/{owner}/{name}/connection | Disconnect or reconnect a repository | changes |
POST | /v1/monitors/{monitor_id}/test | Send a monitor's test alert | changes |
POST | /v1/access-requests | Ask for a runner class | changes |
PATCH | /v1/history-import | Start, pause or resume the history import | changes |
GET | /v1/telemetry-export | Show the telemetry export | read |
The same operations are tools on the MCP server, so an agent connected there gets the same answers.
Screenshots and videos in Help are a demonstration rebuilt from our own benchmark jobs. The jobs, steps, run times and charges are real; queue waits and the CPU, memory, disk and network graphs in them are illustrative, not measurements.