API

Read your runs, usage and billing, and manage keys and settings, from scripts and tools.

#Base URL

Every endpoint lives under /v1 on one host. Requests and responses are JSON.

Base URL
https://api.ci-router.com/v1

#Authentication

Send your team's API key as a Bearer token. Create a key on the API keys page of the dashboard. It is shown once. See API keys.

A request with a key
curl https://api.ci-router.com/v1/runs?limit=5 \
  -H "Authorization: Bearer sk-cir_..."
  • A key acts for the whole team. It can call every endpoint in the reference, including the ones that need the owner role.
  • A key cannot manage team members, invites or personal accounts. Those need a dashboard sign-in.
  • Keep keys out of source control. Give each tool its own key.
  • Revoke a key if it leaks. Rotate it to get a new secret.
  • Every answer is scoped to your team. An id that belongs to another team answers like an id that does not exist.

#Conventions

Conventions the endpoints share
TopicRule
MoneyWhole numbers in micro-dollars: 1,000,000 is $1. These fields end in MicroUsd. Amounts in cents end in Cents.
TimesISO 8601 strings in UTC, such as 2026-03-10T10:00:00.000Z.
DaysUTC dates written YYYY-MM-DD. A range runs from the first day to the last day, both included.
IdsStrings with a prefix, such as run_, job_ or key_. Treat them as opaque.
ListsA list endpoint takes a limit query parameter. The reference gives its range and default, and how the list is ordered.
New fieldsResponses can gain fields over time. Ignore fields you do not use.

#Pagination

GET /v1/runs and GET /v1/jobs return the latest rows. To read older rows, page through a time window.

  • Pass since, until or both, as ISO timestamps with at most millisecond precision. since defaults to the start of your history and until to now.
  • The response adds window and nextCursor. limit takes 1 to 500 rows per page.
  • Send nextCursor back as cursor, with the same path and window, to get the next page. nextCursor is null on the last page.
  • A cursor only works with the query it came from. Another query answers 400 invalid_query.
Page through a month of runs
# First page of the runs created in March 2026
curl "https://api.ci-router.com/v1/runs?since=2026-03-01T00:00:00.000Z&until=2026-04-01T00:00:00.000Z" \
  -H "Authorization: Bearer sk-cir_..."

# { "runs": [ ... ], "window": { "since": "...", "until": "..." }, "nextCursor": "eyJ2Ijox..." }

# Next page: same path and window, plus the cursor
curl "https://api.ci-router.com/v1/runs?since=2026-03-01T00:00:00.000Z&until=2026-04-01T00:00:00.000Z&cursor=eyJ2Ijox..." \
  -H "Authorization: Bearer sk-cir_..."

The diagnostics lists use the same cursor and nextCursor. They take 200 rows per page at most, 50 by default.

#Errors

A failed request returns a 4xx or 5xx status and a JSON body. error is a short code. Some errors also carry a message, a sentence for a person, and some carry extra fields. Match on the status first, then on error. Never match on the message.

An error
{
  "error": "unauthorized",
  "message": "unknown or revoked key"
}
Status codes
StatusMeaning
400The request is malformed, such as a missing or invalid value in the body or the query. error is invalid_request, invalid_query or a more specific code. Most endpoints ignore body fields they do not know. PATCH /v1/me/run-phases, PATCH /v1/cache/settings and PATCH /v1/volumes/settings reject them.
401The key is missing, unknown or revoked.
403Not allowed: a dashboard sign-in without the owner role, or a key on an endpoint that needs a sign-in. error is forbidden.
404The resource does not exist, or belongs to another team.
409The request conflicts with the current state, such as a payment that is still settling.
429Too many requests. Wait for the number of seconds in the retry-after header.
500An error on our side. error is internal.
502GitHub or the tax service did not answer. Retry shortly.
503A service the request needs is unavailable, such as payments or a GitHub check. Retry shortly.

#Examples

Spend, receipts and diagnostics
# Spend per day, last 14 days (the default range)
curl "https://api.ci-router.com/v1/usage/costs" \
  -H "Authorization: Bearer sk-cir_..."

# Did GitHub run 1234567890 use CI Router, and what happened?
curl "https://api.ci-router.com/v1/jobs/receipt?githubRunId=1234567890" \
  -H "Authorization: Bearer sk-cir_..."

# Why did its jobs fail, and what should change?
curl "https://api.ci-router.com/v1/diagnostics/why?githubRunId=1234567890" \
  -H "Authorization: Bearer sk-cir_..."

The full list of endpoints, with parameters and example responses, is in the API reference.

API | CI Router docs