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

- **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
- **2026-08-04** `8f5f4e537994` — 6 breaking, 6 warning, 12 info
  - the `errors/items/code` response's property type/format changed from `string`/`` to `integer`/`int32` for status `400`
  - the `errors/items/code` response's property type/format changed from `string`/`` to `integer`/`int32` for status `401`
  - the `errors/items/code` response's property type/format changed from `string`/`` to `integer`/`int32` for status `404`
  - the `errors/items/code` response's property type/format changed from `string`/`` to `integer`/`int32` for status `409`
  - …20 more
- **2026-07-23** `eb02d7e7280b` — 1 info
  - the endpoint scheme security `bearerAuth` was removed from the API
- **2026-07-03** `fb18962b46fa` — 1 breaking, 1 info
  - removed the media type `*/*` from the request body
  - added the media type `application/octet-stream` to the request body
- **2026-07-02** `224ed0d8a5c3` — 1 breaking, 1 info
  - removed the media type `application/octet-stream` from the request body
  - added the media type `*/*` to the request body

[Change 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-service-production.skmtc.workers.dev/v1/apis/team-telnyx/telnyx-api-2/revisions/3fdc16374d70/schema)
