---
title: "Create user"
method: POST
path: "/api/users"
tags: ["Users"]
---

# Create user

`POST /api/users`

Create a new user with the given data.

## Request body

- object — User data to create a new user. All properties are optional.
  - `primaryPhone` string, regex — Primary phone number for the user. It should be unique across all users.
  - `primaryEmail` string, regex — Primary email address for the user. It should be unique across all users.
  - `username` string, regex — Username for the user. It should be unique across all users.
  - `password` string — Plain text password for the user.
  - `passwordDigest` string — 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).
  - `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.
  - `name` string
  - `avatar` union
    - string, url
    - string, empty
  - `customData` object — arbitrary
  - `profile` object
    - `familyName` string
    - `givenName` string
    - `middleName` string
    - `nickname` string
    - `preferredUsername` string
    - `profile` string
    - `website` string
    - `gender` string
    - `birthdate` string
    - `zoneinfo` string
    - `locale` string
    - `address` object
      - `formatted` string
      - `streetAddress` string
      - `locality` string
      - `region` string
      - `postalCode` string
      - `country` string

## Response `200`

User data for the newly created user.

- object
  - `id` string, required
  - `username` string, nullable, required
  - `primaryEmail` string, nullable, required
  - `primaryPhone` string, nullable, required
  - `name` string, nullable, required
  - `avatar` string, nullable, required
  - `customData` object, required — arbitrary
  - `identities` object, required
  - `lastSignInAt` number, nullable, required
  - `createdAt` number, required
  - `updatedAt` number, required
  - `profile` object, required
    - `familyName` string
    - `givenName` string
    - `middleName` string
    - `nickname` string
    - `preferredUsername` string
    - `profile` string
    - `website` string
    - `gender` string
    - `birthdate` string
    - `zoneinfo` string
    - `locale` string
    - `address` object
      - `formatted` string
      - `streetAddress` string
      - `locality` string
      - `region` string
      - `postalCode` string
      - `country` string
  - `applicationId` string, nullable, required
  - `isSuspended` boolean, required
  - `hasPassword` boolean
  - `hasSecurityVerificationMethod` boolean
  - `ssoIdentities` object[]
    - `tenantId` string, required
    - `id` string, required
    - `userId` string, required
    - `issuer` string, required
    - `identityId` string, required
    - `detail` object, required — arbitrary
    - `createdAt` number, required
    - `updatedAt` number, required
    - `ssoConnectorId` string, required
  - `passwordDigest` string, nullable
  - `passwordAlgorithm` 'Argon2i' | 'Argon2id' | 'Argon2d' | 'SHA1' | 'SHA256' | 'MD5' | 'Bcrypt' | 'Legacy', nullable

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Content

---

[API](https://skmtc.net/logto/apis/logto-api-references.md) · [All operations](https://skmtc.net/logto/apis/logto-api-references/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/logto/logto-api-references/versions/a163dc77d842/schema)
