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

# Add user to chat

> Adds a user to the chat.

The following restrictions apply:

- The chat must be active.
- The requester must be present on the list of chat users. You can override it by setting the `ignore_requester_presence` parameter.
- You can't have more than one `customer` in the chat.
- Additional agents must also have access to the chat.
- `customer` must be added with `visibility: all`.

**Required scopes:** <Tooltip tip="To add a user to a chat taking place in any group.">`chats--all:rw`</Tooltip> or <Tooltip tip="To add a user to a chat taking place in groups that the user is a member of. The agent groups and the chat groups must overlap — at least one group must be in common.">`chats--access:rw`</Tooltip>


## OpenAPI

````yaml /api/agent-chat/v3.6/openapi.json post /action/add_user_to_chat
openapi: 3.0.0
info:
  title: Agent Chat API
  description: >-
    The Agent Chat API allows you to manage chats, threads, events, and agent
    state.
  version: '3.6'
servers:
  - url: https://api.livechatinc.com/v3.6/agent
    description: Production server
security: []
paths:
  /action/add_user_to_chat:
    post:
      tags:
        - Chat users
      summary: Add user to chat
      description: >-
        Adds a user to the chat.


        The following restrictions apply:


        - The chat must be active.

        - The requester must be present on the list of chat users. You can
        override it by setting the `ignore_requester_presence` parameter.

        - You can't have more than one `customer` in the chat.

        - Additional agents must also have access to the chat.

        - `customer` must be added with `visibility: all`.
      operationId: add-user-to-chat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddUserToChatRequest'
            example:
              chat_id: PW94SJTGW6
              user_id: smith@example.com
              user_type: agent
              visibility: all
              ignore_requester_presence: true
      responses:
        '200':
          description: User added to chat.
      security:
        - PersonalAccessToken: []
        - OAuth2BearerToken:
            - chats--all:rw
components:
  schemas:
    AddUserToChatRequest:
      type: object
      required:
        - chat_id
        - user_id
        - user_type
        - visibility
      properties:
        chat_id:
          type: string
          description: The chat ID.
        user_id:
          type: string
          description: The user ID.
        user_type:
          type: string
          enum:
            - agent
            - customer
          description: The user type.
        visibility:
          type: string
          enum:
            - all
            - agents
          description: >-
            Visibility of the user in the chat. `customer` must be added with
            `all`.
        ignore_requester_presence:
          type: boolean
          default: false
          description: >-
            If `true`: the requester doesn't need to be present on the list of
            chat users.
  securitySchemes:
    PersonalAccessToken:
      description: >-
        Use your `account ID` as the username and your personal access token
        (PAT) as the password, or pass a Base64-encoded value directly in the
        Authorization header. For more information, see the <a
        href="/authentication/personal-access-tokens">personal access tokens
        guide</a>.
      type: http
      scheme: basic
    OAuth2BearerToken:
      description: >-
        This API uses OAuth2 with the implicit grant flow. <a
        href="/authentication/oauth-authorization#implicit-grant">Learn about
        the implicit grant flow.</a>
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://accounts.livechat.com
          scopes:
            chats--all:ro: Read all chats
            chats--all:rw: Read and write all chats
            chats--access:ro: Read chats from groups the agent is a member of
            chats--access:rw: Read and write chats from groups the agent is a member of
        authorizationCode:
          authorizationUrl: https://accounts.livechat.com
          tokenUrl: https://accounts.livechat.com/token
          scopes:
            chats--all:ro: Read all chats
            chats--all:rw: Read and write all chats
            chats--access:ro: Read chats from groups the agent is a member of
            chats--access:rw: Read and write chats from groups the agent is a member of

````