Create or update users
A password is required for adding a new user but is optional when updating an existing user. To change a user’s password without updating any other fields, use the change password API.
Path parameters
-
The username of the User
Query parameters
-
refresh string
If
true
(the default) then refresh the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
then do nothing with refreshes.Values are
true
,false
, orwait_for
.
Body Required
POST
/_security/user/{username}
curl \
-X POST http://api.example.com/_security/user/{username} \
-H "Content-Type: application/json" \
-d '{"username":"string","email":"string","full_name":"string","metadata":{"additionalProperty1":{},"additionalProperty2":{}},"password":"string","password_hash":"string","roles":["string"],"enabled":true}'
Request examples
{
"username": "string",
"email": "string",
"full_name": "string",
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"password": "string",
"password_hash": "string",
"roles": [
"string"
],
"enabled": true
}
Response examples (200)
{
"created": true
}