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

# Assign Conversation

> Assign or unassign a conversation to/from an agent.



## OpenAPI

````yaml https://api.useinvent.com/openapi.json patch /chats/{chat_id}/state/assign
openapi: 3.1.0
info:
  version: 1.0.0
  title: Invent API
servers:
  - url: https://api.useinvent.com
security:
  - bearerAuth: []
paths:
  /chats/{chat_id}/state/assign:
    patch:
      tags:
        - Chats State
      summary: Assign Conversation
      description: Assign or unassign a conversation to/from an agent.
      parameters:
        - schema:
            type: string
          required: true
          description: Chat ID
          name: chat_id
          in: path
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignConversationSchema'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AssignConversationSchema'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatStateSchema'
components:
  schemas:
    AssignConversationSchema:
      type: object
      properties:
        member_id:
          type:
            - string
            - 'null'
          description: Member ID to assign. Set to null to unassign.
      required:
        - member_id
      description: Schema for assigning or unassigning a conversation to/from an agent
    ChatStateSchema:
      type: object
      properties:
        id:
          type: string
        state:
          $ref: '#/components/schemas/ChatStateStatusSchema'
        integration_id:
          $ref: '#/components/schemas/ConnectionIntegrationIdSchema'
        assistant:
          $ref: '#/components/schemas/PublicAssistantSchema'
        assistant_id:
          type:
            - string
            - 'null'
          description: The ID of the assistant used in the chat
        assistant_integration:
          $ref: '#/components/schemas/PublicAssistantIntegrationSchema'
        assistant_integration_id:
          type:
            - string
            - 'null'
          description: The ID of the assistant integration used in the chat
        conversation_id:
          type: string
          description: The ID of the conversation associated with the chat
        assigned_user:
          $ref: '#/components/schemas/UserLimitedSchema'
        assigned_at:
          type:
            - string
            - 'null'
          format: date-time
        assistant_config:
          $ref: '#/components/schemas/AssistantConfigSchema'
        ai_enabled:
          type: boolean
          description: Whether AI is enabled for the chat
        admin_unseen_count:
          type: number
          description: The number of unseen messages in the chat
        user_unseen_count:
          type: number
          description: The number of unseen messages in the chat
        follow_up_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Scheduled follow-up datetime
        muted_until:
          type:
            - string
            - 'null'
          format: date-time
          description: Mute expiry datetime (null = not muted)
        csat_score:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 5
          description: Customer satisfaction score (1-5)
        last_contact_message_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - state
        - integration_id
        - assistant_id
        - assistant_integration_id
        - conversation_id
        - ai_enabled
        - admin_unseen_count
        - user_unseen_count
      description: Schema for the chat state
    ChatStateStatusSchema:
      type: string
      enum:
        - OPEN
        - SNOOZED
        - CLOSED
      description: The state status of the chat
    ConnectionIntegrationIdSchema:
      type: string
      enum:
        - internal
        - org
        - custom
        - whatsapp_bot
        - messenger_bot
        - instagram_dm
        - tiktok_dm
        - telegram_bot
        - gmail
        - slack_bot
        - twilio
        - telnyx
        - email
      description: ID of the connection integration
    PublicAssistantSchema:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        enabled:
          type: boolean
        avatar_url:
          type:
            - string
            - 'null'
        deleted:
          type: boolean
        config:
          $ref: '#/components/schemas/PublicAssistantConfigSchema'
      required:
        - id
        - name
        - enabled
        - avatar_url
        - deleted
        - config
      description: Schema for a public assistant
    PublicAssistantIntegrationSchema:
      type: object
      properties:
        id:
          type: string
        enabled:
          type: boolean
        has_connection:
          type: boolean
      required:
        - id
        - enabled
        - has_connection
      description: Schema for a public assistant integration
    UserLimitedSchema:
      type: object
      properties:
        id:
          type: string
        name:
          type:
            - string
            - 'null'
        email:
          type: string
          format: email
        avatar:
          type:
            - string
            - 'null'
        seen_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - name
        - email
        - avatar
        - seen_at
      description: The assigned user for the conversation
    AssistantConfigSchema:
      type: object
      properties:
        instructions:
          type: string
          maxLength: 10240
          description: The instructions for the assistant
        language:
          $ref: '#/components/schemas/ModelLanguageSchema'
        model:
          type: string
          minLength: 1
          maxLength: 128
          description: The model to use for the assistant
        stt:
          $ref: '#/components/schemas/AssistantSttConfigSchema'
        tts:
          $ref: '#/components/schemas/AssistantTtsConfigSchema'
        conversation:
          $ref: '#/components/schemas/AssistantConversationConfigSchema'
        knowledge_scope:
          $ref: '#/components/schemas/KnowledgeModeSchema'
        timezone:
          type: string
          maxLength: 64
          description: IANA timezone for the assistant (e.g. "America/New_York")
      required:
        - language
        - model
        - stt
        - tts
        - conversation
        - knowledge_scope
        - timezone
      description: Schema for the configuration of an assistant
    PublicAssistantConfigSchema:
      type: object
      properties:
        conversation:
          $ref: '#/components/schemas/PublicAssistantConversationConfigSchema'
      required:
        - conversation
      description: Schema for a public assistant configuration
    ModelLanguageSchema:
      type: string
      enum:
        - auto
        - en
        - es
      description: List of supported languages for the model in ISO 639-1 format or "auto"
    AssistantSttConfigSchema:
      type: object
      properties:
        model:
          type: string
          minLength: 1
          maxLength: 128
      required:
        - model
      description: Schema for the STT configuration of an assistant
    AssistantTtsConfigSchema:
      type: object
      properties:
        model:
          type: string
          minLength: 1
          maxLength: 128
        voice_id:
          type: string
          minLength: 1
          maxLength: 128
      required:
        - model
        - voice_id
      description: Schema for the TTS configuration of an assistant
    AssistantConversationConfigSchema:
      type: object
      properties:
        thread_mode:
          $ref: '#/components/schemas/AssistantThreadModeSchema'
        welcome_banner:
          type: string
          maxLength: 256
          description: >-
            Static greeting text displayed in the UI when users start a new
            conversation
        suggested_messages:
          type: array
          items:
            type: string
            maxLength: 64
          maxItems: 5
          description: >-
            Suggested messages displayed to users when they start a new
            conversation
        auto_intro_message:
          type: string
          maxLength: 256
          description: >-
            First message automatically sent by the assistant only when a
            conversation begins via API call
        enable_memories:
          type: boolean
          description: Whether to enable the "Manage Memories" tool for the assistant
        enable_end_conversation_tool:
          type: boolean
          description: Whether to enable the "Close Conversation" tool for the assistant
        enable_transfer_to_human_tool:
          type: boolean
          description: Whether to enable the "Transfer to Human" tool for the assistant
        enable_block_contact_tool:
          type: boolean
          description: Whether to enable the "Block Contact" tool for the assistant
        enable_ai_replies:
          type: boolean
          description: >-
            Whether the AI generates replies. When false the assistant is
            human-only: incoming messages are still received and stored but the
            AI never responds, so a human answers.
        enable_auto_resolve:
          type: boolean
          description: >-
            Whether inactive conversations should automatically resolve after a
            period of inactivity
        enable_auto_follow_ups:
          type: boolean
          description: Whether the assistant can automatically follow up on conversations
        follow_up_instructions:
          type: string
          maxLength: 10240
          description: >-
            Business instructions that steer follow-up behavior (cadence, hours,
            stop rules, tone). Override the default follow-up guidance.
        enable_auto_csat:
          type: boolean
          description: >-
            Whether the assistant should automatically score customer
            satisfaction (CSAT) when closing conversations
        enable_private_chats:
          type: boolean
          description: Whether to enable private chats that do not appear in the inbox
        enable_update_contact_tool:
          type: boolean
          description: >-
            Whether to enable the assistant to collect and update contact
            information (name, email, phone)
      required:
        - thread_mode
        - enable_memories
        - enable_transfer_to_human_tool
      description: Configuration options for the conversation thread of the assistant
    KnowledgeModeSchema:
      type: string
      enum:
        - all
        - restricted
      description: The knowledge scope of the assistant
    PublicAssistantConversationConfigSchema:
      type: object
      properties:
        welcome_banner:
          type: string
          maxLength: 256
          description: >-
            Static greeting text displayed in the UI when users start a new
            conversation
        suggested_messages:
          type: array
          items:
            type: string
            maxLength: 64
          maxItems: 5
          description: >-
            Suggested messages displayed to users when they start a new
            conversation
        auto_intro_message:
          type: string
          maxLength: 256
          description: >-
            First message automatically sent by the assistant only when a
            conversation begins via API call
        enable_auto_csat:
          type: boolean
          description: >-
            Whether the assistant should automatically score customer
            satisfaction (CSAT) when closing conversations
        enable_ai_replies:
          type: boolean
          description: >-
            Whether the AI generates replies. When false the assistant is
            human-only: incoming messages are still received and stored but the
            AI never responds, so a human answers.
      description: Schema for a public assistant conversation configuration
    AssistantThreadModeSchema:
      type: string
      enum:
        - new
        - continue
      description: >-
        The thread mode of the assistant, either "new" for new threads or
        "continue" for continuing existing threads
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer token authentication using your API key

````