Cloudflare::API::D1

NAME

Cloudflare::API::D1 - manage D1 databases and run REST SQL queries

SYNOPSIS

my $d1=$api->d1();
my $databases=$d1->list_databases();
my $rows=$d1->query_sql($database_id,
    'SELECT * FROM items WHERE id = ?', [$item_id]);

DESCRIPTION

All methods use the account ID configured on Cloudflare::API. The query methods call Cloudflare's D1 REST query endpoint; they do not provide a DBI connection or migration system. SQL parameters remain separate from SQL text.

METHODS

For every JSON method, full_response => 1 returns the entire decoded envelope. Database IDs are percent-encoded in paths. Body arguments must be hash references; query_sql() also requires a non-empty scalar SQL string and, when supplied, an array reference of parameters.

ERRORS

Invalid bodies or SQL arguments cause Perl exceptions. HTTP, transport, and Cloudflare envelope failures follow the rules in 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.