Hanzo
OpenapiCloudflare

Run a SQL statement against a D1 database

Executes a statement on one D1 database on the org's OWN Cloudflare account and relays D1's result set.

POST /v1/cloudflare/d1/databases/{database}/query

Addresshttps://api.hanzo.ai/v1/cloudflare/d1/databases/{database}/query
MethodPOST
Operationpost_cloudflare_d1_databases_by_database_query
AuthAuthorization: Bearer $HANZO_API_KEY

Executes a statement on one D1 database on the org's OWN Cloudflare account and relays D1's result set. sql is required and params carries the bound values in placeholder order — use them rather than interpolating values into the statement.

The body is checked for a non-empty sql and then forwarded VERBATIM, so every field D1 accepts reaches D1 even though only two are named here; the declared schema is open for that reason. That verbatim forward is why this is not a typed op — decoding and re-encoding the body would drop params, where the query's bound values live. Requires ORG ADMIN (403 otherwise); a malformed body or missing sql is 400; 503 if the org has never connected a Cloudflare token.

Request

3 fields, body application/json.

FieldInTypeRequiredDescription
databasepathstringyes
paramsbodyany[]
sqlbodystring

Response

StatusBodyMeaning
2XXSuccess

2XX body — 1 field.

FieldInTypeAlwaysDescription
(body)bodyanyyes

Failure carries the platform error shape — see Errors.

Examples

hanzo cloudflare d1 databases query <database>

Cloudflare API · All Hanzo APIs · Interactive reference

How is this guide?

On this page