A newer version is available. For the latest information, see the
current release documentation.
Creates a new user
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Creates a new user
editCreates a new user.
Request
editPOST /api/v1/users
Responses
edit-
200 -
(
User)User successfully created
-
400 -
-
The provided user name is invalid. Check that it is not empty and it does not contain special characters. (code:
user.user_name.invalid) -
Some of the provided roles are invalid. (code:
user.roles.invalid) -
Some of the provided roles are forbidden. (code:
user.roles.forbidden) -
Trying to set a restricted field. (code:
user.restricted_field)
Headers
-
x-cloud-error-codes(string; allowed values: [user.user_name.invalid,user.roles.invalid,user.roles.forbidden,user.restricted_field]) - The error codes associated with the response
-
The provided user name is invalid. Check that it is not empty and it does not contain special characters. (code:
-
409 -
The username is already in use. (code:
user.user_name.conflict)Headers
-
x-cloud-error-codes(string; allowed values: [user.user_name.conflict]) - The error codes associated with the response
-
-
449 -
Elevated permissions are required. (code:
root.unauthorized.rbac.elevated_permissions_required)Headers
-
x-cloud-error-codes(string; allowed values: [root.unauthorized.rbac.elevated_permissions_required]) - The error codes associated with the response
-
Request example
editcurl -XPOST https://{{hostname}}/api/v1/users \
-H "Authorization: ApiKey $ECE_API_KEY" \
-H 'Content-Type: application/json' \
-d '
{
"builtin" : true,
"email" : "string",
"full_name" : "string",
"metadata" : {
"created_at" : "2019-01-01T00:00:00Z",
"created_by" : "string",
"first_login_at" : "2019-01-01T00:00:00Z",
"last_login_at" : "2019-01-01T00:00:00Z",
"updated_at" : "2019-01-01T00:00:00Z",
"updated_by" : "string"
},
"security" : {
"elevated_permissions" : {
"enabled" : true,
"expires_at" : "2019-01-01T00:00:00Z"
},
"enabled" : true,
"password" : "string",
"permissions" : [
"string"
],
"roles" : [
"string"
],
"security_realm" : {
"id" : "string",
"type" : "string"
}
},
"user_name" : "string"
}
'