Skip to content
Start here

Get a key's value

GET/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}

Returns the value stored under the specified key in the Workers KV namespace as raw bytes. Use URL-encoding for special characters (for example, :, !, %) in the key name when constructing the request URL. If the key-value pair expires, the expiration response header contains its expiration time in seconds since the UNIX epoch.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers KV Storage WriteWorkers KV Storage Read
Path ParametersExpand Collapse
account_id: string

ID of the Cloudflare account that owns the Workers KV namespaces.

maxLength32
namespace_id: string

ID of the Workers KV namespace.

maxLength32
key_name: string

A key’s name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.

maxLength512

Get a key's value

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/storage/kv/namespaces/$NAMESPACE_ID/values/$KEY_NAME \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
Returns Examples