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

# Create

> Create organization invitation to given email addresses.

A caller may pass an array of data to create invitations in bulk. See examples.

When creating a COLLABORATOR role (`role` = 1), a `accessible_portfolio_ids` parameter is required to assign
the collaborator specific portfolio access. If this is not sent, the invitation will fail. If this is sent when
creating an ADMIN or MEMBER invitation, it will be ignored because they have access to all portfolios of an organization.
See examples.

Will return 201 on complete (all invites) success, or 202 when the request completed but there were
errors with at least one invite.



## OpenAPI

````yaml api-reference/openapi.yaml post /api/v1/organization-invitations/
openapi: 3.0.3
info:
  title: API v1 Public
  version: 1.4.2
  description: >+


    Apex API functions and available endpoints.


    To authenticate, use the `Token` value from the `auth/login` endpoint in the
    Authorize dialog.

  license:
    name: Proprietary to Emotive Technologies Inc.
servers:
  - url: https://api.main.apexscore.ai
security: []
paths:
  /api/v1/organization-invitations/:
    post:
      tags:
        - Organization Invitations
      summary: Create
      description: >-
        Create organization invitation to given email addresses.


        A caller may pass an array of data to create invitations in bulk. See
        examples.


        When creating a COLLABORATOR role (`role` = 1), a
        `accessible_portfolio_ids` parameter is required to assign

        the collaborator specific portfolio access. If this is not sent, the
        invitation will fail. If this is sent when

        creating an ADMIN or MEMBER invitation, it will be ignored because they
        have access to all portfolios of an organization.

        See examples.


        Will return 201 on complete (all invites) success, or 202 when the
        request completed but there were

        errors with at least one invite.
      operationId: organization_invitations_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationInvitation'
            examples:
              SingleInvitation:
                value:
                  organization_id: e8e912b6-ba9b-4c3a-bb4f-d04bdc370843
                  email: user@example.com
                  first_name: Member
                  last_name: Person
                  role: 0
                summary: Single Invitation
              MultipleInvitations:
                value:
                  - organization_id: e8e912b6-ba9b-4c3a-bb4f-d04bdc370843
                    email: user1@example.com
                    first_name: Member
                    last_name: Person
                    role: 0
                  - organization_id: e8e912b6-ba9b-4c3a-bb4f-d04bdc370843
                    email: user2@example.com
                    first_name: Admin
                    last_name: Person
                    role: 2
                summary: Multiple Invitations
              CollaboratorInvitationFormat:
                value:
                  organization_id: e8e912b6-ba9b-4c3a-bb4f-d04bdc370843
                  email: user1@example.com
                  first_name: Member
                  last_name: Person
                  role: 1
                  accessible_portfolio_ids:
                    - 4358c068-f6ef-4107-8ff1-0efd9326c0d4
                summary: Collaborator Invitation Format
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InlineOrganizationInvitationCreate200'
          description: ''
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InlineOrganizationInvitationCreate202'
          description: ''
      security:
        - tokenAuth: []
components:
  schemas:
    OrganizationInvitation:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        token:
          type: string
          format: uuid
          readOnly: true
          description: Token is used to validate the invitation.
        expiry_date:
          type: string
          format: date-time
          readOnly: true
          description: Date is calculated in save().
        status:
          allOf:
            - $ref: '#/components/schemas/OrganizationInvitationStatusEnum'
          description: |-
            Status of the invitation, default status is pending.

            * `0` - pending
            * `1` - accepted
            * `2` - cancelled
            * `3` - expired
            * `4` - revoked
          minimum: -2147483648
          maximum: 2147483647
        organization:
          allOf:
            - $ref: '#/components/schemas/Organization'
          readOnly: true
        organization_id:
          type: string
          format: uuid
          writeOnly: true
        inviter_member:
          allOf:
            - $ref: '#/components/schemas/OrganizationMember'
          readOnly: true
        email:
          type: string
          format: email
          title: Email address
          description: Invitee's email address.
          maxLength: 255
        first_name:
          type: string
          nullable: true
          description: Invitee's first name.
          maxLength: 25
        last_name:
          type: string
          nullable: true
          description: Invitee's last name.
          maxLength: 25
        email_sent:
          type: boolean
          readOnly: true
        role:
          allOf:
            - $ref: '#/components/schemas/RoleEnum'
          description: |-
            Invitee's role, default role is member.

            * `0` - member
            * `1` - collaborator
            * `2` - administrator
          minimum: -2147483648
          maximum: 2147483647
        accessible_portfolios:
          type: array
          items:
            $ref: '#/components/schemas/Portfolio'
          readOnly: true
        accessible_portfolio_ids:
          type: array
          items:
            type: string
            format: uuid
          writeOnly: true
      required:
        - accessible_portfolios
        - email
        - email_sent
        - expiry_date
        - id
        - inviter_member
        - organization
        - organization_id
        - token
    InlineOrganizationInvitationCreate200:
      type: object
      properties:
        sent:
          type: array
          items:
            $ref: '#/components/schemas/OrganizationInvitation'
        failed:
          type: array
          items: {}
          default: []
      required:
        - sent
    InlineOrganizationInvitationCreate202:
      type: object
      properties:
        sent:
          type: array
          items:
            $ref: '#/components/schemas/OrganizationInvitation'
        failed:
          type: array
          items:
            $ref: '#/components/schemas/InlineOrganizationInvitationCreateFails'
      required:
        - failed
        - sent
    OrganizationInvitationStatusEnum:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
      type: integer
      description: |-
        * `0` - pending
        * `1` - accepted
        * `2` - cancelled
        * `3` - expired
        * `4` - revoked
    Organization:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          nullable: true
          maxLength: 100
      required:
        - id
    OrganizationMember:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        first_name:
          type: string
          readOnly: true
        last_name:
          type: string
          readOnly: true
        email:
          type: string
          format: email
          readOnly: true
      required:
        - email
        - first_name
        - id
        - last_name
    RoleEnum:
      enum:
        - 0
        - 1
        - 2
      type: integer
      description: |-
        * `0` - member
        * `1` - collaborator
        * `2` - administrator
    Portfolio:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
      required:
        - id
    InlineOrganizationInvitationCreateFails:
      type: object
      properties:
        email:
          type: string
          format: email
        reason:
          type: string
      required:
        - email
        - reason
  securitySchemes:
    tokenAuth:
      type: http
      scheme: bearer

````