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.
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.
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
| Topic | Rule |
|---|---|
| Money | Whole numbers in micro-dollars: 1,000,000 is $1. These fields end in MicroUsd. Amounts in cents end in Cents. |
| Times | ISO 8601 strings in UTC, such as 2026-03-10T10:00:00.000Z. |
| Days | UTC dates written YYYY-MM-DD. A range runs from the first day to the last day, both included. |
| Ids | Strings with a prefix, such as run_, job_ or key_. Treat them as opaque. |
| Lists | A list endpoint takes a limit query parameter. The reference gives its range and default, and how the list is ordered. |
| New fields | Responses 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,untilor both, as ISO timestamps with at most millisecond precision.sincedefaults to the start of your history anduntilto now. - The response adds
windowandnextCursor.limittakes 1 to 500 rows per page. - Send
nextCursorback ascursor, with the same path and window, to get the next page.nextCursorisnullon the last page. - A cursor only works with the query it came from. Another query answers 400
invalid_query.
# 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.
{
"error": "unauthorized",
"message": "unknown or revoked key"
}| Status | Meaning |
|---|---|
400 | The 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. |
401 | The key is missing, unknown or revoked. |
403 | Not allowed: a dashboard sign-in without the owner role, or a key on an endpoint that needs a sign-in. error is forbidden. |
404 | The resource does not exist, or belongs to another team. |
409 | The request conflicts with the current state, such as a payment that is still settling. |
429 | Too many requests. Wait for the number of seconds in the retry-after header. |
500 | An error on our side. error is internal. |
502 | GitHub or the tax service did not answer. Retry shortly. |
503 | A service the request needs is unavailable, such as payments or a GitHub check. Retry shortly. |
#Examples
# 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.