Passer au contenu principal
POST
/
users
TypeScript
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.create({
        connection: "connection",
    });
}
main();
{
  "user_id": "auth0|507f1f77bcf86cd799439020",
  "email": "john.doe@gmail.com",
  "email_verified": false,
  "username": "johndoe",
  "phone_number": "+199999999999999",
  "phone_verified": false,
  "created_at": "<string>",
  "updated_at": "<string>",
  "identities": [
    {
      "connection": "<string>",
      "user_id": "<string>",
      "provider": "ad",
      "isSocial": true,
      "access_token": "<string>",
      "access_token_secret": "<string>",
      "refresh_token": "<string>",
      "profileData": {
        "email": "<string>",
        "email_verified": true,
        "name": "<string>",
        "username": "johndoe",
        "given_name": "<string>",
        "phone_number": "<string>",
        "phone_verified": true,
        "family_name": "<string>"
      }
    }
  ],
  "app_metadata": {},
  "user_metadata": {},
  "picture": "<string>",
  "name": "<string>",
  "nickname": "<string>",
  "multifactor": [
    "<string>"
  ],
  "last_ip": "<string>",
  "last_login": "<string>",
  "logins_count": 123,
  "blocked": true,
  "given_name": "<string>",
  "family_name": "<string>"
}

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Corps

connection
string
défaut:Initial-Connection
requis

Name of the connection this user should be created in.

Minimum string length: 1
email
string<email>
défaut:john.doe@gmail.com

The user's email.

phone_number
string
défaut:+199999999999999

The user's phone number (following the E.164 recommendation).

Pattern: ^\+[0-9]{1,15}$
user_metadata
object

Data related to the user that does not affect the application's core functionality.

blocked
boolean
défaut:false

Whether this user was blocked by an administrator (true) or not (false).

email_verified
boolean
défaut:false

Whether this email address is verified (true) or unverified (false). User will receive a verification email after creation if email_verified is false or not specified

phone_verified
boolean
défaut:false

Whether this phone number has been verified (true) or not (false).

app_metadata
object

Data related to the user that does affect the application's core functionality.

given_name
string
défaut:John

The user's given name(s).

Required string length: 1 - 150
family_name
string
défaut:Doe

The user's family name(s).

Required string length: 1 - 150
name
string
défaut:John Doe

The user's full name.

Required string length: 1 - 300
nickname
string
défaut:Johnny

The user's nickname.

Required string length: 1 - 300
picture
string<strict-uri>
défaut:https://secure.gravatar.com/avatar/15626c5e0c749cb912f9d1ad48dba440?s=480&r=pg&d=https%3A%2F%2Fssl.gstatic.com%2Fs2%2Fprofiles%2Fimages%2Fsilhouette80.png

A URI pointing to the user's picture.

user_id
string
défaut:abc

The external user's id provided by the identity provider.

Maximum string length: 255
Pattern: ^\S*$
password
string
défaut:secret

Initial password for this user. Only valid for auth0 connection strategy.

Minimum string length: 1
verify_email
boolean
défaut:false

Whether the user will receive a verification email after creation (true) or no email (false). Overrides behavior of email_verified parameter.

username
string
défaut:johndoe

The user's username. Only valid if the connection requires a username.

Required string length: 1 - 128

Réponse

User successfully created.

user_id
string
défaut:auth0|507f1f77bcf86cd799439020

ID of the user which can be used when interacting with other APIs.

email
string<email>
défaut:john.doe@gmail.com

Email address of this user.

email_verified
boolean
défaut:false

Whether this email address is verified (true) or unverified (false).

username
string
défaut:johndoe

Username of this user.

phone_number
string
défaut:+199999999999999

Phone number for this user. Follows the E.164 recommendation.

phone_verified
boolean
défaut:false

Whether this phone number has been verified (true) or not (false).

created_at

Date and time when this user was created (ISO_8601 format).

updated_at

Date and time when this user was created (ISO_8601 format).

identities
object[]

Array of user identity objects when accounts are linked.

app_metadata
object

User metadata to which this user has read-only access.

user_metadata
object

User metadata to which this user has read/write access.

picture
string

URL to picture, photo, or avatar of this user.

name
string

Name of this user.

nickname
string

Preferred nickname or alias of this user.

multifactor
string[]

List of multi-factor authentication providers with which this user has enrolled.

last_ip
string

Last IP address from which this user logged in.

last_login

Date and time when this user was created (ISO_8601 format).

logins_count
integer

Total number of logins this user has performed.

blocked
boolean

Whether this user was blocked by an administrator (true) or is not (false).

given_name
string

Given name/first name/forename of this user.

family_name
string

Family name/last name/surname of this user.