GraphQL Analytics API

The GraphQL Analytics API provides data regarding HTTP requests passing through Cloudflare’s network, as well as data from specific products you may be using, such as Firewall or Load Balancing. You can select the specific data set and metrics in which you’re interested, filter and break down the data along various dimensions, and use basic functions.

The basis of the API is the GraphQL framework, created and open-sourced by Facebook. There is an active developer community for GraphQL and powerful clients for running queries, which makes it easy to get started. GraphQL is especially useful for building visualizations and powers the analytics in Cloudflare’s Dashboard.

GraphQL models a business domain as a graph using a schema. In the schema, there are logical definitions for different types of nodes and their connections (edges). These nodes are the data sets you use for your analytics. You write queries in GraphQL much like in SQL: you specify the data set (table), the metrics to retrieve (such as requests and bytes), and filter or group by dimensions (for example, a time period).

Clients

We’re using GraphiQL for our example GraphQL queries. There are many other popular open-source clients that you can find online, such Altair and Insomnia. You can also use curl.