# Delete kv — DELETE /v1/kv/{bucket}/{key}

URL: https://docs.hanzo.ai/docs/openapi/kv/delete-kv-by-bucket-by-key

> Removes one key — a delete marker in the key's history, so watchers see it and Get answers 404 — and answers 204 with no body.

`DELETE /v1/kv/{bucket}/{key}`

> [KV →](https://docs.hanzo.ai/docs/openapi/kv) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                             |
| ------------- | ------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/kv/{bucket}/{key}` |
| **Method**    | `DELETE`                                    |
| **Operation** | `delete_kv_by_bucket_by_key`                |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`      |

Removes one key — a delete marker in the key's history, so watchers
see it and Get answers 404 — and answers 204 with no body. 404 when the
bucket does not exist.

## Request

2 fields.

| Field    | In   | Type   | Required | Description                          |
| -------- | ---- | ------ | -------- | ------------------------------------ |
| `bucket` | path | string | yes      | Bucket is the bucket, from the path. |
| `key`    | path | string | yes      | Key is the key, from the path.       |

## Response

| Status    | Body            | Meaning    |
| --------- | --------------- | ---------- |
| `204`     | —               | no content |
| `default` | problem-details | refused    |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo kv bucket rm <bucket> <key>
```

**SDK**

**.ts**

```ts
import { Configuration, KvApi } from 'hanzoai';

const api = new KvApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.deleteKvByBucketByKey({ bucket: 'bucket', key: 'key' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import KvApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = KvApi(client).delete_kv_by_bucket_by_key(bucket='bucket', key='key')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.KvAPI.DeleteKvByBucketByKey(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, kv_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = kv_api::delete_kv_by_bucket_by_key(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KvApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new KvApi(client).deleteKvByBucketByKey();
```

**HTTP**

```bash
curl -X DELETE https://api.hanzo.ai/v1/kv/<bucket>/<key> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `kv`, op `delete_kv_by_bucket_by_key` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "kv",
         "arguments": {
           "op": "delete_kv_by_bucket_by_key",
           "input": {
             "bucket": "<bucket>",
             "key": "<key>"
           }
         }
       }
     }'
```

---

[KV API](https://docs.hanzo.ai/docs/openapi/kv) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
