Replace cached audio file
Replace the audio file for an existing cache entry. Send raw WAV bytes as the request body with Content-Type: audio/wav. Optionally include an X-Filename header to name the file, otherwise defaults to <entryId>.wav. Maximum file size is 6 MB.
PATCH
/
v1
/
agents
/
{agentId}
/
audio-cache
/
{entryId}
/
file
Replace cached audio file
curl --request PATCH \
--url https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file \
--header 'Content-Type: audio/wav' \
--header 'X-API-KEY: <api-key>' \
--data '"<string>"'import requests
url = "https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file"
payload = "<string>"
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "audio/wav"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'audio/wav'},
body: JSON.stringify('<string>')
};
fetch('https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode('<string>'),
CURLOPT_HTTPHEADER => [
"Content-Type: audio/wav",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file"
payload := strings.NewReader("\"<string>\"")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "audio/wav")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "audio/wav")
.body("\"<string>\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'audio/wav'
request.body = "\"<string>\""
response = http.request(request)
puts response.read_body{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}Last modified on June 9, 2026
Was this page helpful?
Previous
Replace audio and voice tuning settingsReplace both the audio file and voice tuning settings for a cache entry in a single request. Sent as `multipart/form-data` with a `file` part containing the WAV audio (max 6 MB) and a `settings` part containing a JSON object with `text` and `config` fields.
Next
⌘I
Replace cached audio file
curl --request PATCH \
--url https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file \
--header 'Content-Type: audio/wav' \
--header 'X-API-KEY: <api-key>' \
--data '"<string>"'import requests
url = "https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file"
payload = "<string>"
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "audio/wav"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'audio/wav'},
body: JSON.stringify('<string>')
};
fetch('https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode('<string>'),
CURLOPT_HTTPHEADER => [
"Content-Type: audio/wav",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file"
payload := strings.NewReader("\"<string>\"")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "audio/wav")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "audio/wav")
.body("\"<string>\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us.poly.ai/v1/agents/{agentId}/audio-cache/{entryId}/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'audio/wav'
request.body = "\"<string>\""
response = http.request(request)
puts response.read_body{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}{
"success": false,
"error": "<string>",
"error_id": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"data": "<unknown>"
}
