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

# Recusar Ligação

> Recusa uma ligação recebida que ainda está tocando, para todos os atendentes e para o celular.

Use este endpoint para recusar uma ligação recebida que ainda está tocando. A recusa vale para todos: a ligação para de tocar para os atendentes conectados e no celular, e quem ligou vê a ligação recusada.

O `id` da ligação e o `instance_id` vêm do evento [`call.received`](https://developer.zapsterapi.com/pt-BR/v1/webhooks/available-events). Se a ligação já não estiver tocando, a resposta é `404` com o código `voice_call_not_found`.

Depois da recusa você recebe o evento `call.rejected` com `rejected_by` igual a `zapsterapi`.

> [!NOTE]
>
> No navegador, `call.reject()` do SDK de voz recusa a ligação só para aquele atendente: ela continua tocando para os outros e no celular. Para recusar para todos, use este endpoint.


## OpenAPI

````yaml POST /wa/calls/{id}/reject
openapi: 3.1.0
info:
  title: Zapster API
  description: ''
  version: 1.0.0
servers:
  - url: https://api.zapsterapi.com/v1
    description: Produção
security: []
tags: []
paths:
  /wa/calls/{id}/reject:
    post:
      tags:
        - Ligações
      summary: Recusar Ligação
      description: >-
        Recusa uma ligação recebida que ainda está tocando, para todos os
        atendentes e para o celular.
      parameters:
        - name: id
          in: path
          required: true
          description: ID da ligação no WhatsApp, o `data.id` do evento `call.received`.
          schema:
            type: string
          example: 3EB0A1B2C3D4E5F60718A9B0C1D2E3F4
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - instance_id
              properties:
                instance_id:
                  type: string
                  description: ID da instância em que a ligação está tocando.
                  example: ozj35qv418rpmlrb
      responses:
        '200':
          description: Ligação recusada
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 3EB0A1B2C3D4E5F60718A9B0C1D2E3F4
                  instance_id:
                    type: string
                    example: ozj35qv418rpmlrb
                  direction:
                    type: string
                    example: incoming
                  state:
                    type: string
                    example: ended
                  end_reason:
                    type: string
                    example: rejected
        '404':
          description: A ligação não está mais tocando
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          example: voice_call_not_found
                        message:
                          type: string
                          example: >-
                            The call does not exist, is already over or was
                            answered elsewhere.
        '412':
          description: >-
            A instância roda uma versão anterior às ligações de voz; desligue e
            ligue a instância para atualizá-la
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          example: instance_update_required
                        message:
                          type: string
                          example: >-
                            This instance is running an older version that does
                            not support this feature. Power the instance off and
                            on to update it, or contact support for help.
        '503':
          description: A instância não respondeu a tempo
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          example: instance_unavailable
                        message:
                          type: string
                          example: >-
                            The instance could not reach WhatsApp right now, so
                            the request was not completed. Please try again in a
                            few moments.
      security:
        - bearer: []
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

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