Insert an item into an kv store

PUT {{fastly_url}}/resources/stores/kv/{{store_id}}/keys/{{key_name}}?add&append&background_fetch&prepend

Set a new value for a new or existing key in an kv store.

Authorization: API token with at least Engineer permissions.

Request Params

KeyDatatypeRequiredDescription
addnullEnsures the request will only succeed if the key doesn't already exist (shortcut equivalent for using the if-generation-match header with a value of 0).
appendnullUpdates the contents of a key by appending the body of the request to the existing key's contents. If the specified key does not exist, a new key is created.
background_fetchnullIf set to true, allows fetching from the origin to occur in the background, enabling a faster response with stale content. The cache will be updated with fresh content after the request is completed.
prependnullUpdates the contents of a key by prepending the body of the request onto the existing key's contents. If the specified key does not exist, a new key is created.

HEADERS

KeyDatatypeRequiredDescription
if-generation-matchnullRequests for keys will return a 'generation' header specific to the version of a key. The generation header is a unique, non-serial 32-bit integer that can be used for testing against a specific KV store value.
metadatanullAn arbitrary data field which can contain up to 2000B of data.
time_to_live_secnullSets a time for the key to expire. Deletion will take place up to 24 hours after the ttl reaches 0.