---
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}`

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

## 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

> 72 revisions in range; 1 not diffed.

- **2026-09-16** `a6a61a29ecdd` — 6 breaking, 6 warning, 12 info
  - the `errors/items/code` response's property type changed from `string` to `integer`, and format from no format to `int32` for status `400`
  - the `errors/items/code` response's property type changed from `string` to `integer`, and format from no format to `int32` for status `401`
  - the `errors/items/code` response's property type changed from `string` to `integer`, and format from no format to `int32` for status `404`
  - the `errors/items/code` response's property type changed from `string` to `integer`, and format from no format to `int32` for status `409`
  - …20 more
- **2026-08-17** `1571b0380bd7` — 18 breaking, 6 info
  - the response property `errors/items/code` became optional for the status `400`
  - the response property `errors/items/code` became optional for the status `401`
  - the response property `errors/items/code` became optional for the status `404`
  - the response property `errors/items/code` became optional for the status `409`
  - …20 more
- …earlier changes not shown

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

---

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