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

# Update a secret

> Update a secret's value. Value is a required parameter and will always replace the existing value

## Rotation

This is the endpoint to call for credential rotation. The new value takes effect immediately for every function and agent that reads this secret. There's no staged or per-consumer rollout.

<Note>
  Secrets are looked up by `secretName` within the account (workspace), the same scoping as [Create a secret](/api-reference/agents/endpoint/secrets/create-a-secret). A 404 means no secret with this name exists in the account, not that it exists under a different agent.
</Note>

<Warning>
  There is no grace period. As soon as this call succeeds, any function or integration still using the old value will fail until it is updated with the new one.
</Warning>


## OpenAPI

````yaml PUT /v1/agents/{agentId}/secrets/{secretName}
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}/secrets/{secretName}:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
      - name: secretName
        in: path
        required: true
        schema:
          type: string
    put:
      tags:
        - Secrets
      summary: Update a secret
      description: >-
        Update a secret's value. Value is a required parameter and will always
        replace the existing value
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSecretBody'
      responses:
        '200':
          description: Updated secret
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretResponse'
components:
  schemas:
    UpdateSecretBody:
      type: object
      properties:
        value:
          type: string
          minLength: 1
          description: New secret value
        description:
          type: string
          description: Description of the secret (unchanged if omitted)
      required:
        - value
      additionalProperties: false
      title: UpdateSecretBody
    SecretResponse:
      type: object
      properties:
        name:
          type: string
          description: Display name of the secret
        description:
          type: string
          description: Description of the secret
        createdAt:
          type: string
          description: ISO 8601 timestamp of creation
        lastUpdated:
          description: ISO 8601 timestamp of last update
          type: string
      required:
        - name
      additionalProperties: false
      title: SecretResponse
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````