SQL API


目录

The SQL API lets you query Cloudflare analytics and observability datasets with SQL. Use the API to select fields, filter events, calculate aggregates, group results, and integrate analytics data with your applications.

The SQL API provides GET and POST query endpoints at:

https://api.cloudflare.com/client/v4/analytics/sql

Send one SELECT statement in each request. Use POST to send raw SQL or a JSON request with parameters, request-level scope, and a time range. Use GET for URL-encoded queries. The API validates the statement against the available datasets and supported SQL language before it executes the query.

Use the introspection endpoint to discover dataset names, categories, descriptions, kinds, columns, and data types. You can also run queries with cf sql query and list datasets with cf sql datasets.

The SQL API supports a deliberately limited SQL dialect. It does not pass arbitrary SQL through to the underlying data store. For the complete language surface, refer to the SQL language reference.

Query scope

Every query must include:

Dataset and field availability depends on your Cloudflare plan and permissions. The API authorizes every account or zone named by a query.

Get started

Refer to Get started to create an API token and run your first query.

To query datasets from a Cloudflare Worker without managing an API token, use the Workers binding.


版本号 #2
由 壳壳虫 创建于 2026-10-31 23:58:08 UTC
由 壳壳虫 更新于 2026-10-31 23:58:09 UTC