HTTP Request Analytics Zone Colos and GraphQL Migration
How to replace deprecated Zone Analytics REST colos and dashboard endpoints with GraphQL datasets, filters, and field selection.
This page summarises Cloudflare documentation on moving from the deprecated Zone Analytics REST API to the GraphQL Analytics API for HTTP request metrics. The REST colos and dashboard endpoints return large fixed payloads; GraphQL lets you request only the dimensions and aggregates you need, with dataset filters for time range and colocation.
Zone Analytics REST deprecation: what to use instead
Section titled “Zone Analytics REST deprecation: what to use instead”Cloudflare’s colos migration guide states that the legacy zone analytics API is being retired:
This guide shows how you might migrate from the deprecated (and soon to be sunset) zone analytics API to the GraphQL API.
— Cloudflare, Zone Analytics Colos Endpoint to GraphQL Analytics
For HTTP request data, the replacement nodes are:
| Use case | Deprecated REST | GraphQL node |
|---|---|---|
| Per–data center (colo) breakdown | GET /zones/{zone_id}/analytics/colos |
httpRequestsAdaptiveGroups |
| Zone dashboard–style timeseries and totals | GET /zones/{zone_id}/analytics/dashboard |
httpRequests1mGroups |
All GraphQL queries use POST https://api.cloudflare.com/client/v4/graphql with Authorization: Bearer and an API token that includes Analytics Read on the zone (as in the colos migration example).
In GraphQL filters, identify the zone with zoneTag, not the numeric zone ID used in REST paths.
Colos analytics: REST analytics/colos vs httpRequestsAdaptiveGroups
Section titled “Colos analytics: REST analytics/colos vs httpRequestsAdaptiveGroups”What the old colos endpoint does
Section titled “What the old colos endpoint does”The colos endpoint returns request and bandwidth time series for every colo in the zone. A typical call:
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/analytics/colos?since=2020-12-10T00:00:00Z" \ -H "Authorization: Bearer $API_TOKEN"The since parameter sets the start of the range; the end is now. There is no until in this pattern. To answer a question such as hourly request counts for one colo (for example ZRH), you must download all colos and post-process with tools like jq over .result[] and nested .timeseries[] (bandwidth often appears as timeseries[].bandwidth.all, requests as timeseries[].requests.all).
GraphQL: filter by coloCode and group by hour
Section titled “GraphQL: filter by coloCode and group by hour”For HTTP requests, Cloudflare points to httpRequestsAdaptiveGroups as the canonical dataset:
The data we want is about HTTP requests. Hence, we use the canonical source for HTTP request data, also known as httpRequestsAdaptiveGroups.
— Cloudflare, Zone Analytics Colos Endpoint to GraphQL Analytics
That node supports filtering and grouping on many request dimensions. The colos guide contrasts it with REST:
While the colos endpoint forces us to retrieve all the information about the breakdown of requests and bandwidth per colo, using the GraphQL API allows us to fetch only the information we are interested in.
This feature is totally absent from the colos endpoint in the Zone Analytics API.
— Cloudflare, Zone Analytics Colos Endpoint to GraphQL Analytics
An equivalent query scopes the zone, filters by colo and start time, orders by hour, and reads count, sum.edgeResponseBytes, and dimensions datetimeHour and coloCode. Execute with a JSON body file:
curl -X POST -H "Authorization: Bearer $API_TOKEN" \ https://api.cloudflare.com/client/v4/graphql \ -d "@./coloGroups.json"The response path is .data.viewer.zones[] | .httpRequestsAdaptiveGroups[], mapping cleanly to colo_id, timeslot, requests, and bandwidth without pulling every colo.
The GraphQL API allows us to be much more specific about the data that we want to retrieve.
The GraphQL API is a very powerful tool, as you can filter and group the data by many dimensions.
— Cloudflare, Zone Analytics Colos Endpoint to GraphQL Analytics
httpRequestsAdaptiveGroups is Adaptive (ABR-backed) for faster responses when exploring many dimensions:
It is Adaptive so responses will be fast since it is driven by our ABR technology ↗︎.
— Cloudflare, Zone Analytics Colos Endpoint to GraphQL Analytics
Examples in the guide use limit: 10000 on adaptive groups queries.
Zone dashboard analytics: REST analytics/dashboard vs httpRequests1mGroups
Section titled “Zone dashboard analytics: REST analytics/dashboard vs httpRequests1mGroups”Old dashboard endpoint behavior
Section titled “Old dashboard endpoint behavior”The dashboard migration guide describes REST capabilities:
The Zone Analytics API allows you to get request data by zone. It offers optional since and until parameters to specify the request time period and a continuous parameter to indicate whether the time period should be moved backward to find a period with completely aggregated data.
— Cloudflare, Zone Analytics to GraphQL Analytics
Example request:
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/analytics/dashboard?since=2019-09-08T20:00:00Z&until=2019-09-08T20:02:00Z&continuous=false" \ --header "Authorization: Bearer <API_TOKEN>"The response includes timeseries[] buckets plus totals for the same window, with nested metrics for requests, bandwidth, threats, pageviews, uniques, SSL, status codes, countries, and more. You cannot trim the payload:
As you can see from the response, Zone Analytics returns metrics along many dimensions and does not give you the option to control what you receive. With GraphQL Analytics, you can ask for only the data that you need.
— Cloudflare, Zone Analytics to GraphQL Analytics
GraphQL parity with httpRequests1mGroups
Section titled “GraphQL parity with httpRequests1mGroups”For dashboard-style migration, use httpRequests1mGroups with dataset filters such as datetime_geq and datetime_lt on the group filter (see Filtering in Cloudflare’s GraphQL docs, referenced from the zone analytics migration guide). Sample migrations use a time dimension like datetimeFiveMinutes under dimensions, with sum and uniq fields matching the REST breakdowns you still need.
Two important behavior changes:
Notice that you can specify the request time period using a dataset filter (refer to Filtering). The continuous parameter is no longer needed because GraphQL Analytics is designed to provide data as soon as it is available.
Also, if you want to get the totals for a particular period, rather than a breakdown by time period, simply remove the datetimeFiveMinutes field under dimensions.
— Cloudflare, Zone Analytics to GraphQL Analytics
The sample httpRequests1mGroups query uses limit: 100 and variables $zoneTag, $start, and $end.
REST vs GraphQL: time range, continuous, and totals
Section titled “REST vs GraphQL: time range, continuous, and totals”| Aspect | Zone Analytics REST | GraphQL Analytics |
|---|---|---|
| Zone identifier | ZONE_ID in URL path |
zoneTag in viewer.zones(filter: …) |
| Colo + hourly metrics | All colos; heavy jq |
Filter coloCode; dimension datetimeHour |
| Dashboard time window | since, until, optional continuous |
Datetime filters on the dataset; no continuous |
| Aggregation readiness | continuous may shift window backward |
Data returned as soon as available |
| Period totals without buckets | totals object in REST |
Omit datetime fields from dimensions |
| Request count (colo example) | timeseries[].requests.all |
count on adaptive groups |
| Bandwidth (colo example) | timeseries[].bandwidth.all |
sum.edgeResponseBytes |
Common mistakes when migrating colos and dashboard calls
Section titled “Common mistakes when migrating colos and dashboard calls”- Using zone ID in REST but forgetting to switch to
zoneTagin GraphQLzones(filter: …). - Porting
continuous=true/falselogic to GraphQL—it is unnecessary on the new API. - Calling
/analytics/coloswhen only one colo or hour range is needed, instead of filtering in GraphQL. - Picking
httpRequests1mGroupsfor a colo-hour question (wrong node) orhttpRequestsAdaptiveGroupswhen you need the full dashboard field set without re-selecting fields. - For totals only, leaving
datetimeFiveMinutes(or other datetime dimensions) indimensions, which forces a time breakdown. - Token missing Analytics Read on the target zone.
- Posting malformed GraphQL bodies when using
curl -d "@./coloGroups.json"(file must be valid JSON).
How to check this on your site
Section titled “How to check this on your site”-
Create or reuse an API token with Analytics Read on the zone, as described in Zone Analytics Colos Endpoint to GraphQL Analytics.
-
For a fixed
sincewindow, call the legacy colos URL and note total requests for onecolo_idfrom.result[]/.timeseries[]. -
Run the equivalent
httpRequestsAdaptiveGroupsquery with the same start time andcoloCode, then comparecountandsum.edgeResponseByteswithjqon.data.viewer.zones[].httpRequestsAdaptiveGroups[]. -
For dashboard parity, query REST
analytics/dashboardwithsince,until, andcontinuous=false, then run the migration sample’shttpRequests1mGroupsquery from Zone Analytics to GraphQL Analytics for the same interval and compare selectedsum/uniqfields. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about so it can be corrected.