> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# バッチコールをキャンセル。

POST https://api.elevenlabs.io/v1/convai/batch-calling/{batch_id}/cancel

実行中のバッチ通話をキャンセルし、すべての受信者のステータスをキャンセル済みに設定します。

Reference: https://elevenlabs.io/docs/api-reference/batch-calling/cancel

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Path parameters

- `batch_id` (string, required)

## Response

### 200

成功レスポンス。

- `id` (string, required)
- `phone_number_id` (string, required, nullable)
- `phone_provider` (enum, required, nullable)
  - Allowed values: `twilio`, `sip_trunk`, `exotel`
- `whatsapp_params` (BatchCallWhatsAppParams, required, nullable)
- `name` (string, required)
- `agent_id` (string, required)
- `branch_id` (string, required, nullable)
- `environment` (string, required, nullable)
- `created_at_unix` (integer, required)
- `scheduled_time_unix` (integer, required)
- `timezone` (string, required, nullable)
- `total_calls_dispatched` (integer, required, default: 0)
- `total_calls_scheduled` (integer, required, default: 0)
- `total_calls_finished` (integer, required, default: 0)
- `last_updated_at_unix` (integer, required)
- `status` (enum, required)
  - Allowed values: `pending`, `in_progress`, `completed`, `failed`, `cancelled`
- `retry_count` (integer, required, default: 0)
- `telephony_call_config` (TelephonyCallConfig-Output, required)
- `target_concurrency_limit` (integer, required, nullable) — このバッチの同時通話数の上限。設定した場合、ディスパッチはワークスペース／エージェントのキャパシティ割合ではなく、この上限に従います。
- `agent_name` (string, required)
- `branch_name` (string, required, nullable)

## Errors

### 422 Unprocessable Entity Error

検証エラー

- `detail` (list of ValidationError, optional)

## Types

### BatchCallWhatsAppParams

- `whatsapp_call_permission_request_template_name` (string, required)
- `whatsapp_call_permission_request_template_language_code` (string, required)
- `whatsapp_phone_number_id` (string, optional, nullable)

### TelephonyCallConfig-Output

- `ringing_timeout_secs` (integer, optional, default: 60) — 接続を諦めるまでに受信者を呼び出す時間（秒）です。プロバイダー独自の制約によっても制限されます。
- `twilio_call_recording_enabled` (boolean, optional, default: false) — Twilio通話録音を使用して通話を録音するかどうか。Twilio以外のプロバイダーでは無視されます。録音はTwilioアカウントに保存されます。
- `twilio_machine_detection` (TwilioMachineDetectionConfig, optional, nullable) — Twilioの通信事業者レベルの留守番電話検出（AMD）の設定です。省略するかnullに設定すると無効になります。Twilio以外のプロバイダーおよび着信通話では無視されます。検出結果は独自の`answering_machine_detection`Webhookイベントとして配信され、このイベントをワークスペースまたはエージェントのWebhook設定で有効にする必要があります。会話または通話後Webhookの一部ではありません。検出は非同期で実行されるため、会話の開始が遅延することはありません。結果は通話中の任意の時点で届く可能性があり、`detect_message_end`では通話終了後に届くこともあります。AMDにはTwilioから別途料金が請求されます。

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### TwilioMachineDetectionConfig

通話でTwilioのキャリアレベル留守番電話検出（AMD）を実行する方法です。

- `mode` (enum, optional, default: enable) — 検出の詳細度を指定します。`enable`はTwilioが人間と機械を区別できた時点で判定を返します。`detect_message_end`はボイスメールの挨拶が終わるまで待機し、`machine_end_*`判定を生成しますが、結果の返却は遅くなります。
  - Allowed values: `enable`, `detect_message_end`

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "id": "string",
  "phone_number_id": "string",
  "phone_provider": "twilio",
  "whatsapp_params": {
    "whatsapp_call_permission_request_template_name": "string",
    "whatsapp_call_permission_request_template_language_code": "string",
    "whatsapp_phone_number_id": "string"
  },
  "name": "string",
  "agent_id": "string",
  "branch_id": "string",
  "environment": "string",
  "created_at_unix": 1,
  "scheduled_time_unix": 1,
  "timezone": "string",
  "total_calls_dispatched": 0,
  "total_calls_scheduled": 0,
  "total_calls_finished": 0,
  "last_updated_at_unix": 1,
  "status": "pending",
  "retry_count": 0,
  "telephony_call_config": {
    "ringing_timeout_secs": 60,
    "twilio_call_recording_enabled": false,
    "twilio_machine_detection": {
      "mode": "enable"
    }
  },
  "target_concurrency_limit": 1,
  "agent_name": "string",
  "branch_name": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel"

response = requests.post(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel';
const options = {method: 'POST'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel"

	req, _ := http.NewRequest("POST", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/batch-calling/batch_id/cancel")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```