How to Set User Passwords For Users Created From API

Quentin RIBAUD: Hello! I want to create users through the API, but there is no way to specify the password in the payload. Thus, whenever I create a user, it is successfully added to the organization page, but I can’t login with it since I can’t specify a password. Do you have any recommendation? Here is the code i’m using to create the user, if you need any other information, feel free to ask :

def create_user(email, password):
url = f"{api_endpoint}/users/"
data = {
"email": email,
# "password": password, there is no password clause to specify the password that I can use to connect to the organization page
"username": email
}
response = <http://requests.post|requests.post>(url, headers=headers, json=data)

`if response.status_code == 201:`
    `print(f"User '{email}' created successfully.")`
`elif response.status_code == 400:`
    `print(f"{email} already has an account")`
`else:`
    `print(f"Failed to create user '{email}'. Error: {response.text}")`

Chris Hoge (HumanSignal): Label Studio doesn’t allow setting the password through the API. If you have access to the system hosting Label Studio, you can reset the password on the command line using: label-studio reset_password --username &lt;username&gt; --password &lt;password&gt;

Chris Hoge (HumanSignal): Details are here https://labelstud.io/guide/signup.html#Reset-password

Chris Hoge (HumanSignal): Because Label Studio open source allows any user to use their token to access the API, the app only allows password resets from the command line for security reasons.

Note: This post was generated by the Label Studio Archive Bot from a conversation in the Label Studio Slack, a gathering place for the Label Studio community. Someone in the community thought this was worth sharing!

If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs.

Quentin RIBAUD: Hi! that makes sense since any user can use their token to access and use the API, you cannot change the passwords that way, that’s what I was thinking, but thank you for the details!