> ## Documentation Index
> Fetch the complete documentation index at: https://polyai-mintlify-7055a538.mintlify.site/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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized – missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Forbidden – the API key does not have `write` permission on the
            audio cache resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      description: Standard PolyAI API error envelope.
      required:
        - success
        - error
        - error_id
        - error_code
        - error_message
        - data
      properties:
        success:
          type: boolean
          description: Always false for error responses.
          example: false
        error:
          type: string
          description: Human-readable error message.
        error_id:
          type: string
          description: >-
            Unique request identifier from the X-PolyAI-Correlation-Id header.
            Include this when contacting support.
        error_code:
          type: string
          description: Machine-readable error code in UPPER_SNAKE_CASE.
        error_message:
          type: string
          description: Human-readable error message.
        data:
          nullable: true
          description: Always null for error responses.
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````