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

# Create a User

> Create a new user



## OpenAPI

````yaml /api/openapi.yaml post /v1/users
openapi: 3.0.3
info:
  title: Documentation Service API
  description: API documentation for Documentation Service
  version: 1.0.0
servers:
  - url: https://api.us.lexful.app
    description: US pod
security:
  - bearerAuth: []
    accountId: []
paths:
  /v1/users:
    post:
      tags:
        - Users
      summary: Create a User
      description: Create a new user
      requestBody:
        $ref: '#/components/requestBodies/post_v1_users_request'
      responses:
        '201':
          $ref: '#/components/responses/CreateUserResponse'
        '400':
          $ref: '#/components/responses/BadRequestResponse'
        '403':
          $ref: '#/components/responses/ForbiddenResponse'
        '500':
          $ref: '#/components/responses/InternalServerErrorResponse'
components:
  requestBodies:
    post_v1_users_request:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/post_v1_users_request_application_json'
  responses:
    CreateUserResponse:
      description: Default Response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateUserResponse_application_json'
    BadRequestResponse:
      description: Bad request - validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ForbiddenResponse:
      description: Forbidden - insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerErrorResponse:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    post_v1_users_request_application_json:
      type: object
      properties:
        email:
          type: string
          format: email
          maxLength: 255
          description: User email address
        first_name:
          type: string
          minLength: 1
          maxLength: 100
          description: User first name
        last_name:
          type: string
          minLength: 1
          maxLength: 100
          description: User last name
        role:
          type: string
          enum:
            - system_admin
            - system_support
            - admin
            - support
            - viewer
            - organization_viewer
          description: User role
        account_scopes:
          type: array
          items:
            oneOf:
              - type: string
                format: uuid
              - type: string
                enum:
                  - '*'
            description: UUID or wildcard "*"
          description: >-
            Array of account IDs the user has access to (or "*" for wildcard
            access)
        organization_scopes:
          type: array
          items:
            oneOf:
              - type: string
                format: uuid
              - type: string
                enum:
                  - '*'
            description: UUID or wildcard "*"
          description: >-
            Array of organization IDs the user has access to (or "*" for
            wildcard access)
      required:
        - email
        - role
        - organization_scopes
    CreateUserResponse_application_json:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: User unique identifier
        account_id:
          type: string
          format: uuid
          description: Account ID this user belongs to
        email:
          type: string
          format: email
          description: User email address
        first_name:
          type: string
          nullable: true
          description: User first name
        last_name:
          type: string
          nullable: true
          description: User last name
        role:
          type: string
          enum:
            - system_admin
            - system_support
            - admin
            - support
            - viewer
            - organization_viewer
          description: User role
        external_ids:
          type: object
          additionalProperties:
            type: string
          description: External system ID mappings
        account_scopes:
          type: array
          items:
            oneOf:
              - type: string
                format: uuid
              - type: string
                enum:
                  - '*'
            description: UUID or wildcard "*"
          description: >-
            Array of account IDs the user has access to (or "*" for wildcard
            access)
        organization_scopes:
          type: array
          items:
            oneOf:
              - type: string
                format: uuid
              - type: string
                enum:
                  - '*'
            description: UUID or wildcard "*"
          description: >-
            Array of organization IDs the user has access to (or "*" for
            wildcard access)
        created_at:
          type: string
          format: date-time
          description: User creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
        created_by:
          type: string
          description: User ID who created this user
        updated_by:
          type: string
          description: User ID who last updated this user
        deleted_at:
          type: string
          nullable: true
          format: date-time
          description: Deletion timestamp
      required:
        - id
        - account_id
        - email
        - role
        - account_scopes
        - organization_scopes
    ErrorResponse:
      description: Bad request - validation error
      type: object
      properties:
        status:
          type: number
          description: HTTP status code
        message:
          type: string
          description: Error message
        error_id:
          type: string
          description: Unique error identifier
        error_code:
          type: string
          description: Error code
        developer_message:
          type: string
          description: Additional details for developers
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token
    accountId:
      type: apiKey
      in: header
      name: X-Account-ID
      description: Account ID

````