KV
kv
Namespaces
kv.namespaces
Methods
Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.
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.
Creates a namespace under the given title. A 400
is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.
Deletes the namespace corresponding to the given ID.
Get the namespace corresponding to the given ID.
Returns the namespaces owned by an account.
Modifies a namespace's title.
Domain types
kv.namespaces.analytics
Methods
Retrieves Workers KV request metrics for the given account.
Retrieves Workers KV stored data metrics for the given account.
Domain types
kv.namespaces.keys
Methods
Lists a namespace's keys.
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example: Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Workers KV Storage Write Workers KV Storage Read
Identifier
Namespace identifier tag.
Opaque token indicating the position from which to continue when requesting the next set of records if the amount of list results was limited by the limit parameter. A valid value for the cursor can be obtained from the cursors
object in the result_info
structure.
The number of keys to return. The cursor attribute may be used to iterate over the next batch of keys if there are more than the limit.
A string prefix used to filter down which keys will be returned. Exact matches and any key names that begin with the prefix will be returned.
Whether the API call was successful
Domain types
kv.namespaces.metadata
Methods
Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, :
, !
, %
) in the key name.
kv.namespaces.values
Methods
Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, :
, !
, %
) in the key name.
Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, :
, !
, %
) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the expiration
response header.
Write a value identified by a key. Use URL-encoding to use special characters (for example, :
, !
, %
) in the key name. Body should be the value to be stored. If JSON metadata to be associated with the key/value pair is needed, use multipart/form-data
content type for your PUT request (see dropdown below in REQUEST BODY SCHEMA
). Existing values, expirations, and metadata 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.