Overview
Access the KV API:Namespaces
KV namespaces are containers for key-value pairs.Create a namespace
Create a new KV namespace.Your Cloudflare account ID
A human-readable name for the namespace
The namespace ID (used for API operations)
The namespace title
Whether the namespace supports URL encoding for keys
List namespaces
Retrieve all KV namespaces in your account.Your Cloudflare account ID
Page number for pagination
Number of namespaces per page (default: 20, max: 100)
Update a namespace
Rename a KV namespace.The namespace ID to update
Your Cloudflare account ID
The new title for the namespace
Delete a namespace
Delete a KV namespace and all its key-value pairs.The namespace ID to delete
Your Cloudflare account ID
Values
Manage key-value pairs within a namespace.Write a value
Write a key-value pair to a namespace.The namespace ID
The key name (up to 512 bytes)
Your Cloudflare account ID
The value to store (up to 25 MB)
Optional JSON metadata (up to 1024 bytes)
Unix timestamp when the key should expire
Number of seconds until the key expires
Read a value
Retrieve a value from a namespace.The namespace ID
The key name to retrieve
Your Cloudflare account ID
Delete a value
Delete a key-value pair from a namespace.Keys
List and manage keys within a namespace.List keys
Retrieve a list of keys in a namespace.The namespace ID
Your Cloudflare account ID
Filter keys by prefix
Maximum number of keys to return (default: 1000, max: 1000)
Pagination cursor for fetching the next page
Bulk operations
Bulk write
Write multiple key-value pairs in a single request.The namespace ID
Your Cloudflare account ID
Array of key-value pairs to write (up to 10,000 pairs)
Bulk delete
Delete multiple keys in a single request.The namespace ID
Your Cloudflare account ID
Array of key names to delete (up to 10,000 keys)
Metadata
Retrieve metadata about a key without fetching its value.The JSON metadata associated with the key