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

# Finalizar atendimento

> Finaliza o atendimento de um chat. O atendimento é encerrado em nome do sistema: a mensagem registrada no chat é "Atendimento finalizado por Sistema".



## OpenAPI

````yaml POST /attendance/end-attendance
openapi: 3.1.0
info:
  title: OpenAPI Multchats
  description: Multchats API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.multchats.com/v2
security:
  - bearerAuth: []
paths:
  /attendance/end-attendance:
    post:
      tags:
        - Attendance
      summary: Finalizar atendimento
      description: >-
        Finaliza o atendimento de um chat. O atendimento é encerrado em nome do
        sistema: a mensagem registrada no chat é "Atendimento finalizado por
        Sistema".
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EndAttendanceRequest'
      responses:
        '200':
          description: Atendimento finalizado com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndAttendanceResponse'
        '400':
          description: >-
            Erro na requisição (por exemplo, "Chat not found" ou "More than one
            chat matches the chat id")
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: O atendimento já está finalizado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndAttendanceConflictResponse'
components:
  schemas:
    EndAttendanceRequest:
      type: object
      required:
        - integrationId
        - chatId
      properties:
        integrationId:
          description: ID da integração
          type: string
          pattern: ^c[a-z0-9]{24}$
        chatId:
          description: >-
            ID do chat ou número de telefone. Se corresponder a mais de um chat,
            a API responde 400 ("More than one chat matches the chat id")
          type: string
          minLength: 8
          maxLength: 255
        observation:
          description: Observação da finalização
          type: string
          maxLength: 1024
    EndAttendanceResponse:
      type: object
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
        attendance:
          description: Dados do atendimento finalizado
          type: object
    Error:
      required:
        - success
        - message
      type: object
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
          default: false
        message:
          description: Mensagem de erro (quando success é false)
          type: string
          default: Erro ao enviar mensagem
    EndAttendanceConflictResponse:
      type: object
      required:
        - success
        - code
        - message
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
          default: false
        code:
          description: Código do conflito
          type: string
          enum:
            - CHAT_ALREADY_FINALIZED
        message:
          description: Mensagem de erro
          type: string
          default: Chat is already finalized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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