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

# Transfer Call

> Transfer an active call to another phone number

Transfer an in-progress call to another phone number. The AI agent can announce the transfer before connecting the caller to the new number.

## Request Body

<ParamField body="call_id" type="string" required>
  The unique identifier of the active call to transfer.
</ParamField>

<ParamField body="transfer_to" type="string" required>
  The phone number to transfer the call to in E.164 format.
</ParamField>

<ParamField body="announce" type="string">
  Message the AI agent will speak before transferring the call. If omitted, the call transfers immediately.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the transfer was initiated successfully.
</ResponseField>

<ResponseField name="transfer_call_id" type="string">
  Unique identifier for the transfer leg of the call.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/transfer-call \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "call_id": "7f3d8e00-a1b2-4c3d-9e4f-567890abcdef",
      "transfer_to": "+14155559999",
      "announce": "I am now transferring you to a specialist. Please hold."
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/transfer-call',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        call_id: '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef',
        transfer_to: '+14155559999',
        announce: 'I am now transferring you to a specialist. Please hold.'
      }),
    }
  );

  const result = await response.json();
  console.log('Transfer initiated:', result.success);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/transfer-call',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={
          'call_id': '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef',
          'transfer_to': '+14155559999',
          'announce': 'I am now transferring you to a specialist. Please hold.'
      }
  )

  result = response.json()
  print(f"Transfer initiated: {result['success']}")
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "transfer_call_id": "8a4e9f00-b2c3-5d4e-0f1a-678901bcdef0"
  }
  ```

  ```json Error Response theme={null}
  {
    "error": {
      "code": "call_not_active",
      "message": "The specified call is not currently active"
    }
  }
  ```
</ResponseExample>
