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

> Return a caller that a Classical IVR transferred to your SIP endpoint, so the flow can route them to a team. Use when your system is done with the call.

# Hand back a transferred call

When a Classical IVR transfers a caller to a SIP destination, the caller stays on the OpenCX call while your SIP endpoint talks to them. Call this endpoint, instead of hanging up, when the caller should continue with the organization. OpenCX hangs up your SIP leg, then the IVR continues with the steps after the transfer, usually a transfer to a team. The caller keeps the same call, recording and session throughout.

Send the session ID you received in the `X-OPENCX-SESSION-ID` SIP header of the transfer. The destination must list `X-OPENCX-SESSION-ID` among its allowed headers if it uses an allowlist.

* Create the API key with the **Hand back transferred calls** (`phone-calls:write`) scope. That scope cannot read or change any other phone configuration. A `phone:write` key can also hand calls back.
* Pass an optional `summary` of the conversation so far. It replaces the session's summary before the teammate is connected, so they see it when the call rings. It is saved only when the hand-back is accepted.
* Repeating a successful hand-back returns the same response and changes nothing; a `summary` sent with the repeat is ignored.
* A `409` means the session has no transferred call waiting: your leg has not answered yet, your leg or the caller already hung up, or the session has no SIP transfer. Hanging up without calling this endpoint returns the caller to the IVR, which continues with the `completed` outcome.
* A `404` means the session does not exist in the organization that owns the API key.

Do not hang up your leg first: OpenCX hangs it up for you once the hand-back is accepted. If your leg hangs up before the hand-back arrives, the hand-back is still accepted for a few seconds.


## OpenAPI

````yaml post /phone/calls/hand-back
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /phone/calls/hand-back:
    post:
      summary: Hand back a transferred call
      description: >-
        Returns a caller that a Classical IVR transferred to your SIP endpoint.
        Your SIP leg is hung up, and the IVR continues with the steps after the
        transfer (usually routing the caller to a team) on the same call,
        recording and session. Call it instead of hanging up when the caller
        should continue with the organization. Repeating a successful hand-back
        returns the same response and ignores its summary. Returns 409 when the
        session has no transferred call waiting: before your leg answered, or
        after your leg or the caller hung up.
      operationId: handBackPhoneCall
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HandBackCallInput'
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HandBackCallOutput'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    HandBackCallInput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/HandBackCallInputInput'
      type: object
      properties:
        session_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: >-
            The session of the call to hand back, as received in the
            X-OPENCX-SESSION-ID SIP header
        summary:
          description: >-
            Your summary of the conversation so far. Saved as the session's
            summary before a teammate is connected.
          type: string
          minLength: 1
          maxLength: 10000
      required:
        - session_id
      additionalProperties: false
    HandBackCallOutput:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/HandBackCallOutput'
      type: object
      properties:
        session_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        status:
          type: string
          const: handed_back
      required:
        - session_id
        - status
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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