Using
Inserts or updates a value for the given key (upsert semantics). The optional `ttl` query parameter sets an expiry in seconds; omitting it stores the key indefinitely. `If-Match` (an ETag from a prior read) or `If-None-Match: *` (create only) make the write conditional; without them the last writer wins.
applies to v0.5.1PUT
/store-api/kv/{domain}/keys/{key}
const url = 'https://example.com/store-api/kv/example/keys/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'text/plain'}, body: 'example'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/store-api/kv/example/keys/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: text/plain' \ --data exampleAuthorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”domain
required
string
Domain name
key
required
string
Key (valid UTF-8, max 256 bytes)
Query Parameters
Section titled “Query Parameters”ttl
integer format: int64
TTL in seconds (optional)
Header Parameters
Section titled “Header Parameters”If-Match
string | null
ETag from a prior read: write only if it is still the key’s current version, else 412
If-None-Match
string | null
Only *: write only if the key does not exist, else 412. Evaluated after If-Match
Request Bodyrequired
Section titled “Request Bodyrequired”Media typetext/plain
string
Responses
Section titled “Responses”Key upserted
Invalid key, or invalid If-Match / If-None-Match header
Media typetext/plain
string
Domain not found
Media typetext/plain
string
Domain is being deleted
Media typetext/plain
string
If-Match or If-None-Match does not hold; nothing was written
Media typetext/plain
string
Headers
Section titled “Headers”ETag
string
ETag of the key’s current version; absent when the key does not exist
The domain requires conditional writes and neither If-Match nor If-None-Match is set
Media typetext/plain
string
Headers
Section titled “Headers”Cache-Control
string
No-store
Rate limit exceeded
Media typetext/plain
string
Headers
Section titled “Headers”Retry-After
integer format: int64
Insufficient Storage — disk space or memory runs short; the write was not applied. Reads go on; retry after the seconds in Retry-After.
Media typetext/plain
string
Headers
Section titled “Headers”Retry-After
integer