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

# Bulk Invite to Websites or Groups

> Invites a user to multiple websites OR multiple groups in a single request. Provide exactly one of `website_ids` or `group_ids` — the two are mutually exclusive. Each target is processed independently, so some may succeed while others fail (e.g., if the user is already a member). In 'email' mode a single consolidated invitation email is sent. Group invites require a global API key.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/invites/bulk
openapi: 3.1.0
info:
  title: AthenaHQ API
  description: >-
    AthenaHQ API provides programmatic access to manage your websites and
    prompts for AI-powered content optimization.
  version: 1.0.0
  contact:
    email: support@athenahq.ai
servers:
  - url: https://api.athenahq.ai
    description: Production server
security:
  - apiKey: []
tags:
  - name: Basics
    description: Core API operations for managing websites and prompts
  - name: Metrics
    description: Metrics and analytics endpoints for tracking AI visibility
  - name: Billing
    description: Billing and credits endpoints for managing usage
  - name: Team Management
    description: Endpoints for managing team members and invitations
  - name: Groups
    description: Endpoints for managing groups of websites
  - name: Content
    description: >-
      Endpoints for accessing Content Hub data — tabs, tracked URLs, and per-URL
      prompt breakdowns.
  - name: Pitch Workspace
    description: >-
      Endpoints for accessing pitch workspace reports — org-scoped pitch runs
      with competitors, prompts, attributes, and aggregate metrics.
  - name: Knowledge Base
    description: >-
      Endpoints for reading the brand Knowledge Base — approved brand facts and
      the pillars that organize them.
paths:
  /api/v1/invites/bulk:
    post:
      tags:
        - Team Management
      summary: Bulk Invite to Websites or Groups
      description: >-
        Invites a user to multiple websites OR multiple groups in a single
        request. Provide exactly one of `website_ids` or `group_ids` — the two
        are mutually exclusive. Each target is processed independently, so some
        may succeed while others fail (e.g., if the user is already a member).
        In 'email' mode a single consolidated invitation email is sent. Group
        invites require a global API key.
      operationId: createBulkInvite
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkInviteRequest'
      responses:
        '201':
          description: >-
            Bulk invite processed. Check individual results for per-target
            outcomes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkInviteResponse'
              examples:
                websites:
                  summary: Bulk website invites
                  value:
                    success: true
                    results:
                      - website_id: 123e4567-e89b-12d3-a456-426614174000
                        success: true
                        message: User added to website
                        user_id: abc12345-e89b-12d3-a456-426614174000
                      - website_id: 987e6543-e21b-12d3-a456-426614174000
                        success: false
                        error: User is already a member of this website
                groups:
                  summary: Bulk group invites
                  value:
                    success: true
                    results:
                      - group_id: 456e7890-e89b-12d3-a456-426614174000
                        success: true
                        message: User added to group
                        user_id: abc12345-e89b-12d3-a456-426614174000
                      - group_id: 789e0123-e89b-12d3-a456-426614174000
                        success: false
                        error: User is already a member of this group
        '400':
          description: Bad request - Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_or_both_targets:
                  summary: Neither or both of website_ids/group_ids provided
                  value:
                    error: >-
                      Exactly one of website_ids or group_ids must be provided
                      (not both)
                too_many_websites:
                  summary: More than 50 website_ids
                  value:
                    error: website_ids must contain at most 50
                too_many_groups:
                  summary: More than 50 group_ids
                  value:
                    error: group_ids must contain at most 50
                invalid_email:
                  value:
                    error: Invalid email
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Group invites require a global API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 'Forbidden: global API key required'
        '404':
          description: One or more targets not found or do not belong to this organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                websites_not_found:
                  value:
                    error: >-
                      Websites not found or do not belong to this organization:
                      123e4567-e89b-12d3-a456-426614174000
                groups_not_found:
                  value:
                    error: >-
                      Groups not found or do not belong to this organization:
                      456e7890-e89b-12d3-a456-426614174000
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    BulkInviteRequest:
      type: object
      description: >-
        Request body for inviting a user to multiple websites or multiple
        groups. Provide exactly one of `website_ids` or `group_ids` — the two
        are mutually exclusive. A single consolidated invitation email is sent
        in 'email' mode.
      required:
        - invite_method
        - email
      properties:
        invite_method:
          type: string
          enum:
            - direct
            - email
          description: >-
            How to invite the user. 'direct' adds the user to each target
            immediately without sending any email — if no account exists for the
            email, a new user account is created automatically (with
            emailVerified=false). 'email' creates pending invite records and
            sends a single consolidated invitation email.
          example: direct
        email:
          type: string
          format: email
          description: Email address of the user to invite
          example: user@example.com
        role:
          type: string
          enum:
            - admin
            - viewer
          description: >-
            The role to assign to the invited user on each target. Mutually
            exclusive with `role_id`.
          example: viewer
        role_id:
          type: string
          pattern: >-
            ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          description: >-
            Assign any role by ID — a system role or one of your organization's
            custom roles (see `GET /api/v1/roles`). Mutually exclusive with
            `role`. Returns 404 if the role does not exist or belongs to another
            organization. Defaults to Viewer when neither `role` nor `role_id`
            is given. System role IDs are GUID-shaped sentinels (e.g.
            `00000000-0000-0000-0000-000000000001`), not RFC 4122 UUIDs.
          example: 789e0123-e89b-12d3-a456-426614174000
        website_ids:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
          maxItems: 50
          description: >-
            Array of website IDs to invite the user to (1-50). Mutually
            exclusive with `group_ids`.
          example:
            - 123e4567-e89b-12d3-a456-426614174000
            - 987e6543-e21b-12d3-a456-426614174000
        group_ids:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
          maxItems: 50
          description: >-
            Array of group IDs to invite the user to (1-50). Mutually exclusive
            with `website_ids`. Requires a global API key.
          example:
            - 456e7890-e89b-12d3-a456-426614174000
            - 789e0123-e89b-12d3-a456-426614174000
        first_name:
          type: string
          description: >-
            Optional first name of the invited user. Used when creating a new
            user account for 'direct' invites or populating invite records for
            'email' invites.
          example: John
        last_name:
          type: string
          description: >-
            Optional last name of the invited user. Used when creating a new
            user account for 'direct' invites or populating invite records for
            'email' invites.
          example: Doe
    BulkInviteResponse:
      type: object
      description: >-
        Response from a bulk invite request. Each target (website or group) is
        processed independently.
      required:
        - success
        - results
      properties:
        success:
          type: boolean
          description: >-
            Whether the bulk operation was processed (always true if request was
            valid)
          example: true
        results:
          type: array
          description: Per-target results (one entry per website or group in the request)
          items:
            $ref: '#/components/schemas/BulkInviteResult'
    Error:
      type: object
      description: Error response object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message describing what went wrong
          example: Unauthorized
    BulkInviteResult:
      type: object
      description: >-
        Result for a single target (website or group) in a bulk invite. Exactly
        one of `website_id` or `group_id` will be present, matching the field
        used in the request.
      required:
        - success
      properties:
        website_id:
          type: string
          format: uuid
          description: >-
            The website ID this result is for (present only when the request
            used `website_ids`)
          example: 123e4567-e89b-12d3-a456-426614174000
        group_id:
          type: string
          format: uuid
          description: >-
            The group ID this result is for (present only when the request used
            `group_ids`)
          example: 456e7890-e89b-12d3-a456-426614174000
        success:
          type: boolean
          description: Whether the invite was successful for this target
        invite_id:
          type: string
          format: uuid
          description: The invite ID (only present for successful email invites)
        user_id:
          type: string
          format: uuid
          description: >-
            The ID of the user the invite targets. Present only for successful
            direct invites. Never returned for email-method invites to prevent
            cross-tenant account-existence enumeration.
        message:
          type: string
          description: Success message (present when success is true)
          example: User added to website
        error:
          type: string
          description: Error message (present when success is false)
          example: User is already a member of this website
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. You can create one
        [here](https://app.athenahq.ai/organization?tab=api).

````