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

# Invite Users

> Invite users to the tenant. This checks if the user is already in the tenant and if not, creates the user. We will return a list of user emails that were successfully created (including existing users).



## OpenAPI

````yaml api-reference/openapi.json post /users
openapi: 3.1.0
info:
  title: Endpoints
  version: '1.0'
servers:
  - url: https://api.contextual.ai/v1
security:
  - BearerAuth: []
paths:
  /users:
    post:
      tags:
        - /users
      summary: Invite Users
      description: >-
        Invite users to the tenant. This checks if the user is already in the
        tenant and if not, creates the user. We will return a list of user
        emails that were successfully created (including existing users).
      operationId: invite_users_users_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InviteUsersRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InviteUsersResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    InviteUsersRequest:
      properties:
        tenant_short_name:
          type: string
          title: Tenant Short Name
          description: The short name of the tenant
        new_users:
          items:
            $ref: '#/components/schemas/TenantNewUserInfo'
          type: array
          title: New Users
          description: List of new users to be invited
      type: object
      required:
        - tenant_short_name
        - new_users
      title: InviteUsersRequest
    InviteUsersResponse:
      properties:
        invited_user_emails:
          items:
            type: string
          type: array
          title: Invited User Emails
          description: List of emails of the invited users
        error_details:
          additionalProperties:
            type: string
          type: object
          title: Error Details
          description: >-
            Details of the errors occurred while inviting users, where keys are
            the emails and values are the error messages
      type: object
      required:
        - invited_user_emails
        - error_details
      title: InviteUsersResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TenantNewUserInfo:
      properties:
        email:
          type: string
          title: Email
          description: The email of the user
        is_tenant_admin:
          type: boolean
          title: Is Tenant Admin
          description: Flag indicating if the user is a tenant admin
          default: false
        roles:
          items:
            $ref: '#/components/schemas/UserRolesEnum'
          type: array
          title: Roles
          description: The user level roles of the user.
      type: object
      required:
        - email
      title: TenantNewUserInfo
      description: The schema used for creating new users or updating existing users.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    UserRolesEnum:
      type: string
      enum:
        - VISITOR
        - AGENT_USER
        - CUSTOMER_USER
        - CUSTOMER_INTERNAL_USER
        - CONTEXTUAL_STAFF_USER
        - CONTEXTUAL_EXTERNAL_STAFF_USER
        - CONTEXTUAL_INTERNAL_STAFF_USER
        - TENANT_ADMIN
        - CUSTOMER_ADMIN
        - CONTEXTUAL_ADMIN
        - SUPER_ADMIN
        - SERVICE_ACCOUNT
      title: UserRolesEnum
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````