> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.agentphone.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.agentphone.ai/_mcp/server.

# Update Agent

PATCH https://api.agentphone.ai/v1/agents/{agent_id}
Content-Type: application/json

Update an agent's configuration.

Use this to change voice mode, system prompt, greeting, or voice.
Switching voiceMode to "hosted" re-provisions the voice agent with built-in LLM.

Reference: https://docs.agentphone.ai/api-reference/agents/update-agent-v-1-agents-agent-id-patch

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `agent_id` (string, required)

### Headers

- `X-Sub-Account-Id` (string, optional) — Target a sub-account. Pass a sub-account ID to scope this request. Omit to use the master account.

### Body (application/json)

This endpoint expects an UpdateAgentRequest.

- `name` (string, optional, nullable)
- `description` (string, optional, nullable)
- `voiceMode` (enum, optional)
  - Allowed values: `webhook`, `hosted`
- `enableMessaging` (boolean, optional, nullable) — When true, hosted-mode agents can send and read SMS/iMessage during calls.
- `modelTier` (enum, optional)
  - Allowed values: `turbo`, `balanced`, `max`
- `systemPrompt` (string, optional, nullable)
- `beginMessage` (string, optional, nullable)
- `voice` (string, optional, nullable)
- `transferNumber` (string, optional, nullable)
- `customTools` (list of CustomToolParam, optional, nullable) — Hosted-mode only. User-defined function tools the agent can call during a call. Replaces the full set on each update; send [] to clear all tools, or omit to leave unchanged. Ignored in webhook mode. Maximum 20 tools.
- `voicemailMessage` (string, optional, nullable)
- `callScreeningIdentity` (string, optional, nullable)
- `callScreeningPurpose` (string, optional, nullable)
- `sttMode` (enum, optional) — Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency).
  - Allowed values: `fast`, `accurate`
- `ambientSound` (enum, optional) — Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed.
  - Allowed values: `none`, `office`, `coffee-shop`, `outdoor`
- `denoisingMode` (enum, optional) — Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs.
  - Allowed values: `noise-cancellation`, `noise-and-background-speech-cancellation`
- `maxSilenceMs` (integer, optional, nullable) — Hang up the call after this many milliseconds of caller silence. Default 600000 (10 min). Raise for IVR/hold-music workflows; lower to fail fast on dead lines. Range 10000 (10s) to 3600000 (1 hour).
- `voiceSpeed` (double, optional, nullable) — Voice speed multiplier. 1.0 is normal pace; lower slows speech (0.5 is half speed), higher speeds it up (2.0 is double). Range 0.5 to 2.0.
- `interruptionSensitivity` (double, optional, nullable) — How easily callers can interrupt the agent. 0 means the agent is never interrupted, 1 means the agent stops at the first sound. Default 0.8. Range 0.0 to 1.0.
- `enableBackchannel` (boolean, optional, nullable) — When true, the agent interjects short filler words like 'uh-huh' or 'mhmm' during longer caller utterances. Set false to keep the agent silent while the caller is speaking.
- `language` (enum, optional) — BCP-47 locale that drives the agent's speech recognition and pronunciation. See the enum for the full set of supported codes.
  - Allowed values: `af-ZA`, `ar-SA`, `az-AZ`, `bg-BG`, `bs-BA`, `ca-ES`, `cs-CZ`, `cy-GB`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-GB`, `en-IN`, `en-NZ`, `en-US`, `es-419`, `es-ES`, `fa-IR`, `fi-FI`, `fil-PH`, `fr-CA`, `fr-FR`, `gl-ES`, `he-IL`, `hi-IN`, `hr-HR`, `hu-HU`, `hy-AM`, `id-ID`, `is-IS`, `it-IT`, `ja-JP`, `kk-KZ`, `kn-IN`, `ko-KR`, `lt-LT`, `lv-LV`, `mk-MK`, `mr-IN`, `ms-MY`, `ne-NP`, `nl-BE`, `nl-NL`, `no-NO`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sl-SI`, `sr-RS`, `sv-SE`, `sw-KE`, `ta-IN`, `th-TH`, `tr-TR`, `uk-UA`, `ur-IN`, `vi-VN`, `yue-CN`, `zh-CN`

## Response

### 200

Successful Response

- `id` (string, required)
- `name` (string, required)
- `description` (string, required, nullable)
- `voiceMode` (enum, required)
  - Allowed values: `webhook`, `hosted`
- `voice` (string, required)
- `createdAt` (datetime, required)
- `enableMessaging` (boolean, optional, default: true)
- `modelTier` (enum, optional, default: balanced)
  - Allowed values: `turbo`, `balanced`, `max`
- `systemPrompt` (string, optional, nullable)
- `beginMessage` (string, optional, nullable)
- `transferNumber` (string, optional, nullable)
- `customTools` (list of AgentResponseCustomToolsItems, optional, nullable)
- `voicemailMessage` (string, optional, nullable)
- `callScreeningIdentity` (string, optional, nullable)
- `callScreeningPurpose` (string, optional, nullable)
- `sttMode` (enum, optional, default: fast) — Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency).
  - Allowed values: `fast`, `accurate`
- `ambientSound` (enum, optional, default: none) — Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed.
  - Allowed values: `none`, `office`, `coffee-shop`, `outdoor`
- `denoisingMode` (enum, optional, default: noise-cancellation) — Audio denoising. 'noise-cancellation' (default) handles general noise. 'noise-and-background-speech-cancellation' is more aggressive for callers in cars, cafes, or near TVs.
  - Allowed values: `noise-cancellation`, `noise-and-background-speech-cancellation`
- `maxSilenceMs` (integer, optional, default: 600000) — Hang up the call after this many milliseconds of caller silence. Range 10000 (10s) to 3600000 (1 hour). Default 600000 (10 min).
- `voiceSpeed` (double, optional, default: 1) — Voice speed multiplier. Range 0.5 to 2.0. Default 1.0.
- `interruptionSensitivity` (double, optional, default: 0.8) — How easily callers can interrupt the agent. Range 0.0 to 1.0. Default 0.8.
- `enableBackchannel` (boolean, optional, default: true) — When true, the agent interjects short filler words like 'uh-huh' or 'mhmm' during longer caller utterances. Defaults to true.
- `language` (string, optional, default: en-US) — BCP-47 locale that drives the agent's speech recognition and pronunciation. Defaults to 'en-US'.
- `numbers` (list of AgentNumberResponse, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CustomToolParam

- `name` (string, required) — Function name the agent calls. Letters, numbers, underscores, hyphens; max 64 chars. Must be unique and not a reserved built-in name.
- `description` (string, required) — What the tool does and when to use it. The agent relies on this to decide when to call it.
- `url` (string, required) — HTTPS endpoint the voice provider calls when the agent invokes this tool.
- `method` (enum, optional) — HTTP method. Defaults to POST.
  - Allowed values: `GET`, `POST`
- `headers` (map from string to string, optional, nullable) — Optional HTTP headers sent with the request (e.g. an Authorization token for your endpoint).
- `parameters` (CustomToolParamParameters, optional, nullable) — JSON Schema object describing the arguments the agent fills in. Omit for a no-argument tool.
- `timeoutMs` (integer, optional, nullable) — How long to wait for your endpoint before giving up. Range 1000-120000 ms.
- `speakDuringExecution` (boolean, optional, nullable) — When true, the agent speaks executionMessage while the tool runs.
- `executionMessage` (string, optional, nullable) — What the agent says while the tool runs (used when speakDuringExecution is true).

### AgentResponseCustomToolsItems

### AgentNumberResponse

- `id` (string, required)
- `phoneNumber` (string, required)
- `status` (string, required)
- `type` (string, optional, default: sms)

### ValidationError

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

### CustomToolParamParameters

JSON Schema object describing the arguments the agent fills in. Omit for a no-argument tool.

### ValidationErrorLocItems

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "voiceMode": "webhook",
  "voice": "string",
  "createdAt": "2024-01-15T09:30:00Z",
  "enableMessaging": true,
  "modelTier": "balanced",
  "systemPrompt": "string",
  "beginMessage": "string",
  "transferNumber": "string",
  "customTools": [
    {}
  ],
  "voicemailMessage": "string",
  "callScreeningIdentity": "string",
  "callScreeningPurpose": "string",
  "sttMode": "fast",
  "ambientSound": "none",
  "denoisingMode": "noise-cancellation",
  "maxSilenceMs": 600000,
  "voiceSpeed": 1,
  "interruptionSensitivity": 0.8,
  "enableBackchannel": true,
  "language": "en-US",
  "numbers": [
    {
      "id": "string",
      "phoneNumber": "string",
      "status": "string",
      "type": "sms"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.agentphone.ai/v1/agents/agent_id"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.agentphone.ai/v1/agents/agent_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', '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.agentphone.ai/v1/agents/agent_id"

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

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

	req.Header.Add("Authorization", "Bearer <token>")
	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.agentphone.ai/v1/agents/agent_id")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
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.patch("https://api.agentphone.ai/v1/agents/agent_id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.agentphone.ai/v1/agents/agent_id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.agentphone.ai/v1/agents/agent_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentphone.ai/v1/agents/agent_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```