Auth0 Home Blog Docs

create user and set name via API

tier1
create-user

#1

The create new user API here: https://auth0.com/docs/api/management/v2#!/Users/post_users
doesn’t seem to support a ‘name’ field.

How do I set a user’s full name via the API?

thanks


#2

To achieve what you mention, first, consider the following information that may be helpful to you.

As for the name attribute, this would automatically be set if a user signs in using a social provider (e.g. Facebook). For normal database connection users, the name attribute is not set.

You can still set any custom attributes in the user_metadata, either from the user’s profile in the dashboard, or use management API v2.

In this case, using the management API v2 you can perform a call at this endpoint https://auth0.com/docs/api/management/v2#!/Users/post_users and use this body:

{
 "connection": "Username-Password-Authentication",
 "email": "myEmail@gmail.com", 
"password": "1234",
 "user_metadata": { 
         "name" : "Heiker" 
}, 
"email_verified": false, 
"verify_email": false, 
"app_metadata": {} 
}

The result of the execution of that call generates the following response:

Response code: 201

Response body:

{
 "email": "myemail@gmail.com", 
"user_metadata": {
 "name": "Heiker" },
 "email_verified": false,
 "user_id": "auth0|5997801134126e1816850df1",
 "picture": "https://s.gravatar.com/avatar/a316f002a5d080a613dce89a4ad8f9a9?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fmy.png",
 "identities":  { "connection": "Username-Password-Authentication", "user_id": "5997801134126e1816850df1", "provider": "auth0", "isSocial": false } ],
 "updated_at": "2017-08-19T00:02:25.730Z",
 "created_at": "2017-08-19T00:02:25.730Z" }

If you go to your dashboard, it would look like this:
![alt text][1]


#3