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

# Create Invitation

> Create organization invitations for multiple email addresses.

Sends emails to invitees with secure links to join the organization.
Supports batch invitations - some may succeed while others fail.

Permission rules:
- Only owners and admins can create invitations
- Admins can only invite with 'member' or 'admin' role (not 'owner')
- Owners can invite with any role

Args:
    org_id: Organization UUID
    invitation_data: Invitation details (emails array, role)
    request: FastAPI request
    user_id: Authenticated user ID (from dependency)

Returns:
    BatchInvitationResponse: Lists of successful and failed invitations

Raises:
    HTTPException 400: Invalid role or organization not found
    HTTPException 403: User lacks permission to invite
    HTTPException 429: Rate limit exceeded



## OpenAPI

````yaml /openapi/openhands-cloud.json post /api/organizations/{org_id}/members/invite
openapi: 3.1.0
info:
  title: OpenHands
  description: 'OpenHands: Code Less, Make More'
  version: 0.0.1
servers: []
security: []
paths:
  /api/organizations/{org_id}/members/invite:
    post:
      summary: Create Invitation
      description: |-
        Create organization invitations for multiple email addresses.

        Sends emails to invitees with secure links to join the organization.
        Supports batch invitations - some may succeed while others fail.

        Permission rules:
        - Only owners and admins can create invitations
        - Admins can only invite with 'member' or 'admin' role (not 'owner')
        - Owners can invite with any role

        Args:
            org_id: Organization UUID
            invitation_data: Invitation details (emails array, role)
            request: FastAPI request
            user_id: Authenticated user ID (from dependency)

        Returns:
            BatchInvitationResponse: Lists of successful and failed invitations

        Raises:
            HTTPException 400: Invalid role or organization not found
            HTTPException 403: User lacks permission to invite
            HTTPException 429: Rate limit exceeded
      operationId: create_invitation_api_organizations__org_id__members_invite_post
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Org Id
        - name: X-Org-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Org-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvitationCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchInvitationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    InvitationCreate:
      properties:
        emails:
          items:
            type: string
            format: email
          type: array
          title: Emails
        role:
          type: string
          title: Role
          default: member
      type: object
      required:
        - emails
      title: InvitationCreate
      description: Request model for creating invitation(s).
    BatchInvitationResponse:
      properties:
        successful:
          items:
            $ref: '#/components/schemas/InvitationResponse'
          type: array
          title: Successful
        failed:
          items:
            $ref: '#/components/schemas/InvitationFailure'
          type: array
          title: Failed
        email_delivery_configured:
          type: boolean
          title: Email Delivery Configured
          default: true
      type: object
      required:
        - successful
        - failed
      title: BatchInvitationResponse
      description: Response model for batch invitation creation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    InvitationResponse:
      properties:
        id:
          type: integer
          title: Id
        email:
          type: string
          title: Email
        role:
          type: string
          title: Role
        status:
          type: string
          title: Status
        created_at:
          type: string
          title: Created At
        expires_at:
          type: string
          title: Expires At
        inviter_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Inviter Email
        invite_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Invite Url
      type: object
      required:
        - id
        - email
        - role
        - status
        - created_at
        - expires_at
      title: InvitationResponse
      description: Response model for invitation details.
    InvitationFailure:
      properties:
        email:
          type: string
          title: Email
        error:
          type: string
          title: Error
      type: object
      required:
        - email
        - error
      title: InvitationFailure
      description: Response model for a failed invitation.
    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
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-Access-Token

````