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.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
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 /; URL-encode it so the whole string is treated as one key (for example user/1 -> user%2F1).
256^[-/_=.a-zA-Z0-9]+$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.
1 <= x <= 9223372036Body
The value to store, sent as the raw request body. Maximum size: 1 MiB (1048576 bytes).
Raw value bytes, stored verbatim.
Response
Key updated