API reference
This key
GET/v1/key
Which key this is, what it may do, and when it ends: a health check for your integration. Any key may call it.
curl --fail-with-body -sS https://<workspace>.nightlab.io/v1/key \
-H "Authorization: Bearer $NIGHTLAB_API_KEY"
const res = await fetch(
"https://<workspace>.nightlab.io/v1/key",
{
headers: {
Authorization: `Bearer ${process.env.NIGHTLAB_API_KEY}`,
},
},
);
if (!res.ok) throw new Error(await res.text());
const answer = await res.json();
import os, requests
answer = requests.get(
"https://<workspace>.nightlab.io/v1/key",
headers={"Authorization": f"Bearer {os.environ['NIGHTLAB_API_KEY']}"},
timeout=30,
)
answer.raise_for_status()
The answer
200 with the key’s name, its hint (its first characters, never the key), its scopes, its projects (empty: every project) and expires_at. A 401 means the key is unknown, revoked or expired.
200 OK
{
"name": "CI on acme/shop",
"hint": "nlk_live_ab12",
"scopes": [
"runs:read",
"runs:write"
],
"projects": [
"shop"
],
"expires_at": "2027-01-30T10:00:00Z"
}