> ## 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.

# Create Invite

> Invites a user to your organization, a specific website, or a group. Use `invite_method: "direct"` to add the user immediately without sending any email — if the email has no existing account, a new user account is created automatically. Use `invite_method: "email"` to create a pending invite and send an invitation email that the recipient must accept. Group invites require a global API key.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/invites
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:
    post:
      tags:
        - Team Management
      summary: Create Invite
      description: >-
        Invites a user to your organization, a specific website, or a group. Use
        `invite_method: "direct"` to add the user immediately without sending
        any email — if the email has no existing account, a new user account is
        created automatically. Use `invite_method: "email"` to create a pending
        invite and send an invitation email that the recipient must accept.
        Group invites require a global API key.
      operationId: createInvite
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInviteRequest'
      responses:
        '201':
          description: User added or invitation sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InviteResponse'
              examples:
                direct_org:
                  summary: User added to organization
                  value:
                    success: true
                    message: User added to organization
                    user_id: abc12345-e89b-12d3-a456-426614174000
                direct_website:
                  summary: User added to website
                  value:
                    success: true
                    message: User added to website
                    user_id: abc12345-e89b-12d3-a456-426614174000
                direct_group:
                  summary: User added to group
                  value:
                    success: true
                    message: User added to group
                    user_id: abc12345-e89b-12d3-a456-426614174000
                email_invite:
                  summary: Email invitation sent
                  value:
                    success: true
                    invite_id: 123e4567-e89b-12d3-a456-426614174000
                    message: Invitation sent
        '400':
          description: Bad request - Invalid parameters or email send failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                validation_error:
                  value:
                    error: website_id is required when type is 'website'
                email_failed:
                  value:
                    error: Failed to send invitation email
                invalid_email:
                  value:
                    error: Email address appears to be invalid or non-existent
        '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: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                website_not_found:
                  summary: Website not found
                  value:
                    error: Website not found or does not belong to this organization
                group_not_found:
                  summary: Group not found
                  value:
                    error: Group not found or does not belong to this organization
                org_not_found:
                  summary: Organization not found
                  value:
                    error: Organization not found
        '409':
          description: Conflict - User already exists or invite pending
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                already_org_member:
                  value:
                    error: User is already a member of this organization
                already_website_member:
                  value:
                    error: User is already a member of this website
                already_group_member:
                  value:
                    error: User is already a member of this group
                org_member_has_website_access:
                  value:
                    error: >-
                      User is already an organization member and has access to
                      all websites
                org_member_has_group_access:
                  value:
                    error: >-
                      User is already an organization member and has access to
                      all groups
                pending_invite:
                  value:
                    error: A pending invite already exists for this email
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    CreateInviteRequest:
      type: object
      description: Request body for creating an invite
      required:
        - type
        - invite_method
        - email
      properties:
        type:
          type: string
          enum:
            - organization
            - website
            - group
          description: >-
            The type of invite. 'organization' grants org-wide access, 'website'
            grants access to a single website, 'group' grants access to all
            websites in a group. Group invites require a global API key.
          example: organization
        invite_method:
          type: string
          enum:
            - direct
            - email
          description: >-
            How to invite the user. 'direct' adds the user to the resource
            immediately without sending any email — if no account exists for the
            email, a new user account is created automatically (with
            emailVerified=false) and the membership is added. 'email' creates a
            pending invite record and sends an invitation email via Postmark;
            the user must accept the invite to gain access.
          example: email
        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. 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_id:
          type: string
          format: uuid
          description: >-
            Required when type is 'website'. The ID of the website to grant
            access to
          example: 123e4567-e89b-12d3-a456-426614174000
        group_id:
          type: string
          format: uuid
          description: >-
            Required when type is 'group'. The ID of the group to grant access
            to. Requires a global API key.
          example: 456e7890-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 the invite record
            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 the invite record
            for 'email' invites.
          example: Doe
    InviteResponse:
      type: object
      description: Response from creating an invite
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          description: Whether the operation was successful
          example: true
        invite_id:
          type: string
          format: uuid
          description: The ID of the created invite (only present for email invites)
          example: 123e4567-e89b-12d3-a456-426614174000
        user_id:
          type: string
          format: uuid
          description: >-
            The ID of the user the invite targets. Present only for direct
            invites (the user is looked up or created immediately). Never
            returned for email-method invites to prevent cross-tenant
            account-existence enumeration.
          example: abc12345-e89b-12d3-a456-426614174000
        message:
          type: string
          description: A message describing the result
          example: Invitation sent
    Error:
      type: object
      description: Error response object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message describing what went wrong
          example: Unauthorized
  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).

````