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

# Org Add User

> Endpoint for an organization admin to add a new user to their organization.

Args:
    user_data (UserCreate): The new user information including email, name, role, and org_name.

Returns:
    dict: A success message confirming the user was added to the organization.

Raises:
    HTTPException 404:
        - If the organization database is not found.
        - If the `org_name` in user data doesn't match the admin's org.
        - If organization details are not initialized.
    HTTPException 409:
        - If the user already exists globally.
        - If the user is already a member of the organization.
    HTTPException 500:
        - If any unexpected error occurs during the user addition process.



## OpenAPI

````yaml post /api/org/add_user/
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/org/add_user/:
    post:
      tags:
        - Org
      summary: Org Add User
      description: >-
        Endpoint for an organization admin to add a new user to their
        organization.


        Args:
            user_data (UserCreate): The new user information including email, name, role, and org_name.

        Returns:
            dict: A success message confirming the user was added to the organization.

        Raises:
            HTTPException 404:
                - If the organization database is not found.
                - If the `org_name` in user data doesn't match the admin's org.
                - If organization details are not initialized.
            HTTPException 409:
                - If the user already exists globally.
                - If the user is already a member of the organization.
            HTTPException 500:
                - If any unexpected error occurs during the user addition process.
      operationId: org_add_user
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    UserCreate:
      properties:
        org_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Name
        email:
          type: string
          format: email
          title: Email
        password:
          type: string
          title: Password
        role:
          $ref: '#/components/schemas/UserRole'
          default: User
      type: object
      required:
        - email
        - password
      title: UserCreate
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UserRole:
      type: string
      enum:
        - APIGene
        - Owner
        - Admin
        - User
      title: UserRole
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````