> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create/Add user

> Creates a new user and sends an invitation email if the user does not exist. Adds the new or existing user to the current account. If the user already exists and is already a member of the account, an error is returned 
 - If the user already exists but isn't a member of the account, they are added without creating a new user record 
 - The user won't be able to access the account until they complete the activation process by setting their password 
 - For security, new users must set their own password via the activation link 
 - The function schedules cleanup tasks to remove unactivated user accounts after a certain period of time (48 hours)



## OpenAPI

````yaml /api-reference/endpoint/accounts/openapi.json post /accounts/users
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: >-
    API for managing accounts, users, authentication, and payments in the
    quiva.ai platform
  version: 1.0.0
  contact:
    name: quiva.ai Support
    url: https://app.quiva.ai
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Account Management
    description: Operations related to account creation, updating, and deletion
  - name: User Management
    description: Operations related to user creation, updating, and deletion
  - name: Authentication
    description: Operations related to authentication and session management
  - name: API Keys
    description: Operations related to API key management
  - name: Multi-Factor Authentication
    description: Operations related to MFA setup and verification
  - name: Payment
    description: Operations related to subscription and payment management
  - name: Mesh Nodes
    description: Operations related to mesh node management
paths:
  /accounts/users:
    post:
      tags:
        - User Management
      summary: Create/Add user
      description: >-
        Creates a new user and sends an invitation email if the user does not
        exist. Adds the new or existing user to the current account. If the user
        already exists and is already a member of the account, an error is
        returned 
         - If the user already exists but isn't a member of the account, they are added without creating a new user record 
         - The user won't be able to access the account until they complete the activation process by setting their password 
         - For security, new users must set their own password via the activation link 
         - The function schedules cleanup tasks to remove unactivated user accounts after a certain period of time (48 hours)
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
            example:
              first_name: Jane
              last_name: Smith
              email: jane.smith@example.com
              role: developer
      responses:
        '200':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateUserRequest:
      type: object
      properties:
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        email:
          type: string
          format: email
          description: Email address
        role:
          type: string
          enum:
            - admin
            - developer
            - monitor
            - billing
          description: Role
      required:
        - first_name
        - last_name
        - email
        - role
    SuccessResponse:
      type: object
      properties:
        message:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````