Set a key's value
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
KV namespace ID
Key name. Allowed characters: a-z A-Z 0-9 - _ / = .; maximum 256 characters; names starting with _ are reserved for system use. May contain /. When calling the HTTP API directly, URL-encode the key so the whole string is treated as one key (for example user/1 -> user%2F1). SDK users should pass the key raw - SDKs URL-encode path parameters automatically.
Query parameters
Time-to-live in seconds. When set, the key expires and is deleted after this duration. Requires a namespace provisioned with TTL support; namespaces without it return a 409.
Response
Key updated
Changes
Changed in 5 of the 61 revisions of this API.26621
- ▲
the response property
errors/items/codebecame optional for the status400response-property-became-optional
- ▲
the response property
errors/items/codebecame optional for the status401response-property-became-optional
- ▲
the response property
errors/items/codebecame optional for the status404response-property-became-optional
- ▲
the response property
errors/items/codebecame optional for the status409response-property-became-optional
- ▲
the response property
errors/items/codebecame optional for the status413response-property-became-optional
- ▲
the response property
errors/items/codebecame optional for the status422response-property-became-optional
- ▲
the response property
errors/items/titlebecame optional for the status400response-property-became-optional
- ▲
the response property
errors/items/titlebecame optional for the status401response-property-became-optional
- ▲
the response property
errors/items/titlebecame optional for the status404response-property-became-optional
- ▲
the response property
errors/items/titlebecame optional for the status409response-property-became-optional
- ▲
the response property
errors/items/titlebecame optional for the status413response-property-became-optional
- ▲
the response property
errors/items/titlebecame optional for the status422response-property-became-optional
- ▲
the
errors/items/coderesponse's property type/format changed frominteger/int32tostring/for status400response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed frominteger/int32tostring/for status401response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed frominteger/int32tostring/for status404response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed frominteger/int32tostring/for status409response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed frominteger/int32tostring/for status413response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed frominteger/int32tostring/for status422response-property-type-changed
- ○
added the optional property
errors/items/meta/urlto the response with the400statusresponse-optional-property-added
- ○
added the optional property
errors/items/meta/urlto the response with the401statusresponse-optional-property-added
- ○
added the optional property
errors/items/meta/urlto the response with the404statusresponse-optional-property-added
- ○
added the optional property
errors/items/meta/urlto the response with the409statusresponse-optional-property-added
- ○
added the optional property
errors/items/meta/urlto the response with the413statusresponse-optional-property-added
- ○
added the optional property
errors/items/meta/urlto the response with the422statusresponse-optional-property-added
This revision also has 64 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲
- ▲
the
errors/items/coderesponse's property type/format changed fromstring/tointeger/int32for status400response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed fromstring/tointeger/int32for status401response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed fromstring/tointeger/int32for status404response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed fromstring/tointeger/int32for status409response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed fromstring/tointeger/int32for status413response-property-type-changed
- ▲
the
errors/items/coderesponse's property type/format changed fromstring/tointeger/int32for status422response-property-type-changed
- ●
removed the optional property
errors/items/meta/urlfrom the response with the400statusresponse-optional-property-removed
- ●
removed the optional property
errors/items/meta/urlfrom the response with the401statusresponse-optional-property-removed
- ●
removed the optional property
errors/items/meta/urlfrom the response with the404statusresponse-optional-property-removed
- ●
removed the optional property
errors/items/meta/urlfrom the response with the409statusresponse-optional-property-removed
- ●
removed the optional property
errors/items/meta/urlfrom the response with the413statusresponse-optional-property-removed
- ●
removed the optional property
errors/items/meta/urlfrom the response with the422statusresponse-optional-property-removed
- ○
the response property
errors/items/codebecame required for the status400response-property-became-required
- ○
the response property
errors/items/codebecame required for the status401response-property-became-required
- ○
the response property
errors/items/codebecame required for the status404response-property-became-required
- ○
the response property
errors/items/codebecame required for the status409response-property-became-required
- ○
the response property
errors/items/codebecame required for the status413response-property-became-required
- ○
the response property
errors/items/codebecame required for the status422response-property-became-required
- ○
the response property
errors/items/titlebecame required for the status400response-property-became-required
- ○
the response property
errors/items/titlebecame required for the status401response-property-became-required
- ○
the response property
errors/items/titlebecame required for the status404response-property-became-required
- ○
the response property
errors/items/titlebecame required for the status409response-property-became-required
- ○
the response property
errors/items/titlebecame required for the status413response-property-became-required
- ○
the response property
errors/items/titlebecame required for the status422response-property-became-required
This revision also has 41 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲
- ○
the endpoint scheme security
bearerAuthwas removed from the APIapi-security-removed
- ○
- ▲
removed the media type
*/*from the request bodyrequest-body-media-type-removed
- ○
added the media type
application/octet-streamto the request bodyrequest-body-media-type-added
- ▲
- ▲
removed the media type
application/octet-streamfrom the request bodyrequest-body-media-type-removed
- ○
added the media type
*/*to the request bodyrequest-body-media-type-added
This revision also has 111 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲