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

# Invite a user

> Invites a user to the community, optionally to a specific group and with anonymous display details



## OpenAPI

````yaml https://api.zapnito.com/api/docs/v1/swagger.json post /api/v1/invitations
openapi: 3.0.1
info:
  title: API V1
  version: v1
  description: Zapnito API Documentation
servers:
  - url: https://{host}
    description: Your community domain
    variables:
      host:
        default: your-community.com
        description: Your community domain, for example your-community.com
security: []
tags:
  - name: Health Check
    description: Check that the API is reachable and that your API key is valid
  - name: Identity
    description: Find out which community your API key belongs to
  - name: Users
    description: >-
      Look up the people in your community, update their profile and choose
      which notifications they receive
  - name: Organisations
    description: >-
      Create and update the organisations in your community and manage who
      belongs to them
  - name: Groups
    description: Create groups and manage which users belong to them
  - name: Invitations
    description: Invite people to join your community
  - name: Posts
    description: Create, read and update posts on behalf of your community members
  - name: Contents
    description: >-
      Read the published content of your community and publish, schedule or
      unpublish it
  - name: Channels
    description: List the channels in your community and the content published in each
  - name: Rooms
    description: Create and read the rooms where your community members meet
  - name: Tags
    description: Create tags and apply them to content
  - name: Badges
    description: Create badges and award them to content or to users
  - name: Custom Fields
    description: Read the custom profile fields your community asks its members to fill in
  - name: Third-Party Resources
    description: >-
      Link to resources hosted outside your community so they appear alongside
      your content
  - name: Rest Hooks
    description: >-
      Subscribe a URL to events in your community, so you are told when they
      happen
paths:
  /api/v1/invitations:
    post:
      tags:
        - Invitations
      summary: Invite a user
      description: >-
        Invites a user to the community, optionally to a specific group and with
        anonymous display details
      operationId: inviteUser
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvitationCreateRequest'
            examples:
              new_invitation:
                summary: An invitation to the community
                value:
                  user:
                    name: John Doe
                    email: jon.doe@example.com
                    invited_by_email: admin@example.com
        required: true
        description: Invitation payload wrapped in a user object
      responses:
        '200':
          description: The user was invited
          content:
            application/json:
              examples:
                example:
                  value:
                    invitation:
                      name: John Doe
                      email: jon.doe@example.com
                      invited_by_email: admin@example.com
                      origin_content_url: https://example.com/posts/1
                      group_uuid: abc-123
                      title: Head of Engineering
                      company: Acme Corp
                      anonymous_name: Crouching Tiger
                      anonymous_company: Hidden Dragon
                      anonymous_title: Sifu
                      terms_accepted: true
                      country_code: GB
              schema:
                type: object
                properties:
                  invitation:
                    $ref: '#/components/schemas/Invitation'
                required:
                  - invitation
        '401':
          description: >-
            The API key is missing or invalid. The response body is the text
            `HTTP Token: Access denied.`
        '403':
          description: >-
            The sender lacks the permission to invite users, or to invite to a
            group
          content:
            application/json:
              examples:
                error:
                  value:
                    error: >-
                      admin@example.com does not have the 'create_invitation'
                      ability
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: >-
                      admin@example.com does not have the 'create_invitation'
                      ability
                required:
                  - error
        '404':
          description: No group has the UUID, or no user has the sender email address
          content:
            application/json:
              examples:
                error:
                  value:
                    error: Group not found for provided UUID 'missing-group-uuid'
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Group not found for provided UUID 'missing-group-uuid'
                required:
                  - error
        '422':
          description: The request failed validation
          content:
            application/json:
              examples:
                error:
                  value:
                    errors:
                      email:
                        - is invalid
                      country_code:
                        - must be a valid ISO 3166-1 alpha-2 country code
                      terms_accepted:
                        - must be true or false
              schema:
                type: object
                properties:
                  errors:
                    type: object
                    properties:
                      email:
                        type: array
                        items:
                          type: string
                        example:
                          - is invalid
                      country_code:
                        type: array
                        items:
                          type: string
                        example:
                          - must be a valid ISO 3166-1 alpha-2 country code
                      terms_accepted:
                        type: array
                        items:
                          type: string
                        example:
                          - must be true or false
                required:
                  - errors
      security:
        - tokenAuth: []
components:
  schemas:
    InvitationCreateRequest:
      type: object
      properties:
        user:
          type: object
          properties:
            name:
              type: string
              example: John Doe
            email:
              type: string
              format: email
              example: jon.doe@example.com
            invited_by_email:
              type: string
              format: email
              example: admin@example.com
            origin_content_url:
              type: string
              example: https://example.com/posts/1
            group_uuid:
              type: string
              example: abc-123
            suppress_email:
              type: boolean
              example: false
            title:
              type: string
              example: Head of Engineering
            company:
              type: string
              example: Acme Corp
            anonymous_name:
              type: string
              example: Crouching Tiger
            anonymous_company:
              type: string
              example: Hidden Dragon
            anonymous_title:
              type: string
              example: Sifu
            terms_accepted:
              type: boolean
              example: false
              description: >-
                Set to true if the invited user has already accepted the terms
                and conditions. They then skip the terms step when joining, and
                are not asked to review the terms when they first sign in.
                Defaults to false, and never revokes an existing acceptance.
            country_code:
              type: string
              example: GB
              description: >-
                Pre-selects the country of a newly invited user. Must be a valid
                ISO 3166-1 alpha-2 country code, such as GB or US. Not case
                sensitive, and returned in upper case. Ignored for a user who
                already has an account, so their country is never overwritten.
          required:
            - name
            - email
            - invited_by_email
      required:
        - user
    Invitation:
      type: object
      properties:
        name:
          type: string
          example: John Doe
        email:
          type: string
          format: email
          example: jon.doe@example.com
        invited_by_email:
          type: string
          format: email
          example: admin@example.com
        origin_content_url:
          type: string
          nullable: true
          example: https://example.com/posts/1
        group_uuid:
          type: string
          nullable: true
          example: abc-123
        title:
          type: string
          nullable: true
          example: Head of Engineering
        company:
          type: string
          nullable: true
          example: Acme Corp
        anonymous_name:
          type: string
          nullable: true
          example: Crouching Tiger
        anonymous_company:
          type: string
          nullable: true
          example: Hidden Dragon
        anonymous_title:
          type: string
          nullable: true
          example: Sifu
        terms_accepted:
          type: boolean
          example: true
          description: >-
            Echoes the terms_accepted value from the request. Only present when
            it was sent.
        country_code:
          type: string
          example: GB
          description: >-
            Echoes the country_code from the request, in upper case. Only
            present when one was sent.
      required:
        - name
        - email
        - invited_by_email
  securitySchemes:
    tokenAuth:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        API authentication using your community API secret. The value below is
        sent as the Authorization header verbatim, so paste the whole header
        value including the prefix: Token token=<api-key>
      x-default: Token token=<api-key>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.