---
title: "Replace cached audio file"
method: PATCH
path: "/v1/agents/{agentId}/audio-cache/{entryId}/file"
tags: ["Audio Cache"]
---

# Replace cached audio file

`PATCH /v1/agents/{agentId}/audio-cache/{entryId}/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.

## Headers

- `X-Filename` string

## Response `204`

Audio file replaced

## Other responses

- `400` — Invalid request. Returned when the request body is empty, the file exceeds the 6 MB limit, or `entryId` is not a numeric ID.
- `401` — Unauthorized – missing or invalid API key
- `403` — Forbidden – the API key does not have `write` permission on the audio cache resource
- `404` — Resource not found

---

[API](https://skmtc.net/poly/apis/polyai-agents-api.md) · [All operations](https://skmtc.net/poly/apis/polyai-agents-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/poly/polyai-agents-api/versions/76f3c606e395/schema)
