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

# Add a user to the organization by email as Admin

> Add a user to the organization by email with Admin role.

Invites the email if it is not registered yet; otherwise links the
existing account. ``invite_sent`` in the response tells the caller
whether an invitation email was actually dispatched.



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /organizations/{organization_id}/users/by-email
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /organizations/{organization_id}/users/by-email:
    post:
      tags:
        - Organizations
      summary: Add a user to the organization by email as Admin
      description: |-
        Add a user to the organization by email with Admin role.

        Invites the email if it is not registered yet; otherwise links the
        existing account. ``invite_sent`` in the response tells the caller
        whether an invitation email was actually dispatched.
      operationId: >-
        add_user_to_organization_by_email_organizations__organization_id__users_by_email_post
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            title: Organization Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddUserByEmailRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddUserByEmailResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AddUserByEmailRequest:
      properties:
        email:
          type: string
          title: Email
      type: object
      required:
        - email
      title: AddUserByEmailRequest
      description: Request model to add an existing user to an organization by email.
    AddUserByEmailResult:
      properties:
        user_id:
          type: string
          title: User Id
          description: ID of the (invited or pre-existing) user that was added.
        invite_sent:
          type: boolean
          title: Invite Sent
          description: >-
            True when the email was not registered yet and an invitation email
            was dispatched. False when the email already belonged to a
            registered user, in which case the existing account was linked and
            no email was sent.
      type: object
      required:
        - user_id
        - invite_sent
      title: AddUserByEmailResult
      description: |-
        Result of adding a user to an organization by email.

        Returned by the service and used verbatim as the route's response model.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````