Users

Create a new user with the given data.

post/api/users

Request

  • Base URL: https://[tenant_id].logto.app
  • URL: https://[tenant_id].logto.app/api/users
  • Auth: OAuth 2 (client credentials, token URL /oidc/token, scopes: all)

Request body

idstring regex

The unique ID for the user, up to 128 characters of letters, numbers, and _ - . @ : + = |, excluding . and ... If not provided, a random ID will be generated. Useful for keeping existing user IDs when migrating from another identity provider.

primaryPhonestring regex

Primary phone number for the user. It should be unique across all users.

primaryEmailstring regex

Primary email address for the user. It should be unique across all users.

usernamestring regex

Username for the user. It should be unique across all users.

passwordstring

Plain text password for the user.

passwordDigeststring

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 passwordAlgorithm property. For Legacy, pass a JSON string in the format [algorithm, args, encryptedPassword], where args is a string array that MUST contain an @ placeholder, which will be replaced by the plain text password at runtime. For PBKDF2 under Legacy, args is expected to be in the order [salt, iterations, keylen, digest, '@']. The salt supports a plain string or a hex:-prefixed hex string (for binary salt bytes). For SHA-crypt under Legacy, use sha256-crypt or sha512-crypt and pass the complete stored crypt string as encryptedPassword, e.g. ["sha512-crypt", ["@"], "$6$rounds=656000$salt$checksum"]. The rounds value, when present, must be between 1,000 and 1,000,000; omitting it uses 5,000.

passwordAlgorithm'Argon2i' | 'Argon2id' | 'Argon2d' | 'SHA1' | 'SHA256' | 'MD5' | 'Bcrypt' | 'Legacy'

The hash algorithm used for the password. It should be one of the supported algorithms, including Legacy for custom legacy expressions. Should the encryption algorithm differ from Argon2i, it will automatically be upgraded to Argon2i upon the user's next sign-in.

namestring
customDataobject

arbitrary

Response

User data for the newly created user.

idstring required
usernamestring nullable required
primaryEmailstring nullable required
primaryPhonestring nullable required
namestring nullable required
avatarstring nullable required
customDataobject required

arbitrary

identitiesobject required
lastSignInAtnumber nullable required
createdAtnumber required
updatedAtnumber required
applicationIdstring nullable required
cimdClientIdstring nullable required

The identifier of the CIMD (client ID metadata document) client from the user's first consent. null unless the user's first consent was granted to a CIMD client. Mutually exclusive with applicationId.

isSuspendedboolean required
hasPasswordboolean
hasSecurityVerificationMethodboolean
passwordDigeststring nullable
passwordAlgorithm'Argon2i' | 'Argon2id' | 'Argon2d' | 'SHA1' | 'SHA256' | 'MD5' | 'Bcrypt' | 'Legacy' nullable

Changes

    • breaking

      the response property's maxLength was increased from 12 to 128 for the response status

    • breaking

      the // response property's maxLength was increased from 12 to 128 for the response status

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • info

      added the required property to the response with the status