Skip to main content

使用者端點

使用 /users 端點來管理 AgentBuilder 中的使用者帳戶。

新增使用者

使用給定的使用者名稱和密碼建立新使用者帳戶。

如果 AgentBuilder 伺服器啟用了認證,則需要以超級使用者身份進行認證。


_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v1/users/" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-d '{
_10
"username": "newuser2",
_10
"password": "securepassword123"
_10
}'

請求返回描述新使用者的物件。 使用者的 UUID 儲存在 AgentBuilder 資料庫中的 user_id 中,並在 /users API 回應中作為 id 返回。 此 user_id 金鑰專門用於 AgentBuilder 使用者管理。

結果

_16
{
_16
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
_16
"username": "newuser2",
_16
"profile_image": null,
_16
"store_api_key": null,
_16
"is_active": false,
_16
"is_superuser": false,
_16
"create_at": "2025-05-29T16:02:20.132436",
_16
"updated_at": "2025-05-29T16:02:20.132442",
_16
"last_login_at": null,
_16
"optins": {
_16
"github_starred": false,
_16
"dialog_dismissed": false,
_16
"discord_clicked": false
_16
}
_16
}

獲取當前使用者

擷取已認證使用者的資訊。


_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/users/whoami" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

結果

_11
{
_11
"id": "07e5b864-e367-4f52-b647-a48035ae7e5e",
_11
"username": "langflow",
_11
"profile_image": null,
_11
"store_api_key": null,
_11
"is_active": true,
_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",
_11
}

列出所有使用者

獲取系統中所有使用者的分頁列表。

如果 AgentBuilder 伺服器啟用了認證,則需要以超級使用者身份進行認證。


_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/users/?skip=0&limit=10" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

結果

_54
{
_54
"total_count": 3,
_54
"users": [
_54
{
_54
"id": "07e5b864-e367-4f52-b647-a48035ae7e5e",
_54
"username": "langflow",
_54
"profile_image": null,
_54
"store_api_key": null,
_54
"is_active": true,
_54
"is_superuser": true,
_54
"create_at": "2025-05-08T17:59:07.855965",
_54
"updated_at": "2025-05-29T15:06:56.157860",
_54
"last_login_at": "2025-05-29T15:06:56.157016",
_54
"optins": {
_54
"github_starred": false,
_54
"dialog_dismissed": true,
_54
"discord_clicked": false,
_54
"mcp_dialog_dismissed": true
_54
}
_54
},
_54
{
_54
"id": "c48a1f68-cc7e-491a-a507-a1a627708470",
_54
"username": "newuser",
_54
"profile_image": null,
_54
"store_api_key": null,
_54
"is_active": false,
_54
"is_superuser": false,
_54
"create_at": "2025-05-29T16:00:33.483386",
_54
"updated_at": "2025-05-29T16:00:33.483392",
_54
"last_login_at": null,
_54
"optins": {
_54
"github_starred": false,
_54
"dialog_dismissed": false,
_54
"discord_clicked": false
_54
}
_54
},
_54
{
_54
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
_54
"username": "newuser2",
_54
"profile_image": null,
_54
"store_api_key": null,
_54
"is_active": false,
_54
"is_superuser": false,
_54
"create_at": "2025-05-29T16:02:20.132436",
_54
"updated_at": "2025-05-29T16:02:20.132442",
_54
"last_login_at": null,
_54
"optins": {
_54
"github_starred": false,
_54
"dialog_dismissed": false,
_54
"discord_clicked": false
_54
}
_54
}
_54
]
_54
}

更新使用者

使用 PATCH 請求修改現有使用者的資訊。

如果 AgentBuilder 伺服器啟用了認證,則需要以超級使用者身份進行認證。

此示例啟動指定使用者的帳戶並使其成為超級使用者:


_10
curl -X PATCH \
_10
"$LANGFLOW_URL/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-d '{
_10
"is_active": true,
_10
"is_superuser": true
_10
}'

結果

_16
{
_16
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
_16
"username": "newuser2",
_16
"profile_image": null,
_16
"store_api_key": null,
_16
"is_active": true,
_16
"is_superuser": true,
_16
"create_at": "2025-05-29T16:02:20.132436",
_16
"updated_at": "2025-05-29T16:19:03.514527Z",
_16
"last_login_at": null,
_16
"optins": {
_16
"github_starred": false,
_16
"dialog_dismissed": false,
_16
"discord_clicked": false
_16
}
_16
}

重設密碼

將指定使用者的密碼更改為新的安全值。

需要以目標使用者身份進行認證。


_10
curl -X PATCH \
_10
"$LANGFLOW_URL/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8/reset-password" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-d '{
_10
"password": "newsecurepassword123"
_10
}'

結果

_16
{
_16
"id": "10c1c6a2-ab8a-4748-8700-0e4832fd5ce8",
_16
"username": "langflow",
_16
"profile_image": null,
_16
"store_api_key": null,
_16
"is_active": true,
_16
"is_superuser": true,
_16
"create_at": "2025-05-08T17:59:07.855965",
_16
"updated_at": "2025-05-29T15:06:56.157860",
_16
"last_login_at": "2025-05-29T15:06:56.157016",
_16
"optins": {
_16
"github_starred": false,
_16
"dialog_dismissed": true,
_16
"discord_clicked": false
_16
}
_16
}

刪除使用者

從系統中移除使用者帳戶。

如果 AgentBuilder 伺服器啟用了認證,則需要以超級使用者身份進行認證。


_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v1/users/10c1c6a2-ab8a-4748-8700-0e4832fd5ce8" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

結果

_10
{
_10
"detail": "User deleted"
_10
}

Search