Cloudflare::API::KV

NAME

Cloudflare::API::KV - manage Workers KV namespaces, keys, and values

SYNOPSIS

my $kv=$api->kv();
my $namespace=$kv->create_namespace({ title => 'my-cache' });
$kv->put_value($namespace->{'id'}, 'greeting', 'hello');
my $bytes=$kv->get_value($namespace->{'id'}, 'greeting');

DESCRIPTION

All operations use the account ID configured on Cloudflare::API. Namespace and key-list methods use Cloudflare JSON responses. Values are handled as raw bytes; they are not JSON-decoded by get_value().

METHODS

JSON methods accept full_response => 1 for the complete envelope. Namespace IDs and key names are percent-encoded as path components. Create and rename bodies must be hash references; put_value() requires a defined non-reference scalar.

ERRORS

Missing account context, invalid identifiers, bodies, values, or options cause Perl exceptions. HTTP, transport, and Cloudflare envelope failures follow Cloudflare::API.

SEE ALSO

Cloudflare::API

AUTHOR

Andrew Speer andrew.speer@isolutions.com.au

LICENSE and COPYRIGHT

Copyright (c) 2026 Andrew Speer. This software is free software under the same terms as Perl 5.