Users endpoints
Use the /users endpoint to manage user accounts in Langflow.
Add user
Create a new user account with a given username and password.
Requires authentication as a superuser if the Langflow server has authentication enabled.
- Python
- JavaScript
- curl
import os
import uuid
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
headers = {"Content-Type": "application/json", "x-api-key": api_key}
payload = {
"username": f"docsuser_{uuid.uuid4().hex[:12]}",
"password": "securepassword123",
}
response = requests.post(f"{base}/api/v1/users/", headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.text)
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/`;
const options = {
method: 'POST',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"username": "newuser2",
"password": "securepassword123"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));
curl -X POST \
"$LANGFLOW_URL/api/v1/users/" \
-H "Content-Type: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY" \
-d '{
"username": "newuser2",
"password": "securepassword123"
}'
The request returns an object describing the new user.
The user's UUID is stored in user_id in the Langflow database, and returned as id in the /users API response.
This user_id key is specifically for Langflow user management.
Result
{
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
"username": "newuser2",
"profile_image": null,
"store_api_key": null,
"is_active": false,
"is_superuser": false,
"create_at": "2025-05-29T16:02:20.132436",
"updated_at": "2025-05-29T16:02:20.132442",
"last_login_at": null,
"optins": {
"github_starred": false,
"dialog_dismissed": false,
"discord_clicked": false
}
}
Get current user
Retrieve information about the authenticated user.
- Python
- JavaScript
- curl
import os
import requests
url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/users/whoami"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.text)
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/whoami`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));
curl -X GET \
"$LANGFLOW_URL/api/v1/users/whoami" \
-H "accept: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY"
Result
{
"id": "07e5b864-e367-4f52-b647-a48035ae7e5e",
"username": "langflow",
"profile_image": null,
"store_api_key": null,
"is_active": true,
"is_superuser": true,
"create_at": "2025-05-08T17:59:07.855965",
"updated_at": "2025-05-29T15:06:56.157860",
"last_login_at": "2025-05-29T15:06:56.157016",
}
List all users
Get a paginated list of all users in the system.
Requires authentication as a superuser if the Langflow server has authentication enabled.
- Python
- JavaScript
- curl
import os
import requests
url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/users/?skip=0&limit=10"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.text)
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/?skip=0&limit=10`;
const options = {
method: 'GET',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));
curl -X GET \
"$LANGFLOW_URL/api/v1/users/?skip=0&limit=10" \
-H "accept: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY"
Result
{
"total_count": 3,
"users": [
{
"id": "07e5b864-e367-4f52-b647-a48035ae7e5e",
"username": "langflow",
"profile_image": null,
"store_api_key": null,
"is_active": true,
"is_superuser": true,
"create_at": "2025-05-08T17:59:07.855965",
"updated_at": "2025-05-29T15:06:56.157860",
"last_login_at": "2025-05-29T15:06:56.157016",
"optins": {
"github_starred": false,
"dialog_dismissed": true,
"discord_clicked": false,
"mcp_dialog_dismissed": true
}
},
{
"id": "c48a1f68-cc7e-491a-a507-a1a627708470",
"username": "newuser",
"profile_image": null,
"store_api_key": null,
"is_active": false,
"is_superuser": false,
"create_at": "2025-05-29T16:00:33.483386",
"updated_at": "2025-05-29T16:00:33.483392",
"last_login_at": null,
"optins": {
"github_starred": false,
"dialog_dismissed": false,
"discord_clicked": false
}
},
{
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
"username": "newuser2",
"profile_image": null,
"store_api_key": null,
"is_active": false,
"is_superuser": false,
"create_at": "2025-05-29T16:02:20.132436",
"updated_at": "2025-05-29T16:02:20.132442",
"last_login_at": null,
"optins": {
"github_starred": false,
"dialog_dismissed": false,
"discord_clicked": false
}
}
]
}
Update user
Modify an existing user's information with a PATCH request.
Requires authentication as a superuser if the Langflow server has authentication enabled.
This example activates the specified user's account and makes them a superuser:
- Python
- JavaScript
- curl
import os
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
headers = {"Content-Type": "application/json", "x-api-key": api_key}
who = requests.get(f"{base}/api/v1/users/whoami", headers=headers, timeout=30)
who.raise_for_status()
user_id = who.json()["id"]
payload = {"is_active": True}
response = requests.patch(f"{base}/api/v1/users/{user_id}", headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.text)
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8`;
const options = {
method: 'PATCH',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"is_active": true,
"is_superuser": true
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));
curl -X PATCH \
"$LANGFLOW_URL/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8" \
-H "Content-Type: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY" \
-d '{
"is_active": true,
"is_superuser": true
}'
Result
{
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
"username": "newuser2",
"profile_image": null,
"store_api_key": null,
"is_active": true,
"is_superuser": true,
"create_at": "2025-05-29T16:02:20.132436",
"updated_at": "2025-05-29T16:19:03.514527Z",
"last_login_at": null,
"optins": {
"github_starred": false,
"dialog_dismissed": false,
"discord_clicked": false
}
}
Reset password
Change the specified user's password to a new secure value.
Requires authentication as the target user.
- Python
- JavaScript
- curl
import os
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
headers = {"Content-Type": "application/json", "x-api-key": api_key}
who = requests.get(f"{base}/api/v1/users/whoami", headers=headers, timeout=30)
who.raise_for_status()
user_id = who.json()["id"]
# Must differ from the current password.
payload = {"password": "DocsExampleResetPass2025!"}
response = requests.patch(
f"{base}/api/v1/users/{user_id}/reset-password",
headers=headers,
json=payload,
timeout=30,
)
response.raise_for_status()
print(response.text)
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8/reset-password`;
const options = {
method: 'PATCH',
headers: {
"Content-Type": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
body: JSON.stringify({
"password": "newsecurepassword123"
}),
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));
curl -X PATCH \
"$LANGFLOW_URL/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8/reset-password" \
-H "Content-Type: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY" \
-d '{
"password": "newsecurepassword123"
}'
Result
{
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
"username": "langflow",
"profile_image": null,
"store_api_key": null,
"is_active": true,
"is_superuser": true,
"create_at": "2025-05-08T17:59:07.855965",
"updated_at": "2025-05-29T15:06:56.157860",
"last_login_at": "2025-05-29T15:06:56.157016",
"optins": {
"github_starred": false,
"dialog_dismissed": true,
"discord_clicked": false
}
}
Delete user
Remove a user account from the system.
Requires authentication as a superuser if the Langflow server has authentication enabled.
- Python
- JavaScript
- curl
import os
import uuid
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
create = requests.post(
f"{base}/api/v1/users/",
headers=headers,
json={"username": f"docsdel_{uuid.uuid4().hex[:12]}", "password": "securepassword123"},
timeout=30,
)
create.raise_for_status()
user_id = create.json()["id"]
delete = requests.delete(f"{base}/api/v1/users/{user_id}", headers=headers, timeout=30)
delete.raise_for_status()
print(delete.text)
const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8`;
const options = {
method: 'DELETE',
headers: {
"accept": `application/json`,
"x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
},
};
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const text = await response.text();
console.log(text);
})
.catch((error) => console.error(error));
curl -X DELETE \
"$LANGFLOW_URL/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8" \
-H "accept: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY"
Result
{
"detail": "User deleted"
}
Was this page helpful?