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

# Create user

> Create a user in the application.



## OpenAPI

````yaml post /v2/session/apps/{appID}/users
openapi: 3.1.1
info:
  title: Prelude Session Management API
  version: 0.0.1
  summary: The Prelude API for Session Management
  description: The Prelude API for Session Management.
  contact:
    email: support@prelude.so
    url: https://prelude.so
servers:
  - url: https://api.prelude.dev
    description: Production server
security:
  - Authorization: []
tags:
  - name: Mode
    description: Manage the mode (dev/prod) of your application.
  - name: Users
    description: Manage the users of your application.
  - name: Webhooks
    description: Manage the webhooks of your application.
  - name: Domains
    description: Manage the domains of your application.
  - name: Config - Scopes
    description: Manage the scope configuration of your application.
  - name: Config - Claims
    description: Manage the claims mapping configuration of your application.
  - name: Config - Step-up
    description: Manage the step-up authentication configuration of your application.
  - name: Config - Migration
    description: Manage the user migration configuration of your application.
  - name: Config - Login OTP
    description: Manage the OTP login configuration of your application.
  - name: Config - Login OAuth
    description: Manage the OAuth login configuration of your application.
  - name: Config - Login Password
    description: Manage the password login configuration of your application.
paths:
  /v2/session/apps/{appID}/users:
    parameters:
      - $ref: '#/components/parameters/appIDParam'
    post:
      tags:
        - Users
      summary: Create user
      description: Create a user in the application.
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostUserRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostUserResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/InvalidRequestError'
                  - $ref: '#/components/schemas/InvalidIdError'
                  - $ref: '#/components/schemas/TooManyUserIdentifiersError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionDisabledError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppNotFoundError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/AlreadyInUseError'
                  - $ref: '#/components/schemas/ExternalIDAlreadyInUseError'
                  - $ref: '#/components/schemas/ConflictError'
components:
  parameters:
    appIDParam:
      in: path
      name: appID
      required: true
      description: The id of the app the request refers to.
      schema:
        $ref: '#/components/schemas/AppID'
  schemas:
    PostUserRequest:
      type: object
      properties:
        identifiers:
          type: array
          items:
            $ref: '#/components/schemas/IdentifierResponse'
        profile:
          type: object
          additionalProperties:
            type: string
          examples:
            - first_name: John
              last_name: Doe
        id:
          type: string
          format: uuid
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
        external_id:
          type: string
          description: ID of the user in your system. Must be at most 128 characters.
          maxLength: 128
          examples:
            - customer-user-42
      required:
        - identifiers
    PostUserResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/UserID'
      required:
        - id
    InvalidRequestError:
      type: object
      properties:
        code:
          type: string
          enum:
            - invalid_request
          examples:
            - invalid_request
        status:
          type: string
          enum:
            - bad_request
          examples:
            - bad_request
        message:
          type: string
          examples:
            - The request body is invalid.
      required:
        - code
        - status
        - message
    InvalidIdError:
      type: object
      properties:
        code:
          type: string
          enum:
            - invalid_id
          examples:
            - invalid_id
        status:
          type: string
          enum:
            - bad_request
          examples:
            - bad_request
        message:
          type: string
          examples:
            - The provided ID is invalid.
      required:
        - code
        - status
        - message
    TooManyUserIdentifiersError:
      type: object
      properties:
        code:
          type: string
          enum:
            - too_many_user_identifiers
          examples:
            - too_many_user_identifiers
        status:
          type: string
          enum:
            - bad_request
          examples:
            - bad_request
        message:
          type: string
          examples:
            - The user has too many identifiers.
      required:
        - code
        - status
        - message
    SessionDisabledError:
      type: object
      properties:
        code:
          type: string
          enum:
            - session_disabled
          examples:
            - session_disabled
        status:
          type: string
          enum:
            - forbidden
          examples:
            - forbidden
        message:
          type: string
          examples:
            - Session management is disabled for this application.
      required:
        - code
        - status
        - message
    AppNotFoundError:
      type: object
      properties:
        code:
          type: string
          enum:
            - app_not_found
          examples:
            - app_not_found
        status:
          type: string
          enum:
            - not_found
          examples:
            - not_found
        message:
          type: string
          examples:
            - The application was not found.
      required:
        - code
        - status
        - message
    AlreadyInUseError:
      type: object
      properties:
        code:
          type: string
          enum:
            - already_in_use
          examples:
            - already_in_use
        status:
          type: string
          enum:
            - conflict
          examples:
            - conflict
        message:
          type: string
          examples:
            - The identifier is already in use by another user.
      required:
        - code
        - status
        - message
    ExternalIDAlreadyInUseError:
      type: object
      properties:
        code:
          type: string
          enum:
            - external_id_already_in_use
          examples:
            - external_id_already_in_use
        status:
          type: string
          enum:
            - conflict
          examples:
            - conflict
        message:
          type: string
          examples:
            - The provided external id is already in use
      required:
        - code
        - status
        - message
    ConflictError:
      type: object
      properties:
        code:
          type: string
          enum:
            - conflict
          examples:
            - conflict
        status:
          type: string
          enum:
            - conflict
          examples:
            - conflict
        message:
          type: string
          examples:
            - A conflict occurred with the current state of the resource.
      required:
        - code
        - status
        - message
    AppID:
      type: string
      description: An application's unique identifier.
      examples:
        - 54e9ujn
        - fvua38g
    IdentifierResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - phone_number
            - email_address
          examples:
            - phone_number
        value:
          type: string
          examples:
            - '+306912345678'
            - test@example.com
      required:
        - type
        - value
    UserID:
      type: string
      description: An app's user's unique identifier. It is prefixed with 'usr_'
      examples:
        - usr_01jqebhswje1ka1z7ahr9rfsgt
        - usr_01jqy7455pf8p9bap5qke912g1
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````