Sign in

API reference

The API

Start runs on tracker issues from your own systems, read how they went, and hear back by webhook. Every run is tied to an issue, and ends, at best, in a draft pull request a person merges.

Its address

Your workspace’s own host, under /v1: https://<workspace>.nightlab.io/v1/. Version 1 only gains fields and calls; anything that would break a caller would be /v2.

Keys

A workspace admin makes a key in the portal, under Settings › Integrations › API keys, or through the workspace’s admin API, POST /workspace/api-keys, signed in (with their second factor, where sign-in asks for one). Send the key on every call as Authorization: Bearer $NIGHTLAB_API_KEY. It’s shown once, and opens /v1 alone, at its own workspace’s address, within its scopes and projects:

A key can’t approve a run, merge, or change a setting. GET /v1/key says which key you used and when it ends. Start runs from CI walks through making one.

Answers and limits

A successful answer, and the rate limit’s own 429, carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds until the window resets). Other refusals don’t.

Errors

A refusal is application/problem+json (RFC 9457): its status, the status’s title, and a detail saying what to change. A 422 for a wrong field also lists each one in errors.

{
  "type": "about:blank",
  "title": "Conflict",
  "status": 409,
  "detail": "SHOP-1431 already has an active run (run-42): let it finish…"
}

Pages

A list comes a page at a time: pass its next_cursor as cursor for the next, until it’s null. Runs come newest first.

The run

What every run call answers. It never carries issue text, code or amounts.

FieldWhat it is
idThe run’s id, like run-42.
project, issueIts project’s slug, and the tracker issue.
actionbuild or improve; runs started elsewhere can also be refresh or review.
stateWhere it is (below).
outcomeHow a completed run ended, like pr_opened, no_pr or gates_failed; null until then.
no_pr_reasonWhy no pull request opened, when none did.
pr_url, pr_stateIts pull request, and whether it’s draft, open, merged or closed, once known.
external_refYour reference, as you started it; empty for runs started elsewhere.
summaryFor the people who raised the issue, once the run has ended: resolves (yes, partially, no or unknown) and text, with no code, file paths, commands or credentials. For an issue with a Jira security level, it says what happened to the run without describing the issue. null until it’s written, usually within a minute of the end, and for runs not started through the API.
created_at, updated_at, finished_atWhen, in UTC.
linksThe run in the API (api) and in the portal (portal).

States