Scripts and monitoring jobs need a credential that works without an open browser session. Open WebUI API keys provide that access after an administrator enables them and grants the account permission.

Each key inherits its owner's role, groups, model access, and feature permissions. A standard account avoids administrator privileges, while API Key Endpoint Restrictions can limit the paths that all API keys may call.

Open WebUI keeps one API key per account rather than a named key for each integration. Creating a replacement invalidates the previous key, so separate automation accounts are appropriate when integrations need independent credentials.

Steps to enable Open WebUI API keys:

The starting point is an administrator session and a separate browser profile signed in as the intended standard user. The user must already belong to a dedicated group, such as Support Reviewers. Related: How to create a user in Open WebUI
Related: How to create an RBAC group in Open WebUI

Endpoint restrictions affect every API key on the instance, including administrator keys, and can interrupt existing integrations. Allowing /api/models permits that path and its descendants without restricting HTTP methods. Administrator keys can still reach administrator-only descendants, including model unloading. An existing shared instance needs its approved endpoint list retained instead. An open administrator browser session provides a way to restore the previous settings if a client is blocked.

  1. Open the administrator's profile menu.
  2. Select Settings.
  3. Select Authentication under Admin → System.
  4. Enable API Keys.
  5. Enable API Key Endpoint Restrictions.
  6. Enter /api/models in Allowed Endpoints to permit that path and its descendants.

    Entries are comma-separated paths. An entry permits that exact path and its slash-separated descendants, regardless of HTTP method. A broad entry such as /api therefore grants much more than model listing. These restrictions apply to API-key requests; browser sessions retain their normal access.

  7. Click Save to apply the authentication settings.
  8. Open the instance's /admin/users address in an administrator tab.

    For example, the address is https://openwebui.example.com/admin/users on an instance at that origin.

  9. Select Groups.
  10. Open the intended user's Support Reviewers group.
  11. Select the group's Permissions tab.
  12. Enable API Keys under Features Permissions.

    A group grant limits who can create and use keys without granting the feature to every standard user through Default permissions. Existing permissions for other features do not need changing.

  13. Click Save to apply the group permission.
  14. Open the standard user's profile menu in the separate browser profile.
  15. Select Settings in the standard user's menu.
  16. Select Account under Profile.
  17. Click Show beside Secrets in the API keys section.

    The key is a password-equivalent credential. Anyone holding it can act within the account's permitted API access. It must stay out of screenshots, tickets, repositories, shared logs, and shell history.

  18. Click Create new secret key.

    The generated key is masked. No integration name is requested, and key creation takes effect immediately without the account form's Save button.

  19. Click the Copy API Key icon beside the masked key.
  20. Read the copied key into a temporary variable in a Bash terminal.
    $ IFS= read -r -s -p 'Open WebUI API key: ' OPEN_WEBUI_API_KEY

    The prompt accepts the pasted value without echoing it. The variable stays in the current shell; a password manager or an approved secret store is appropriate for longer-term storage. Shell tracing must be off because it can log expanded secrets.

  21. Set the base URL of your Open WebUI instance.
    $ OPEN_WEBUI_URL="https://openwebui.example.com"
  22. Verify that the key can read the model-list endpoint.
    $ printf 'Authorization: Bearer %s\n' \
      "$OPEN_WEBUI_API_KEY" |
      curl --fail -sS -o /dev/null -w '%{http_code}\n' \
        -H @- "$OPEN_WEBUI_URL/api/models"
    200

    The header reaches curl through standard input so the expanded key is absent from curl's process arguments. HTTP 200 confirms access; 401 or 403 requires checking the key, global setting, group permission, endpoint allowance, and proxy forwarding of the Authorization header.

  23. Confirm that the same key is denied access to an excluded read-only endpoint.
    $ printf 'Authorization: Bearer %s\n' \
      "$OPEN_WEBUI_API_KEY" |
      curl -sS -o /dev/null -w '%{http_code}\n' \
        -H @- "$OPEN_WEBUI_URL/api/v1/users/permissions"
    403

    HTTP 403 is expected when this route is absent from Allowed Endpoints. HTTP 200 means the intended restriction is missing or broader than intended. This request only reads the current user's permissions and changes no account data.

Share this guide