You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f493540
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/features/authentication-access/api-keys.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ title: "API Keys"
7
7
8
8
**Programmatic access to Open WebUI, for scripts, bots, and integrations.**
9
9
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.
11
11
12
12
Each account has exactly **one** API key. Creating a key when you already have one replaces it, and the previous key stops working immediately.
13
13
@@ -193,6 +193,7 @@ Retiring an integration for good is a **Delete** rather than a rotation, since t
193
193
- The global **API Keys** toggle may have been turned off, which invalidates existing keys
194
194
- The key's owner may have lost the **API Keys** feature permission
195
195
- 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)
196
197
197
198
---
198
199
@@ -206,6 +207,24 @@ An account holds a single unnamed key. There is no way to run two keys side by s
206
207
207
208
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.
208
209
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
+
209
228
### No automatic expiration
210
229
211
230
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