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

# Update an agent secret's value

> Replaces the value of an existing secret in the Matillion Hosted Customer Vault (MHCV) associated with the given Agent, in place. The secret is identified by `name` in the request body. The secret must already exist: an unknown name returns 404 and nothing is created. The new value replaces the whole stored value, fields are not merged. Resolver references and the connections that use the secret are unaffected, so a rotated value is picked up without modifying them.

Supported only for Maia Hosted Runners. Matillion does not change secrets held in customer-hosted secret managers (AWS, Azure, Snowflake, GCP), so if `agentId` identifies a customer-hosted runner the request is not supported: rotate the secret directly in your own secret manager instead.



## OpenAPI

````yaml /openapi/public-api-endpoint-reference.yaml patch /v1/agents/{agentId}/secrets
openapi: 3.1.0
info:
  title: Maia Public REST API
  version: '1.0'
servers:
  - description: EU1
    url: https://eu1.api.matillion.com/dpc
  - description: US1
    url: https://us1.api.matillion.com/dpc
  - description: AU1
    url: https://au1.api.matillion.com/dpc
  - description: EU2
    url: https://eu2.api.matillion.com/dpc
security:
  - bearerAuth: []
tags:
  - description: Operations for managing Project Variables
    name: Project Variables
  - description: Manage Pipelines
    name: Pipelines
  - description: >-
      Describe how to configure a connection for a given auth provider, auth
      type and platform connection type.
    name: Connection Schema
  - description: Manage your AI agent tasks
    name: AI Agent Tasks
  - description: SCIM endpoints for user/group permission management
    name: Directory Integration
  - description: Manage Artifacts
    name: Artifacts
  - description: Manage Streaming Pipelines
    name: Streaming Pipelines
  - description: ''
    name: Projects
  - description: Connector Profiles
    name: Connectors
  - description: >-
      Validate Matillion resources against the Vanguard validation framework.
      Pipeline resource files (orchestration, transformation, test) are the only
      supported resource type today; support for additional resource types (e.g.
      SQL scripts or Python source files) is anticipated in future.
    name: Resource Validation
  - description: Manage Schedules
    name: Schedules
  - description: Manage Connections
    name: Connections
  - description: Review pipelines against quality rules
    name: Pipeline Quality Review
  - description: Execute tests within a project
    name: Test Execution
  - description: Publish shared pipeline artifacts
    name: Shared Pipeline Artifacts
  - description: Manage Repositories
    name: Repositories
  - description: Report on Credit Consumption
    name: Consumption
  - description: >-
      Start and track the migration of a Git repository into a project's working
      tree.
    name: Repository Migration
  - description: Operations for data lineage and governance
    name: Data Lineage
  - description: Manage Runners
    name: Runners
  - description: Execute a pipeline
    name: Pipeline Execution
  - description: ''
    name: Environments
  - description: Operations for managing Environment-level Overrides of Project Variables
    name: Project Variable Environment Overrides
  - description: Manage secrets stored in an Agent's Matillion-hosted vault.
    name: Agent Secrets
  - description: Query audit events
    name: Audit Events
paths:
  /v1/agents/{agentId}/secrets:
    patch:
      tags:
        - Agent Secrets
      summary: Update an agent secret's value
      description: >-
        Replaces the value of an existing secret in the Matillion Hosted
        Customer Vault (MHCV) associated with the given Agent, in place. The
        secret is identified by `name` in the request body. The secret must
        already exist: an unknown name returns 404 and nothing is created. The
        new value replaces the whole stored value, fields are not merged.
        Resolver references and the connections that use the secret are
        unaffected, so a rotated value is picked up without modifying them.


        Supported only for Maia Hosted Runners. Matillion does not change
        secrets held in customer-hosted secret managers (AWS, Azure, Snowflake,
        GCP), so if `agentId` identifies a customer-hosted runner the request is
        not supported: rotate the secret directly in your own secret manager
        instead.
      operationId: updateSecret
      parameters:
        - description: The ID of the agent whose vault the secrets are stored in.
          in: path
          name: agentId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSecretRequest'
        required: true
      responses:
        '204':
          description: The secret's value was replaced.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Invalid request
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: >-
            No secret with that name exists for the agent, or the agent has no
            certificate to encrypt the value for. The response detail says
            which. Nothing is created.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: >-
            The secret was modified concurrently by another request. Retry the
            update.
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unexpected error occurred
        '504':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Gateway timeout
components:
  schemas:
    UpdateSecretRequest:
      type: object
      properties:
        name:
          type: string
          description: >-
            The name of the existing secret whose value is replaced. Used
            exactly as given.
          example: my-secret
          minLength: 1
        value:
          $ref: '#/components/schemas/JsonNode'
          description: >-
            The new secret value, as a JSON object. It replaces the whole stored
            value.
          example:
            password: P@ssw0rd123
      required:
        - name
        - value
    ProblemDetail:
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
        status:
          type: integer
          format: int32
        title:
          type: string
        type:
          type: string
          format: uri
        violations:
          type: array
          items:
            type: string
    JsonNode: {}
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: a valid bearer token
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.