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

# Prewarm browser voice for an agent

POST https://api.runtype.com/v1/client/agents/{agentId}/voice/prewarm

Signals intent to start a browser voice call (for example, the pointer entered the microphone button) so the WebSocket connect and first turn find warm state. Authenticated exactly like `/agents/{agentId}/speak`: send the client token as `Authorization: Bearer ct_…`; the token agent allowlist and origin allowlist apply. Returns 204 as soon as the caller is authenticated and warms in the background. The call never bills, reserves quota, or meters usage. Warming is rate-limited per client token and agent; a limited call still returns 204 and does nothing.

Reference: https://docs.runtype.com/api-reference/runtype-api/client-runtime/prewarm-browser-voice-for-an-agent

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Path parameters

- `agentId` (string, required) — The voice-enabled agent the call will open.

### Query parameters

- `sessionId` (string, optional) — The client session the call will resume, when the host already has one.

### Headers

- `x-visitor-token` (string, optional) — The visitor proof the call will present, sent the same way the voice WebSocket accepts it.

## Response

### 204

Accepted. Warming, if admitted, continues in the background.

## Errors

### 401 Unauthorized Error

Missing or invalid client token, agent not allowed for the token, or origin not allowed

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 404 Not Found Error

Malformed agent id

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

## Types

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

## Examples

**SDK Code**

```python
import requests

url = "https://api.runtype.com/v1/client/agents/agentId/voice/prewarm"

response = requests.post(url)

print(response.json())
```

```javascript
const url = 'https://api.runtype.com/v1/client/agents/agentId/voice/prewarm';
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.runtype.com/v1/client/agents/agentId/voice/prewarm"

	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.runtype.com/v1/client/agents/agentId/voice/prewarm")

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.runtype.com/v1/client/agents/agentId/voice/prewarm")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/client/agents/agentId/voice/prewarm');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/client/agents/agentId/voice/prewarm");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/client/agents/agentId/voice/prewarm")! 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()
```