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

# Invite user

> Invites a user to your account with a role, and returns their invitation link.



## OpenAPI

````yaml POST /v1/accounts/{account_id}/user
openapi: 3.1.0
info:
  title: WotNot API
  version: 1.0.0
  description: 'WotNot API: Invite user.'
servers:
  - url: https://api.wotnot.io
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/accounts/{account_id}/user:
    post:
      summary: Invite user
      description: >-
        Invites a user to your account with a role, and returns their invitation
        link.
      operationId: inviteUser
      parameters:
        - name: account_id
          in: path
          required: true
          description: The ID of your WotNot account.
          schema:
            type: string
      requestBody:
        required: true
        description: The user to invite and the role to give them.
        content:
          application/json:
            schema:
              type: object
              required:
                - user
                - notify_user
              properties:
                user:
                  type: object
                  description: The user to invite.
                  required:
                    - email
                    - role_id
                  properties:
                    email:
                      type: string
                      description: The user's email address. It must be a valid email.
                      example: john.doe@gmail.com
                    role_id:
                      type: string
                      description: >-
                        The ID of the role to give the user. Get it from Get
                        account roles.
                      example: '262185'
                    first_name:
                      type: string
                      description: The user's first name. Optional.
                      example: John
                    last_name:
                      type: string
                      description: The user's last name. Optional.
                      example: Doe
                notify_user:
                  type: string
                  description: >-
                    Whether to notify the user about the invitation, for example
                    `"true"`.
                  example: 'true'
            example:
              user:
                email: john.doe@gmail.com
                first_name: John
                last_name: Doe
                role_id: '262185'
              notify_user: 'true'
      responses:
        '200':
          description: The user was invited. Returns their `invitation_link` and `status`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - invitation_link
                  - ok
                  - status
                properties:
                  invitation_link:
                    type: string
                    description: >-
                      The link the user opens to create their account.
                      `{{customer_portal_domain}}` stands in for your portal's
                      domain, and `{{invitation_key}}` for the user's invitation
                      key.
                    example: >-
                      {{customer_portal_domain}}/create-your-account?invitation_key={{invitation_key}}
                  ok:
                    type: boolean
                    description: '`true` when the request worked. Errors return `false`.'
                    example: true
                  status:
                    type: string
                    description: The invitation's status, for example `invited`.
                    example: invited
              example:
                invitation_link: >-
                  {{customer_portal_domain}}/create-your-account?invitation_key={{invitation_key}}
                ok: true
                status: invited
        '400':
          description: >-
            Something in the body is invalid, for example the email isn't valid.
            Each item in `message` points to one problem.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              example:
                error: BAD_REQUEST
                ok: false
                status: 400
                message:
                  - message: '"user.email" must be a valid email'
                    path:
                      - user
                      - email
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: The role wasn't found in your account. Check the `role_id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: ROLE_NOT_FOUND
                ok: false
                status: 404
                message: Role not found for this account.
components:
  schemas:
    ValidationError:
      type: object
      description: Returned when one or more fields in the request body are invalid.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: '`BAD_REQUEST` for this kind of error.'
          example: BAD_REQUEST
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body.
          example: 400
        message:
          type: array
          description: A list of problems with the request, one item per problem.
          items:
            type: object
            required:
              - message
              - path
            properties:
              message:
                type: string
                description: >-
                  What is wrong with this field, for example `"url" must be a
                  valid uri`.
                example: '"url" must be a valid uri'
              path:
                type: array
                description: >-
                  Where the problem is in your request body. For example,
                  `["urls", 0]` means the first item in `urls`.
                items:
                  type:
                    - string
                    - integer
    Error:
      type: object
      description: Returned whenever a request fails.
      required:
        - error
        - ok
        - status
        - message
      properties:
        error:
          type: string
          description: >-
            A short error code in capital letters, for example `UNAUTHORIZED`.
            Check this in your code to tell errors apart.
          example: UNAUTHORIZED
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        status:
          type: integer
          description: The HTTP status code, repeated in the body, for example `401`.
          example: 401
        message:
          type: string
          description: What went wrong and how to fix it, in plain words.
          example: Invalid token. Provide the valid account token.
  responses:
    Unauthorized:
      description: >-
        The token is missing or wrong. Check that the `Authorization` header is
        `Bearer` followed by your account token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            ok: false
            status: 401
            message: Invalid token. Provide the valid account token.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All of WotNot's APIs use Bearer token authentication. Send your account
        token as `Bearer <token>`. You can find it in Settings > Account
        Settings > Developer. Keep it on your server: anyone who has it can call
        the API as your account.

````

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