> 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.

# アウトバウンドキャンペーンの構成を置換

PUT https://api.elevenlabs.io/v1/convai/outbound-campaigns/config
Content-Type: application/json

ワークスペースのアウトバウンドキャンペーン設定を作成または置換します。最後に読み取った`version` を`expected_version` として送信してください。最初の設定を作成する場合は省略します。読み取り後に変更された設定は置換されません。キャンペーンでは開始時のポリシーが維持されます。

Reference: https://elevenlabs.io/docs/api-reference/campaigns/config/update

## 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

### Body (application/json)

This endpoint expects a ReplaceWorkspaceConfigRequest.

- `config` (CampaignConfig-Input, required)
- `expected_version` (integer, optional, nullable) — 置換する設定の`version`。最初の設定を作成する場合にのみ省略します。

## Response

### 200

成功レスポンス。

- `version` (integer, required) — 置換するたびに増加します。`expected_version` として送信してください。
- `config` (CampaignConfig-Output, required)

## Errors

### 422 Unprocessable Entity Error

検証エラー

- `detail` (list of ValidationError, optional)

## Types

### CampaignConfig-Input

- `policy` (PolicyConfig-Input, optional) — キャンペーンで独自に設定されていない場合に適用されるポリシー。
- `agent_policies` (map from string to AgentPolicyOverride-Input, optional) — エージェントIDをキーとする`policy` のオーバーライド。
- `whatsapp_voice_policy` (AgentPolicyOverride-Input, optional, nullable) — WhatsApp音声キャンペーン用のオーバーライド。ワークスペースポリシーとエージェントのオーバーライドの間に適用されます。省略したセクションには、WhatsApp音声の組み込みデフォルトが適用されます。

### CampaignConfig-Output

- `policy` (PolicyConfig-Output, optional) — キャンペーンで独自に設定されていない場合に適用されるポリシー。
- `agent_policies` (map from string to AgentPolicyOverride-Output, optional) — エージェントIDをキーとする`policy` のオーバーライド。
- `whatsapp_voice_policy` (AgentPolicyOverride-Output, optional, nullable) — WhatsApp音声キャンペーン用のオーバーライド。ワークスペースポリシーとエージェントのオーバーライドの間に適用されます。省略したセクションには、WhatsApp音声の組み込みデフォルトが適用されます。

### ValidationError

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

### PolicyConfig-Input

- `timezone` (string, optional, default: UTC) — 発信時間帯の解釈に使用するIANAタイムゾーン。
- `retry` (RetryPolicy, optional)
- `calling_periods` (list of CallingPeriod, optional) — 通話を発信できる曜日ごとの時間帯。
- `data_collection` (DataCollectionConfig, optional) — フォローアップ通話を制御するエージェントのデータ収集項目。各項目はデフォルトで 用途に応じた組み込み項目を使用し、`null`にすると無効になります。
- `followup_context` (FollowupContextPolicy, optional) — フォローアップ通話に渡される `campaign__` 動的変数。

### AgentPolicyOverride-Input

ここで設定した各セクションは、ポリシー内の対応するセクション全体を置き換えます。

- `timezone` (string, optional, nullable)
- `retry` (RetryPolicy, optional, nullable)
- `calling_periods` (list of CallingPeriod, optional, nullable)
- `data_collection` (DataCollectionConfig, optional, nullable) — フォローアップ通話を制御するエージェントのデータ収集項目。各項目はデフォルトで 用途に応じた組み込み項目を使用し、`null`にすると無効になります。
- `followup_context` (FollowupContextPolicy, optional, nullable) — フォローアップ通話に渡される `campaign__` 動的変数。

### PolicyConfig-Output

- `timezone` (string, optional, default: UTC) — 発信時間帯の解釈に使用するIANAタイムゾーン。
- `retry` (RetryPolicy, optional)
- `calling_periods` (list of CallingPeriod, optional) — 通話を発信できる曜日ごとの時間帯。
- `data_collection` (DataCollectionConfig, optional) — フォローアップ通話を制御するエージェントのデータ収集項目。各項目はデフォルトで 用途に応じた組み込み項目を使用し、`null`にすると無効になります。
- `followup_context` (FollowupContextPolicy, optional) — フォローアップ通話に渡される `campaign__` 動的変数。

### AgentPolicyOverride-Output

ここで設定した各セクションは、ポリシー内の対応するセクション全体を置き換えます。

- `timezone` (string, optional, nullable)
- `retry` (RetryPolicy, optional, nullable)
- `calling_periods` (list of CallingPeriod, optional, nullable)
- `data_collection` (DataCollectionConfig, optional, nullable) — フォローアップ通話を制御するエージェントのデータ収集項目。各項目はデフォルトで 用途に応じた組み込み項目を使用し、`null`にすると無効になります。
- `followup_context` (FollowupContextPolicy, optional, nullable) — フォローアップ通話に渡される `campaign__` 動的変数。

### ValidationErrorLocItems

- string
- integer

### RetryPolicy

- `retry_delay_seconds` (integer, optional, default: 600) — 短時間で再試行するまでの待機時間。
- `max_short_retries` (integer, optional, default: 1) — 通話に失敗した後、1つの発信時間帯内で許可される再試行回数。使い切ると、次の再試行は次回の発信時間帯まで待機し、その時間帯でカウントがリセットされます。
- `max_total_calls` (integer, optional, default: 6) — 初回を含め、1件のリードに発信する最大通話回数。
- `max_callbacks` (integer, optional, default: 2) — 1つの番号に対して受け付けるコールバックの最大回数。
- `max_redirects` (integer, optional, default: 2) — 別の番号への通話依頼に従う、リードごとの最大回数。
- `interval_placement` (enum, optional, default: start) — 延期された通話を後の発信可能時間帯のどこに設定するか。その時間帯の `start`、`random` な時刻、または同じ時間帯で前回の通話が失敗した時刻から `rotate_step_seconds` 後に `rotate` します。
  - Allowed values: `start`, `random`, `rotate`
- `rotate_step_seconds` (integer, optional, default: 900) — `rotate` 配置で通話ごとに移動する幅。`rotate` でのみ使用されます。
- `max_consecutive_failures_per_number` (integer, optional, nullable) — リードがリスト内の次の番号へ移るまで、または次の番号がなく終了するまでに、1つの番号への通話が連続して失敗できる回数です。通話への応答または新しい番号へのリダイレクトがあると、カウントはリセットされます。未設定の場合は`max_total_calls` のみが適用されます。

### CallingPeriod

- `weekdays` (list of integer, required) — 時間帯が適用される曜日。`0`（月曜日）から`6`（日曜日）までです。
- `intervals` (list of CallingIntervalPolicy, required) — 各曜日の時間帯。同じ曜日内で重複することはできません。

### DataCollectionConfig

フォローアップ通話を制御するエージェントのデータ収集項目。各項目はデフォルトで 用途に応じた組み込み項目を使用し、`null`にすると無効になります。

- `callback_time` (string, optional, nullable, default: __system_data_collection_callback_time) — 連絡先がコールバックを希望した日時を保持する項目。
- `redirect_phone_number` (string, optional, nullable, default: __system_data_collection_redirect_phone_number) — 連絡先が通話先として指定した別の番号を保持する項目。
- `stop` (string, optional, nullable, default: __system_data_collection_do_not_call) — 連絡先が今後の電話を拒否した場合にtrueになる項目。
- `mappings` (map from string to string, optional) — 後続の通話で使用できるよう、データ収集結果を動的変数にコピーします。各キーはデータ収集項目ID、値は変数名です。

### FollowupContextPolicy

フォローアップ通話に渡される `campaign__` 動的変数。

- `call_type` (boolean, optional, default: true) — 通話タイプを`campaign__call_type` として渡します。
- `previous_conversation_id` (boolean, optional, default: true) — 前回の会話IDを`campaign__previous_conversation_id` として渡します。
- `previous_summary` (boolean, optional, default: true) — 前回の会話の要約を`campaign__previous_summary` として渡します。
- `previous_transcript` (boolean, optional, default: true) — 前回の会話の文字起こしを`campaign__previous_transcript` として渡します。

### CallingIntervalPolicy

- `start` (string, required) — 現地時刻での開始時刻（`HH:MM`形式）。
- `end` (string, required) — 現地時刻での終了時刻（`HH:MM`形式）。`24:00`は深夜0時に終了します。

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "version": 1,
  "config": {
    "policy": {
      "timezone": "UTC",
      "retry": {
        "retry_delay_seconds": 600,
        "max_short_retries": 1,
        "max_total_calls": 6,
        "max_callbacks": 2,
        "max_redirects": 2,
        "interval_placement": "start",
        "rotate_step_seconds": 900,
        "max_consecutive_failures_per_number": 1
      },
      "calling_periods": [
        {
          "weekdays": [
            1
          ],
          "intervals": [
            {
              "start": "string",
              "end": "string"
            }
          ]
        }
      ],
      "data_collection": {
        "callback_time": "string",
        "redirect_phone_number": "string",
        "stop": "string",
        "mappings": {}
      },
      "followup_context": {
        "call_type": true,
        "previous_conversation_id": true,
        "previous_summary": true,
        "previous_transcript": true
      }
    },
    "agent_policies": {},
    "whatsapp_voice_policy": {
      "timezone": "string",
      "retry": {
        "retry_delay_seconds": 600,
        "max_short_retries": 1,
        "max_total_calls": 6,
        "max_callbacks": 2,
        "max_redirects": 2,
        "interval_placement": "start",
        "rotate_step_seconds": 900,
        "max_consecutive_failures_per_number": 1
      },
      "calling_periods": [
        {
          "weekdays": [
            1
          ],
          "intervals": [
            {
              "start": "string",
              "end": "string"
            }
          ]
        }
      ],
      "data_collection": {
        "callback_time": "string",
        "redirect_phone_number": "string",
        "stop": "string",
        "mappings": {}
      },
      "followup_context": {
        "call_type": true,
        "previous_conversation_id": true,
        "previous_summary": true,
        "previous_transcript": true
      }
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/outbound-campaigns/config"

payload = {}
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/outbound-campaigns/config';
const options = {method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{}'};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/outbound-campaigns/config"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Content-Type", "application/json")

	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/outbound-campaigns/config")

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

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

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.put("https://api.elevenlabs.io/v1/convai/outbound-campaigns/config")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.elevenlabs.io/v1/convai/outbound-campaigns/config', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/outbound-campaigns/config");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/outbound-campaigns/config")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```