Body
Required
-
Primary phone number for the user. It should be unique across all users.
Format should match the following pattern:
/^\d+$/. -
Primary email address for the user. It should be unique across all users.
Format should match the following pattern:
/^\S+@\S+\.\S+$/. -
Username for the user. It should be unique across all users.
Format should match the following pattern:
/^[A-Z_a-z]\w*$/. -
Plain text password for the user.
Minimum length is
1. -
In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. The algorithm can be specified using the
passwordAlgorithmproperty. ForLegacy, pass a JSON string in the format[algorithm, args, encryptedPassword], whereargsis a string array that MUST contain an@placeholder, which will be replaced by the plain text password at runtime. For PBKDF2 underLegacy,argsis expected to be in the order[salt, iterations, keylen, digest, '@']. The salt supports a plain string or ahex:-prefixed hex string (for binary salt bytes).Maximum length is
256. -
The hash algorithm used for the password. It should be one of the supported algorithms, including
Legacyfor custom legacy expressions. Should the encryption algorithm differ fromArgon2i, it will automatically be upgraded toArgon2iupon the user's next sign-in.Values are
Argon2i,Argon2id,Argon2d,SHA1,SHA256,MD5,Bcrypt, orLegacy. -
arbitrary
curl \
--request POST 'https://[tenant_id].logto.app/api/users' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"primaryPhone":"string","primaryEmail":"string","username":"string","password":"string","passwordDigest":"string","passwordAlgorithm":"Argon2i","name":"string","avatar":"string","customData":{},"profile":{"familyName":"string","givenName":"string","middleName":"string","nickname":"string","preferredUsername":"string","profile":"string","website":"string","gender":"string","birthdate":"string","zoneinfo":"string","locale":"string","address":{"formatted":"string","streetAddress":"string","locality":"string","region":"string","postalCode":"string","country":"string"}}}'
{
"primaryPhone": "string",
"primaryEmail": "string",
"username": "string",
"password": "string",
"passwordDigest": "string",
"passwordAlgorithm": "Argon2i",
"name": "string",
"avatar": "string",
"customData": {},
"profile": {
"familyName": "string",
"givenName": "string",
"middleName": "string",
"nickname": "string",
"preferredUsername": "string",
"profile": "string",
"website": "string",
"gender": "string",
"birthdate": "string",
"zoneinfo": "string",
"locale": "string",
"address": {
"formatted": "string",
"streetAddress": "string",
"locality": "string",
"region": "string",
"postalCode": "string",
"country": "string"
}
}
}
{
"id": "string",
"username": "string",
"primaryEmail": "string",
"primaryPhone": "string",
"name": "string",
"avatar": "string",
"customData": {},
"identities": {
"additionalProperty1": {
"userId": "string",
"details": {}
},
"additionalProperty2": {
"userId": "string",
"details": {}
}
},
"lastSignInAt": 42.0,
"createdAt": 42.0,
"updatedAt": 42.0,
"profile": {
"familyName": "string",
"givenName": "string",
"middleName": "string",
"nickname": "string",
"preferredUsername": "string",
"profile": "string",
"website": "string",
"gender": "string",
"birthdate": "string",
"zoneinfo": "string",
"locale": "string",
"address": {
"formatted": "string",
"streetAddress": "string",
"locality": "string",
"region": "string",
"postalCode": "string",
"country": "string"
}
},
"applicationId": "string",
"isSuspended": true,
"hasPassword": true,
"ssoIdentities": [
{
"tenantId": "string",
"id": "string",
"userId": "string",
"issuer": "string",
"identityId": "string",
"detail": {},
"createdAt": 42.0,
"updatedAt": 42.0,
"ssoConnectorId": "string"
}
],
"passwordDigest": "string",
"passwordAlgorithm": "Argon2i"
}