WorkerWorkers Kv Namespace

Write multiple key-value pairs

PUT

Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither expiration nor expiration_ttl is specified, the key-value pair will never expire. If both are set, expiration_ttl is used and expiration is ignored. The entire request size must be 100 megabytes or less.

Path parameters

namespace_identifierstringRequired
Namespace identifier tag.
account_identifierstringRequired
Identifier

Request

This endpoint expects a list of objects.
base64
booleanOptional
Whether or not the server should base64 decode the value before storing it. Useful for writing values that wouldn't otherwise be valid JSON strings, such as images.
expiration
doubleOptional
The time, measured in number of seconds since the UNIX epoch, at which the key should expire.
expiration_ttl
doubleOptional
The number of seconds for which the key should be visible before it expires. At least 60.
key
stringOptional
A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid.
metadata
map from strings to anyOptional
Arbitrary JSON that is associated with a key.
value
stringOptional
A UTF-8 encoded string to be stored, up to 25 MiB in length.

Response

This endpoint returns an object
result
unionOptional
PUT
1curl -X PUT https://api.cloudflare.com/client/v4/accounts/023e105f4ecef8ad9ca31a8372d0c353/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/bulk \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '[
5 {
6 "expiration": 1578435000,
7 "expiration_ttl": 300,
8 "key": "My-Key",
9 "value": "Some string"
10 }
11]'
200Updated
1{}