Password ManagerDeveloper Tools

Personal API Key for CLI Authentication

Your Bitwarden personal API key can be used as a method for authenticating into the command line interface (CLI).

Hinweis

Your personal API key is not the same as the organization API key used to access the Bitwarden Public API or Directory Connector. Personal API keys will have a client_id with format "user.clientId", while organization API keys will have a client_id with format "organization.ClientId".

Get your personal API key

Complete the following steps to get your personal API key:

  1. In the web vault, select the profile icon and choose Account Settings from the dropdown:

    Kontoeinstellungen
    Kontoeinstellungen

  2. From the Account Setting menu, select the Security page and the Keys tab:

    Keys tab
    Keys tab

  3. Select the View API Key button will prompt you to enter your master password.

    Once correctly entered, you will be provided the following:

    • client_id: "user.clientId" (This value is unique to your account and does not change.)

    • client_secret: "clientSecret" (This value is unique and can be rotated).

    • scope: "api" (This value will always be "api").

    • grant_type: "client_credentials" (This value will always be "client_credentials").

Rotate your API key

Select the Rotate API Key button to rotate your personal API key. Rotating your key will only change your client_secret.

Rotating your key will invalidate your previous key and all active sessions using that key.

Authenticate using your API key

Logging in to the CLI with the personal API key is recommended for automated workflows or providing access to an external application. To log in with the API key:

bw login --apikey

This will initiate a prompt for your personal client_id and client_secret. Once your session is authenticated using these values, you'll be prompted to use the unlock command (learn more).

Using API key environment variables

In scenarios where automated work is being done with the Bitwarden CLI, you can save environment variables to prevent the need for manual intervention at authentication.

Environment variable name

Required value

BW_CLIENTID

client_id

BW_CLIENTSECRET

client_secret

Make a Suggestion to this Article...*
Email (optional)

Kontaktieren Sie unser Team vom Kundendienst

Für technische Fragen und bei Fragen zu Rechnungen, Produkten und Familien/Premium-Tarifen.

Name*
E-Mail-Adresse Ihres Bitwarden-Kontos*
Verify account email*
Product*
Are you self-hosting?*
Betreff*
Nachricht...*

Cloud-Status

Check status

© 2023 Bitwarden, Inc.NutzungsbedingungenDatenschutzerklärungSitemap