Set a secret key

Updated

Adds a key to a secret set, or replaces the value of an existing key.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.
PUT
https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name}/keys/{key}

Use this endpoint to add or rotate one key without sending the set's other values. Repeating the request is safe. Agents keep referencing $secrets.<set>.<key> without changes, and new sessions use the new value.

The response returns 201 when the key is new and 200 when it replaces an existing value. Both headers are optional. Without them, the last write to the key wins.

Path Parameters

appidstring
Required

The App ID of your project.

namestring
Required

The name of the secret set.

keystring
Required

The name of the key in the secret set. When you add a key, use 1 to 64 characters from A-Z, a-z, 0-9, and _.

Header Parameters

If-Matchstring

The key's ETag from your last write to it. The request fails with 412 if the key has changed since then.

If-None-Matchstring

Set to * to create the key only if it doesn't exist. If the key exists, the request fails with 412, so a live value is never overwritten by accident.

Request Body

valuestring
Required

The secret value. It is write-only and is never returned. The whole set, including this value, can hold at most 64 KiB.

Response Body

The key's value was replaced.

Response Headers

Agora-Request-Idstring

A unique ID for the request. Include it when you contact Agora support.

ETagstring

The current version of the resource. Pass this value in the If-Match header of your next update or delete request for this resource.

keystring
Required

The name of the key.

Authorization

This endpoint requires authentication.

Request examples

Example Request
curl -X PUT 'https://preview.ai.agora.io/conversational-ai/v1/projects/string/secrets/string/keys/string' \  -H 'Content-Type: application/json' \  -d '{  "value": "<your_new_llm_api_key>"}'

Response example

Example Response
{  "key": "llm"}