Create or update users

PUT /_security/user/{username}

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

  • username string Required

    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, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

    Values are true, false, or wait_for.

application/json

Body Required

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
PUT /_security/user/{username}
curl \
 -X PUT 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
}