The keys API manages the API keys that authenticate every request to linq. A key is the only principal linq issues — there are no user accounts or session tokens. Each key carries a set of claims that determine what it can do: read-only keys (viewer), read-write keys (editor), and full-control keys (admin). All key management operations — creating, updating, or revoking keys — require a key that has theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/org-quicko/linq/llms.txt
Use this file to discover all available pages before exploring further.
create:Key, update:Key, or delete:Key claim respectively, which only the admin preset holds by default. Authenticate all requests by passing your key in the x-api-key request header.
Presets and Claims
Keys can be assigned one of three built-in presets, or given a fully custom claim list for fine-grained control.viewer
Read access to all resources: links, rules, QR codes, domains, keys, analytics, and visits.
editor
All viewer permissions plus: create/update links and rules, create/update/delete QR codes.
admin
All editor permissions plus: archive/restore/purge links, manage domains, and manage keys.
preset— one ofviewer,editor, oradmin. The server expands it to the full claims list.claims— an explicit array of{ action, subject }objects for custom permissions.
Available actions and subjects for custom claims
Available actions and subjects for custom claims
Actions:
read, create, update, archive, restore, purge, deleteSubjects: Link, Rule, QrCode, Domain, Key, Analytics, VisitExample custom claim: { "action": "read", "subject": "Analytics" }.
Each action:subject pair must be unique within the claims array.Endpoints
List Keys
GET /api/v1/keysCreate Key
POST /api/v1/keysGet Key
GET /api/v1/keys/{id}Update Key
PATCH /api/v1/keys/{id}Revoke Key
DELETE /api/v1/keys/{id}Get Own Key
GET /api/v1/meList Keys
Returns a paginated list of all API keys. The raw key secret is never included. The response includes full metadata for callers with thecreate:Key claim (admin); other callers receive a summary (id, name, claims, preset only).
Query Parameters
Maximum number of results per page. Must be between 1 and 200.
Zero-based offset for pagination.
Create Key
Creates a new API key. Returns the full key object including the rawsecret — this value is shown exactly once and cannot be retrieved later.
create:Key claim (admin preset).
Body Parameters
A human-readable name for the key (1–100 characters, trimmed).
Assign a built-in permission level:
viewer, editor, or admin. Provide exactly one of preset or claims.An explicit array of permission claims. Each entry must be
{ "action": string, "subject": string }. Provide exactly one of preset or claims.Optional expiry timestamp. The key will be rejected after this instant. Pass
null or omit for a non-expiring key.- With preset
- With custom claims
- Response (201)
Get Key
Returns the metadata for a single API key by its ID. The raw secret is never included.read:Key claim.
Path Parameters
The UUID of the key to retrieve.
Update Key
Updates the name, permission preset/claims, or expiry of an existing key. All fields are optional. Provide at most one ofpreset or claims.
update:Key claim (admin preset). A key cannot modify its own claims or preset — attempting to do so returns a 403 Forbidden. The name and expiry can still be updated on the caller’s own key.
Path Parameters
The UUID of the key to update.
Body Parameters
Updated display name (1–100 characters).
Replace the key’s permissions with a built-in preset:
viewer, editor, or admin. Cannot be combined with claims.Replace the key’s permissions with an explicit claims list. Cannot be combined with
preset.New expiry time, or
null to remove the expiry.Revoke Key
Permanently deletes an API key. Any requests using the revoked key will immediately start receiving401 Unauthorized. This operation is irreversible. A key cannot revoke itself.
delete:Key claim (admin preset). Returns 204 No Content on success.
Path Parameters
The UUID of the key to revoke.
GET /api/v1/me
Returns the full metadata for the currently authenticated key — the one whose secret is in thex-api-key header. Useful for confirming that authentication is working and for inspecting the calling key’s own claims and preset.
Key Object Fields
UUID (v7) uniquely identifying this key.
Human-readable display name for the key.
The full expanded list of permission claims this key holds. Each claim is
{ action: string, subject: string }.The preset name (
viewer, editor, or admin) if the key’s claims exactly match a preset’s expansion. null for custom claim sets.A short, non-secret prefix derived from the key name, included in the raw secret for human identification (e.g.
lq_ci_). Never sensitive on its own.When the key expires and stops authenticating.
null for non-expiring keys.Timestamp when the key was created.
Timestamp of the last metadata update.
Only present in the
POST /api/v1/keys 201 response. The full raw key value to use in x-api-key headers. Never returned by any other endpoint.Bootstrap guard: if all keys are revoked and the key table is empty, the next server restart automatically mints a new admin key and prints its secret to the server’s standard output. This prevents a linq instance from becoming permanently inaccessible. You can also run
bun run key:create --name <name> --preset <preset> [--expires <ISO date>] directly on the server to create a key without a restart.