---
title: "Set a key's value"
method: PUT
path: "/storage/kvs/{id}/keys/{key}"
tags: ["kv keys"]
---

# Set a key's value

`PUT /storage/kvs/{id}/keys/{key}`

## Request

- Base URL: `https://api.telnyx.com/v2`
- URL: `https://api.telnyx.com/v2/storage/kvs/{id}/keys/{key}`
- Auth: HTTP bearer

Creates or replaces the value for a key. The request body is stored verbatim as the value — no base64, no JSON envelope — up to 1 MiB. The request's `Content-Type` header is stored with the value and echoed back on retrieval. Returns `201` when the key is created and `200` when an existing key is updated.

## Path parameters

- `id` string, uuid, required
- `key` string, required

## Query parameters

- `ttl_secs` integer

## Request body `application/octet-stream`

- string, binary: Raw value bytes, stored verbatim.

## Response `200`

Key updated

## Other responses

- `201`: Key created
- `400`: Bad request — invalid `id`, key name, or request body
- `401`: Unauthorized
- `404`: KV namespace not found
- `409`: Conflict — the namespace is not ready (`status` is not `provision_ok`), or `ttl_secs` was set on a namespace without TTL support
- `413`: Payload too large — the value exceeds 1 MiB
- `422`: Unprocessable entity — `ttl_secs` is not a positive integer within range, or the unsupported `ttl` parameter was used
- `500`: Internal server error

## Changes

- **2026-10-21** `67df31283a8a`: 6 breaking, 6 info
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `400`
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `401`
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `404`
  - the `errors/items/code` response's property type changed from `integer` to `string`, and format from `int32` to no format for status `409`
  - …8 more
- **2026-10-15** `a72569d69430`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api/changes/storage/kvs/:id/keys/:key/put.md)

---

[API](https://skmtc.dev/team-telnyx/apis/telnyx-api.md) - [All operations](https://skmtc.dev/team-telnyx/apis/telnyx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/team-telnyx/apis/telnyx-api/revisions/0f17b8167873?raw)
