<@U04UQ68083H> is it possible to set password of a...
# ory-copilot
c
@chilly-king-10285 is it possible to set password of an identity using adminAPI?
b
A message from kapa.ai
Yes, it is possible to set or update the password of an identity using the Ory admin API. This can be done through the
updateIdentity
endpoint or when creating a new identity. When updating an existing identity, you can use the
PUT /admin/identities/{id}
endpoint [as described in the Ory API Reference](https://www.ory.sh/docs/reference/api). The request body allows you to include credentials, including a password. For creating a new identity with a password, you can use the
POST /admin/identities
endpoint. Here's an example of how you can include a password when creating an identity:
Copy code
json {   "schema_id": "<preset://email>",   "traits": {     "email": "<mailto:user@example.com|user@example.com>"   },   "credentials": {     "password": {       "config": {         "password": "the-password"       }     }   } }
As explained in the [Ory documentation on importing credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities#importing-credentials), you can provide the password in clear text. The system will then hash the password according to the configured password hashing algorithm before storing it in the database. It's important to note that when importing passwords, the usual password validation rules are not applied. Users may need to update their passwords to comply with any password policies in place using self-service flows. Remember to use these admin APIs responsibly and securely, as they allow privileged operations on user identities.