> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a User

> Use this endpoint to create a user access and assign it to a permission group in a single step.



## OpenAPI

````yaml /en/openapi/v3-current/AM-identity.yaml post /v1/users
openapi: 3.1.0
info:
  title: Identity Plugin
  description: ''
  version: 2.4.2
servers:
  - url: https://identity.sandbox.lerian.net
security: []
tags:
  - name: Groups API
  - name: Applications API
  - name: Users API
  - name: MFA API
  - name: Providers API
  - name: Application Providers API
paths:
  /v1/users:
    post:
      tags:
        - Users API
      summary: Create a User
      description: >-
        Use this endpoint to create a user access and assign it to a permission
        group in a single step.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserInput'
            example:
              email: john@example.com
              firstName: John
              lastName: Doe
              password: Lerian@123456
              username: johndoe
              groups:
                - admin-group
                - midaz-viewer-group
      responses:
        '201':
          description: >-
            Indicates that the resource was successfully created and the
            operation was completed as expected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
              example:
                id: 019c96a0-0c21-71f9-a487-66a1258278a1
                firstName: John
                lastName: Doe
                email: john@example.com
                username: johndoe
                groups:
                  - admin-group
                  - midaz-viewer-group
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              examples:
                Error0001:
                  $ref: '#/components/examples/Error0001'
                Error0002:
                  $ref: '#/components/examples/Error0002'
                Error0004:
                  $ref: '#/components/examples/Error0004'
                Error0007:
                  $ref: '#/components/examples/Error0007'
                Error0017:
                  $ref: '#/components/examples/Error0017'
                Error0020:
                  $ref: '#/components/examples/Error0020'
                Error0021:
                  $ref: '#/components/examples/Error0021'
                Error0022:
                  $ref: '#/components/examples/Error0022'
                Error0023:
                  $ref: '#/components/examples/Error0023'
                Error0024:
                  $ref: '#/components/examples/Error0024'
                Error0025:
                  $ref: '#/components/examples/Error0025'
                Error0026:
                  $ref: '#/components/examples/Error0026'
          headers: {}
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              examples:
                Error0006:
                  $ref: '#/components/examples/Error0006'
          headers: {}
      security:
        - bearer: []
components:
  schemas:
    UserInput:
      description: Information about the user.
      type: object
      required:
        - email
        - firstName
        - lastName
        - password
        - username
      properties:
        email:
          type: string
          description: User's email address.
        firstName:
          type: string
          description: User's first name.
        groups:
          description: >-
            Array of user role groups IDs. Role groups IDs can be retrieved
            through the List Groups endpoint.
          type: array
          items:
            type: string
        lastName:
          type: string
          description: User's last name.
        password:
          type: string
          description: User's password for authentication.
        username:
          type: string
          description: User's username.
    UserResponse:
      description: The identity details for a user, including basic info and groups.
      type: object
      properties:
        email:
          type: string
          description: User’s email address.
        firstName:
          type: string
          description: User’s first name.
        groups:
          type: array
          items:
            type: string
          description: List of groups the user belongs to.
        id:
          type: string
          description: Unique identifier of the user.
        lastName:
          type: string
          description: User’s last name.
        username:
          type: string
          description: Unique username.
    ErrorMessage:
      description: The response message error.
      type: object
      properties:
        code:
          type: string
          description: A unique, stable identifier for the error.
        title:
          type: string
          description: A brief summary of the issue.
        message:
          type: string
          description: Detailed guidance for resolving the error.
  examples:
    Error0001:
      summary: Missing Fields in Request
      value:
        code: IDE-0001
        title: Missing Fields in Request
        message: Your request is missing one or more required fields.
    Error0002:
      summary: Invalid Field Type in Request
      value:
        code: IDE-0002
        title: Invalid Field Type in Request
        message: The provided field type in the request is invalid.
    Error0004:
      summary: Unexpected Fields in the Request
      value:
        code: IDE-0004
        title: Unexpected Fields in the Request
        message: >-
          The request body contains more fields than expected. Please send only
          the allowed fields.
    Error0007:
      summary: Bad Request
      value:
        code: IDE-0007
        title: Bad Request
        message: The server could not understand the request due to malformed syntax.
    Error0017:
      summary: User Already Exists
      value:
        code: IDE-0017
        title: User Already Exists
        message: >-
          The user already exists. Please use a different username or email and
          try again.
    Error0020:
      summary: Password Too Short
      value:
        code: IDE-0020
        title: Password Too Short
        message: The password must be at least 12 characters long.
    Error0021:
      summary: Password No Uppercase
      value:
        code: IDE-0021
        title: Password No Uppercase
        message: The password must contain at least one uppercase letter.
    Error0022:
      summary: Password No Lowercase
      value:
        code: IDE-0022
        title: Password No Lowercase
        message: The password must contain at least one lowercase letter.
    Error0023:
      summary: Password No Digit
      value:
        code: IDE-0023
        title: Password No Digit
        message: The password must contain at least one digit.
    Error0024:
      summary: Password No Special Char
      value:
        code: IDE-0024
        title: Password No Special Char
        message: The password must contain at least one special character.
    Error0025:
      summary: Password Consecutive Repeated
      value:
        code: IDE-0025
        title: Password Consecutive Repeated
        message: The password must not contain consecutive repeated characters.
    Error0026:
      summary: Password Unknown Rule
      value:
        code: IDE-0026
        title: Password Unknown Rule
        message: Unknown password validation rule.
    Error0006:
      summary: Internal Server Error
      value:
        code: IDE-0006
        title: Internal Server Error
        message: The server encountered an unexpected error. Please try again later.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: The authorization token in the 'Bearer <token>' format.

````