# Delete a secret key (/en/api-reference/api-ref/conversational-ai/platform/delete-secret-key)

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


Removes a key from a secret set.

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

## Servers

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

You can't remove a key that an agent references. A secret set must also keep at least one key. To remove the last key, [delete the set](/en/api-reference/api-ref/conversational-ai/platform/delete-secret-set) instead.


## 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.
- `key` (path, required, string) - 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 `_`.
- `If-Match` (header, optional, string) - The key's `ETag` from your last write to it. The request fails with `412` if the key has changed since then.

## Request body

No request body.

## Responses

### 200

The key was removed.

- `deleted` (boolean, required) - Always `true`. The resource is deleted.
### 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 the key. `SecretSetEmpty`: The key is the last key in 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).
