> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

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



## OpenAPI

````yaml PATCH /v1/agents/{agentId}/audio-cache/{entryId}/file
openapi: 3.1.0
info:
  title: PolyAI Agents API
  version: 1.0.11
  description: Manage PolyAI agents, telephony, deployments, and real-time configs.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.eu.poly.ai
    description: EU region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.studio.poly.ai
    description: Studio region
security:
  - polyApiKey: []
paths:
  /v1/agents/{agentId}/audio-cache/{entryId}/file:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
      - name: entryId
        in: path
        required: true
        schema:
          type: string
        description: Audio cache entry ID
    patch:
      tags:
        - Audio Cache
      summary: Replace cached audio file
      description: >-
        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.
      parameters:
        - name: X-Filename
          in: header
          required: false
          schema:
            type: string
          description: Optional filename for the uploaded audio. Defaults to <entryId>.wav.
      requestBody:
        required: true
        content:
          audio/wav:
            schema:
              type: string
              format: binary
      responses:
        '204':
          description: Audio file replaced
        '400':
          description: >-
            Invalid request. Returned when the request body is empty, the file
            exceeds the 6 MB limit, or `entryId` is not a numeric ID.
        '401':
          description: Unauthorized – missing or invalid API key
        '403':
          description: >-
            Forbidden – the API key does not have `write` permission on the
            audio cache resource
        '404':
          description: Resource not found
components:
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````