Create user

POST /api/users

Create a new user with the given data.

application/json

Body Required

  • primaryPhone string(regex)

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

    Format should match the following pattern: /^\d+$/.

  • primaryEmail string(regex)

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

    Format should match the following pattern: /^\S+@\S+\.\S+$/.

  • username string(regex)

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

    Format should match the following pattern: /^[A-Z_a-z]\w*$/.

  • password string

    Minimum length is 1.

  • name string

Responses

POST /api/users
curl \
 -X POST https://[tenant_id].logto.app/api/users \
 -H "Content-Type: application/json" \
 -d '{"primaryPhone":"string","primaryEmail":"string","username":"string","password":"string","name":"string"}'
Request example
{
  "primaryPhone": "string",
  "primaryEmail": "string",
  "username": "string",
  "password": "string",
  "name": "string"
}
Response examples (200)
{
  "id": "string",
  "username": "string",
  "primaryEmail": "string",
  "primaryPhone": "string",
  "name": "string",
  "avatar": "string",
  "customData": {},
  "identities": {},
  "lastSignInAt": 42.0,
  "createdAt": 42.0,
  "applicationId": "string",
  "isSuspended": true,
  "hasPassword": true,
  "ssoIdentities": [
    {
      "id": "string",
      "userId": "string",
      "issuer": "string",
      "identityId": "string",
      "detail": {},
      "createdAt": 42.0,
      "ssoConnectorId": "string"
    }
  ]
}