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

# Create User



## OpenAPI

````yaml POST /api/v1/mgt/workspaces/{workspaceId}/users
openapi: 3.1.0
info:
  title: Xenia Team API - Create User
  description: >-
    Create or invite users to a workspace. Handles duplicates, soft-deleted user
    restoration, and supports onboarding flow.
  version: 1.0.0
servers:
  - url: https://api.xenia.team
security: []
paths:
  /api/v1/mgt/workspaces/{workspaceId}/users:
    post:
      tags:
        - Users
      summary: Create or Invite Users
      description: >-
        Registers new users or reactivates soft-deleted users by email/phone for
        the specified workspace.
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: ID of the workspace
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUsersRequest'
            example:
              invite: false
              isOnboardingFlow: false
              rows:
                - data:
                    firstName: John
                    lastName: Doe
                    emailId: john.doe@example.com
                    roleId: 9f1e53b3-a417-4345-882f-2c9b44da040b
                    password: securePassword123
                    workspaceId: cb363f7e-c52a-4478-911d-f6a6f791090e
                    locations:
                      - b9164b03-60c2-4500-89a4-f490e38c9872
              inviteBy: email
      responses:
        '200':
          description: Users created or invited successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                  extra_meta:
                    type: object
                    properties:
                      message:
                        type: string
              example:
                data: {}
                extra_meta:
                  message: Users created successfully
        '400':
          description: Bad Request - Validation failure or invalid input
        '401':
          description: Unauthorized - Missing or invalid authentication
        '403':
          description: Forbidden - Insufficient permissions
        '404':
          description: Not Found - Workspace does not exist
        '409':
          description: Conflict - User with this email/phone already exists
        '500':
          description: Internal Server Error
      security:
        - clientKey: []
          clientSecret: []
components:
  schemas:
    CreateUsersRequest:
      type: object
      properties:
        invite:
          type: boolean
          description: Flag to trigger invite email/SMS
        isOnboardingFlow:
          type: boolean
          description: Used during onboarding flow
        rows:
          type: array
          items:
            type: object
            properties:
              data:
                type: object
                properties:
                  firstName:
                    type: string
                  lastName:
                    type: string
                  fullName:
                    type: string
                  emailId:
                    type: string
                    format: email
                  phoneNo:
                    type: string
                  roleId:
                    type: string
                    format: uuid
                  password:
                    type: string
                  workspaceId:
                    type: string
                    format: uuid
                  locations:
                    type: array
                    items:
                      type: string
                      format: uuid
                required:
                  - firstName
                  - lastName
                  - roleId
                  - workspaceId
            required:
              - data
        inviteBy:
          type: string
          enum:
            - email
            - sms
          description: How the invite should be sent
      required:
        - rows
        - inviteBy
  securitySchemes:
    clientKey:
      type: apiKey
      in: header
      name: x-client-key
      description: Client API key for authentication
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: Client secret for authentication

````