# Update a secret set (/en/api-reference/api-ref/conversational-ai/platform/update-secret-set)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI API.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt).


Adds, changes, or removes several keys in a secret set in one change.

- OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml
- Operation ID: update-secret-set
- Method: PATCH
- Path: /v1/projects/{appid}/secrets/{name}
- Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name}

## Servers

- https://preview.ai.agora.io/conversational-ai

Use this endpoint to rotate keys that must change together. Pass a string to add or replace a key, or `null` to remove it. Keys you omit don't change. To change one key, [set the key](/en/api-reference/api-ref/conversational-ai/platform/set-secret-key) instead. To replace the whole set, use [Replace a secret set](/en/api-reference/api-ref/conversational-ai/platform/replace-secret-set).

Running sessions keep the values they resolved when they started. New sessions use the new values.


## Authorization

This endpoint requires authentication.

- `tokenAuth`
- `basicAuth`

## Parameters

- `appid` (path, required, string) - The App ID of your project.
- `name` (path, required, string) - The name of the secret set.
- `If-Match` (header, optional, string) - The `ETag` value from the most recent response for this resource. When you include it, the request fails with `412` and reason `PreconditionFailed` if the resource has changed since then. Use it to avoid overwriting a concurrent change.

## Request body

- `secrets` (object, required) - The keys to change. A string value adds the key, or replaces its value if the key exists. A `null` value removes the key. Keys you omit don't change.

### Request body example

```json
{
  "secrets": {
    "llm": "<your_new_llm_api_key>",
    "tts": "<your_new_tts_api_key>",
    "asr": null
  }
}
```

## Responses

### 200

The secret set was updated. The response body lists its keys.

- `name` (string, required) - The name of the secret set.
- `keys` (array, required) - The names of the keys in the set. Values are never returned.
  - `keys.items` (string)
- `create_ts` (integer, required) - The time the set was created, as a Unix timestamp in seconds.
- `update_ts` (integer, required) - The time the set was last updated, as a Unix timestamp in seconds.
### 401

Authentication is missing or invalid. The reason is `InvalidPermission`.

- `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead.
- `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes).
### 404

The resource in the path doesn't exist. The reason is `ResourceNotFound`.

- `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead.
- `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes).
### 409

`SecretSetInUse`: An agent references a key you're removing. `SecretSetEmpty`: The change would remove every key from the set.

- `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead.
- `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes).
### 412

The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`.

- `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead.
- `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes).
### default

The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes).

- `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead.
- `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes).
