Skip to content

Commit f493540

Browse files
authored
Merge pull request #1641 from silentoplayz/docs/api-keys-session-endpoints
docs: list the endpoints that refuse API keys
2 parents f020f5e + 1b9550a commit f493540

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎docs/features/authentication-access/api-keys.md‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: "API Keys"
77

88
**Programmatic access to Open WebUI, for scripts, bots, and integrations.**
99

10-
An API key is a personal access token that lets external code call the same endpoints the web UI uses. Anything you can do in a browser - chat completions, model listing, file uploads, RAG queries - your scripts can do with a single `Authorization: Bearer` header. The key acts as the user who created it, so there is no separate permission model to learn.
10+
An API key is a personal access token that lets external code call the same endpoints the web UI uses. Anything you can do in a browser - chat completions, model listing, file uploads, RAG queries - your scripts can do with a single `Authorization: Bearer` header, except the few account-security endpoints listed under [Endpoints that need a signed-in session](#endpoints-that-need-a-signed-in-session). The key acts as the user who created it, so there is no separate permission model to learn.
1111

1212
Each account has exactly **one** API key. Creating a key when you already have one replaces it, and the previous key stops working immediately.
1313

@@ -193,6 +193,7 @@ Retiring an integration for good is a **Delete** rather than a rotation, since t
193193
- The global **API Keys** toggle may have been turned off, which invalidates existing keys
194194
- The key's owner may have lost the **API Keys** feature permission
195195
- If endpoint restrictions are enabled, confirm the route you are calling is in the allowlist
196+
- If the response body reads `A human session is required.`, the route does not accept API keys at all. See [Endpoints that need a signed-in session](#endpoints-that-need-a-signed-in-session)
196197

197198
---
198199

@@ -206,6 +207,24 @@ An account holds a single unnamed key. There is no way to run two keys side by s
206207

207208
A key inherits the full permissions of the user who created it. You cannot restrict a key to a subset of its owner's permissions, and endpoint restrictions apply instance-wide rather than per key.
208209

210+
### Endpoints that need a signed-in session
211+
212+
These routes accept only the token of a browser sign-in. An API key gets `403` with `A human session is required.`, whatever the owner's role or permissions:
213+
214+
| Route | What it does |
215+
|-------|--------------|
216+
| `GET /api/v1/auths/` | Returns the signed-in user with its token and sets the `token` cookie |
217+
| `GET /api/v1/auths/mfa/status` | Two-factor status |
218+
| `POST /api/v1/auths/mfa/replace` | Starts replacing a two-factor method |
219+
| `POST /api/v1/auths/mfa/recovery/codes` | Creates new recovery codes |
220+
| `GET /api/v1/auths/sessions` | Lists your persistent sessions for native clients |
221+
| `POST /api/v1/auths/sessions` | Creates a persistent session for a native client |
222+
| `GET /api/v1/auths/sessions/{session_id}/request` | Reads a pending sign-in request from a native client |
223+
| `POST /api/v1/auths/sessions/{session_id}/authorize` | Approves that sign-in request |
224+
| `DELETE /api/v1/auths/sessions/{session_id}` | Revokes a persistent session |
225+
226+
To read the key owner's own account with an API key, call `GET /api/v1/users/user/status`. It returns the user record, including `id`, `name`, `email` and `role`, and answers `403` when user status is turned off with [`ENABLE_USER_STATUS`](/reference/env-configuration#enable_user_status). `GET /api/v1/users/permissions` returns the owner's permissions.
227+
209228
### No automatic expiration
210229

211230
API keys do not expire. Rotating a key is a manual action, and there is no scheduled or time-based expiry to fall back on.

0 commit comments

Comments
 (0)