| Verb | URI | Description |
|---|---|---|
| POST | v2.0/users | Add a user. |
Normal Response Code(s): 201
Error Response Code(s): identityFault (400, 500, …), badRequest (400), unauthorized (401), forbidden (403), badMethod (405), overLimit (413), serviceUnavailable (503), itemNotFound (404), badMediaType (415)
![]() | Note |
|---|---|
This call is available only to users who hold the admin
role
( |
![]() | Warning |
|---|---|
If you use this |
To add a user, specify the user's email and username values, as well as whether
the user's initial status is enabled.
A successful response echoes the requested values and adds a value for id.
To add a user and specify an initial password for that user, include the password in a request resembling the "Add User with Password Request" examples shown below.
If you do not specify a password for the new user, one will be generated.
If an initial password is generated, it is included in a successful response to this request. After the user is created, the password cannot be retrieved by any means. Make note of the password in the response and supply that password to the user.
Within an account, a maximum of 100 sub-users (sub-accounts) can be added.
| Name | Style | Type | Description |
|---|---|---|---|
X-Auth-Token | Header | String | You need a valid admin token for access. The |
Example 4.7. Add User Request: XML
<?xml version="1.0" encoding="UTF-8"?>
<user xmlns="http://docs.openstack.org/identity/api/v2.0"
enabled="true" email="john.smith@example.org"
username="jqsmith"/>
Example 4.8. Add User Request: JSON
{
"user": {
"username": "jqsmith",
"email": "john.smith@example.org",
"enabled": true
}
}
Example 4.9. Add User with Password Request: XML
<user username="cmarin1subX2"
email="cmarin1-sub@example.com"
enabled="true"
ns1:password="Password48"
xmlns:ns1="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
xmlns:ns2="http://docs.openstack.org/identity/api/v2.0" />Example 4.10. Add User with Password Request: JSON
{
"user": {
"username": "cmarin1subX2",
"email": "cmarin1-sub@example.com",
"enabled": true,
"OS-KSADM:password":"Password48"
}
}This operation does not require a request body.
Example 4.11. Add User Response: XML
<?xml version="1.0" encoding="UTF-8"?>
<user xmlns="http://docs.openstack.org/identity/api/v2.0"
xmlns:ns2="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
xmlns:rax-auth="http://docs.rackspace.com/identity/api/ext/RAX-AUTH/v1.0"
id="123456" username="jqsmith"
enabled="true"
email="john.smith@example.org"
rax-auth:defaultRegion="DFW">
</user>Example 4.12. Add User Response: JSON
{
"user": {
"RAX-AUTH:defaultRegion": "DFW"
"id": "123456",
"username": "jqsmith",
"email": "john.smith@example.org",
"enabled": true
}
}
![[Note]](/auth-v2.0-auth-client-devguide/common/images/admon/note.png)
![[Warning]](/auth-v2.0-auth-client-devguide/common/images/admon/warning.png)
