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

# Hang Up Call

> Ends a call that is in progress or waiting in the inbound queue, as the Hangup button of the platform does. Requires the `pearls:moderate` scope.

- **A phone call** is hung up.
- **A stream call nobody has connected to yet** is cancelled, and its agent is freed. Connecting with its token is then refused with `410`.
- **A connected stream call** ends: its WebSocket receives `ended` with the reason `operator_hangup`, then closes.

The call then gets its final status, like any other call. A call that has already ended, or a text conversation, is refused with a `400` that says why.



## OpenAPI

````yaml post /v2/Call/{callId}/Hangup
openapi: 3.0.1
info:
  title: NLPearl Client API
  description: A sample API that demonstrates features in the OpenAPI specification
  version: v2
servers:
  - url: https://api.nlpearl.ai
    description: Production Environement
security:
  - bearer_auth: []
  - oauth2_client_credentials: []
tags:
  - name: Pearl
    description: >-
      Manage your Pearls, the AI agents that handle your inbound and outbound
      calls. Create and configure Pearls, retrieve their details and settings,
      run or pause them, list and bulk-export their calls, monitor calls in
      progress, get analytics, and reset a customer's conversation memory.
  - name: Speech
    description: >-
      Turn text into speech with your voices, as a single clip or as a stream,
      and clone new voices from a recording.
paths:
  /v2/Call/{callId}/Hangup:
    post:
      tags:
        - Call
      summary: Hang Up Call
      description: >-
        Ends a call that is in progress or waiting in the inbound queue, as the
        Hangup button of the platform does. Requires the `pearls:moderate`
        scope.


        - **A phone call** is hung up.

        - **A stream call nobody has connected to yet** is cancelled, and its
        agent is freed. Connecting with its token is then refused with `410`.

        - **A connected stream call** ends: its WebSocket receives `ended` with
        the reason `operator_hangup`, then closes.


        The call then gets its final status, like any other call. A call that
        has already ended, or a text conversation, is refused with a `400` that
        says why.
      parameters:
        - name: callId
          in: path
          description: >-
            The id of the call to hang up: the `callId` returned by Create
            Stream Token, or the id from Get Calls and the webhooks.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: '`true`: the hang-up was sent, and the call ends within moments.'
          content:
            text/plain:
              schema:
                type: boolean
            application/json:
              schema:
                type: boolean
            text/json:
              schema:
                type: boolean
        '400':
          description: >-
            The call was not found or cannot be hung up: `Call not found.`,
            `Conversation is not ongoing or waiting in queue.`, or `Only ongoing
            phone calls can be hung up.` for a text conversation.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
components:
  schemas:
    ValidationProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          nullable: true
      additionalProperties: {}
  securitySchemes:
    bearer_auth:
      type: http
      description: >-
        Specify the authorization token.


        For more information, check out the [Authorization
        Guide](/api-reference/authorization).
      scheme: bearer
    oauth2_client_credentials:
      type: oauth2
      description: >-
        OAuth2 client_credentials grant. Use the Id of an OAuth API key as
        `client_id` and its one-time secret as `client_secret`.
      flows:
        clientCredentials:
          tokenUrl: /oauth/token
          scopes:
            pearls:read: List and view Pearls
            pearls:write: >-
              Create and update Pearls (settings, conversation flows, voices);
              implies pearls:read
            pearls:moderate: Run/pause Pearls and reset customer memory; implies pearls:read
            pearls:analytics: Read Pearl analytics; implies pearls:read
            pearls:leads: Manage and read outbound leads; implies pearls:read
            pearls:calls: >-
              Read calls and recordings, make and delete calls; implies
              pearls:read
            pearls:stream: >-
              Create stream tokens and run calls over a WebSocket; implies
              pearls:read
            account:phone_numbers: >-
              Read account phone numbers and text channels, manage custom VoIP
              numbers, import Twilio numbers and delete phone numbers
            account:users: Read account users
            account:advanced: Manage advanced account settings (blacklist)
            account:billing: Read account information and credit balance
            account:audit_log: Read the audit log
            tts: Synthesise speech and clone voices

````

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