ultrarouter docs
API reference

API keys

API-key provisioning.

API-key provisioning.

This page is GENERATED from the OpenAPI spec (openapi.yaml) — it can never drift from the served API. Set UR_BASE_URL (required: your gateway’s URL) and UR_API_KEY (an ur_sk_* key); secrets are always the $UR_API_KEY placeholder.

List API keys

GET /v1/workspaces/{id}/api-keys

Auth: Session cookie + workspace RBAC.

curl -sS -X GET "$UR_BASE_URL/v1/workspaces/req_0000000000000000/api-keys" \
  -H "Cookie: better-auth.session_token=$UR_SESSION"

Create an API key

POST /v1/workspaces/{id}/api-keys

The raw ur_sk_* secret is returned exactly once — never persisted, never logged.

Auth: Session cookie + workspace RBAC.

curl -sS -X POST "$UR_BASE_URL/v1/workspaces/req_0000000000000000/api-keys" \
  -H "Cookie: better-auth.session_token=$UR_SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "mode": "string"
  }'

Roll an API key secret

POST /v1/workspaces/{id}/api-keys/{keyId}/roll

Issues a fresh secret on the SAME key identity; the new secret is shown once.

Auth: Session cookie + workspace RBAC.

curl -sS -X POST "$UR_BASE_URL/v1/workspaces/req_0000000000000000/api-keys/key_0000000000000000/roll" \
  -H "Cookie: better-auth.session_token=$UR_SESSION"

Update an API key's default call type

PATCH /v1/workspaces/{id}/api-keys/{keyId}

Set (a slug/id of an existing call type of this workspace) or clear (null) the key’s DEFAULT call type. A request served by this key that carries no call_type (body) and no X-UR-Call-Type header is then attributed to it — so a plug-and-play OpenAI-compatible client needs only the base URL + the key. An unknown slug/id is a 404. Bumps config_version (visible ≤ 5 s).

Auth: Session cookie + workspace RBAC.

curl -sS -X PATCH "$UR_BASE_URL/v1/workspaces/req_0000000000000000/api-keys/key_0000000000000000" \
  -H "Cookie: better-auth.session_token=$UR_SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "default_call_type": "string"
  }'

Revoke an API key

DELETE /v1/workspaces/{id}/api-keys/{keyId}

Auth: Session cookie + workspace RBAC.

curl -sS -X DELETE "$UR_BASE_URL/v1/workspaces/req_0000000000000000/api-keys/key_0000000000000000" \
  -H "Cookie: better-auth.session_token=$UR_SESSION"