@@ -61,36 +61,34 @@ For more information, see Langflow API keys
You can use Langflow API keys to interact with Langflow programmatically.
-A Langflow API key has the same permissions and access as the user who created it.
-This means your API key can only access your own flows, components, and database.
-You cannot access other users' resources with your own Langflow API keys.
-If you create a key as a superuser, then that key has superuser privileges within your Langflow server.
-In Langflow version 1.5 and later, most API endpoints require a Langflow API key, even when AUTO_LOGIN is True.
+
In Langflow version 1.5 and later, most API endpoints require a Langflow API key, even when LANGFLOW_AUTO_LOGIN is True.
For more information, see LANGFLOW_AUTO_LOGIN.
+
+A Langflow API key adopts the privileges of the user who created it.
+This means that API keys you create have the same permissions and access that you do, including access to your flows, components, and Langflow database.
+A Langflow API key cannot be used to access resources outside of your own Langflow server.
+In single-user environments, you are always a superuser, and your Langflow API keys always have superuser privileges.
+In multi-user environments, users who aren't superusers cannot use their API keys to access other users' resources.
+You must start your Langflow server with authentication enabled to allow user management and creation of non-superuser accounts.
You can generate a Langflow API key with the UI or the CLI.
-The UI-generated key is appropriate for most cases. The CLI-generated key is needed when your Langflow server is running in --backend-only mode.
+The UI-generated key is appropriate for most development use cases. The CLI-generated key is needed when your Langflow server is running in --backend-only mode.
- In the Langflow UI header, click your profile icon, and then select Settings.
- Click Langflow API Keys, and then click Add New.
- Name your key, and then click Create API Key.
- Copy the API key and store it securely.
-
If you're serving your flow with --backend-only=true, you can't create API keys in the UI, because the frontend is not running.
Depending on your authentication settings, note the following requirements for creating API keys with the Langflow CLI:
-- If
AUTO_LOGIN is FALSE, you must be logged in as a superuser.
-- If
AUTO LOGIN is TRUE, you're already logged in as superuser.
-
To create an API key for a user from the CLI, do the following:
+
If you're serving your flow with --backend-only=true, you can't create API keys in the UI because the frontend isn't running.
+In this case, you must create API keys with the Langflow CLI.
-
-
In your .env file, set AUTO_LOGIN=FALSE, and set superuser credentials for your server.
-
_10LANGFLOW_AUTO_LOGIN=False
_10LANGFLOW_SUPERUSER=administrator
_10LANGFLOW_SUPERUSER_PASSWORD=securepassword
+Recommended: Start your Langflow server with authentication enabled.
+This configuration is recommended for security reasons to prevent unauthorized API key and superuser creation, especially in production environments.
+However, if authentication isn't enabled (LANGFLOW_AUTO_LOGIN=True), all users are effectively superusers, and they can create API keys with the Langflow CLI.
-
-
To confirm your superuser status, call GET /users/whoami, and then check that the response contains "is_superuser": true:
-
_10 "$LANGFLOW_URL/api/v1/users/whoami" \
_10 -H "accept: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY"
-Result
_11 "id": "07e5b864-e367-4f52-b647-a48035ae7e5e",
_11 "username": "langflow",
_11 "profile_image": null,
_11 "store_api_key": null,
_11 "is_superuser": true,
_11 "create_at": "2025-05-08T17:59:07.855965",
_11 "updated_at": "2025-05-29T15:06:56.157860",
_11 "last_login_at": "2025-05-29T15:06:56.157016",
-
--
-
Create an API key:
+Create an API key with langflow api-key:
_10uv run langflow api-key
+All API keys created with the Langflow CLI have superuser privileges because the command requires superuser authentication, and Langflow API keys adopt the privileges of the user who created them.
@@ -177,6 +175,10 @@ The superuser can also deactivate a user's account as needed.
When LANGFLOW_NEW_USER_IS_ACTIVE=True, new user accounts are automatically activated.
_10LANGFLOW_NEW_USER_IS_ACTIVE=False
For more information, see Start a Langflow server with authentication enabled.
+
+Controls the availability of the langflow superuser command in the Langflow CLI.
+The default is True, but False is recommended to prevent unrestricted superuser creation.
+For more information, see langflow superuser.
This section shows you how to use the authentication environment variables to deploy a Langflow server with authentication enabled.
This involves disabling automatic login, setting superuser credentials, generating a secret encryption key, and enabling user management.
@@ -187,7 +189,7 @@ Additionally, you must sign in as a superuser to manage users and
_10LANGFLOW_AUTO_LOGIN=False
_10LANGFLOW_SUPERUSER_PASSWORD=
_10LANGFLOW_NEW_USER_IS_ACTIVE=False