---
title: "Update agent secrets"
method: PATCH
path: "/v2/agents/{agent_key}/secrets"
tags: ["Agent Secrets"]
---

# Update agent secrets

`PATCH /v2/agents/{agent_key}/secrets`

Updates the agent's secrets. Names present in the map are added or replaced. Names absent from the map are left unchanged.
A name mapped to `null` is removed.

## Path parameters

- `agent_key` string, required — A unique key that identifies an agent.

## Headers

- `Request-Timeout` integer
- `Request-Timeout-Millis` integer

## Request body

- UpdateAgentSecretsRequest — Request body that updates the agent's secrets. Names present in the map are added or replaced. Names absent from the map are left unchanged. A name mapped to `null` is removed. Secrets are stored encrypted at rest.
  - `secrets` object, required — Map of secret name to plaintext value (or `null` to remove). Names not in the map are left unchanged.

## Response `200`

The agent's secrets after the patch, with values masked.

- AgentSecrets — Agent-scoped secrets for the agent. On read, values are masked (`****`). Plaintext is never returned. Reference values from a tool's `argument_override` via `{"$ref": "agent.secrets.<name>"}`.
  - `secrets` object, required — Map of secret name to masked value.

## Other responses

- `400` — Invalid request.
- `403` — Permissions do not allow modifying this agent.
- `404` — Agent not found.

---

[API](https://skmtc.net/vectara/apis/vectara-rest-api-v2.md) · [All operations](https://skmtc.net/vectara/apis/vectara-rest-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vectara/vectara-rest-api-v2/revisions/fca567a46b3a/schema)
