Analytics
4 operations in the WP Waterfall API.
- getPlan usage across the company, with a row per site
- getAn analytics view rolled up across the company's environments
- getPlan usage for one environment: visits, bandwidth, and disk against the plan
- getAn analytics view for one environment
Plan usage across the company, with a row per site
get/companies/me/analytics/usagePermalink to Plan usage across the company, with a row per site
- Scope:
sites:read - Permission:
sites.read
Returns usage across the company's sites for one window, with a row per site. The window is the current billing period by default, the period before it with period=previous, or the from and to you send. A member limited to some sites gets the usage of those sites with no plan or billed figures.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from | query | string (date-time) | Defaults to the start of the current billing period. |
to | query | string (date-time) | |
period | query | string | previous is the billing period before the current one (a month earlier, whole). It ignores from and to. The answer carries the dates it used. One of: current, previous. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AnalyticsUsage | Plan usage |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
scope required | string | One of: environment, company. |
environment_id required | string or null (uuid) | UUIDv7 |
from required | string (date-time) | |
to required | string (date-time) | |
billing_period required | boolean | True when the window is a whole billing period (the current one, or the previous one with period=previous), so the bars compare with the plan. |
plan_name required | string or null | |
source required | string | Where the numbers come from: the node logs, the demo seed, or nowhere yet. One of: node_logs, demo, none. |
note required | string or null | |
query_version required | string | |
last_collected_at required | string or null (date-time) | |
meters required | array of object | |
meters[].metric required | string | What the meter counts. One of: visits, server_bandwidth, cdn_bandwidth, disk, sites. |
meters[].unit required | string | bytes for disk and bandwidth, count for visits and sites. One of: count, bytes. |
meters[].used required | number or null | Null when the figure is not measured, so nothing is shown rather than a guess. Range: 0 to any. |
meters[].included required | number or null | What the plan includes for the period. Null when the plan does not limit it. Range: 0 to any. |
meters[].percent required | number or null | Used over included, as a percentage with one decimal. Null without both numbers. Range: 0 to any. |
meters[].available required | boolean | True when used holds a measured figure. |
meters[].note required | string or null | Where the figure comes from, or why it is missing, in a plain sentence. Null when none. |
meters[].state | string | permission_needed when Cloudflare refused the platform token; used is then null. One of: permission_needed, not_configured, not_on_plan. |
daily required | array of object | |
daily[].day required | string | |
daily[].visits required | integer | Range: 0 to any. |
daily[].page_views required | integer | Range: 0 to any. |
daily[].bytes required | integer | Server bandwidth without bots. Range: 0 to any. |
An analytics view rolled up across the company's environments
get/companies/me/analytics/{view}Permalink to An analytics view rolled up across the company's environments
- Scope:
sites:read - Permission:
sites.read
Returns one view, such as visits, bandwidth, response-codes, or top-countries, added up over the environments of the sites the caller can see. The window runs from from to to (the last 7 days by default, and no further back than 396 days) in buckets of time_span (default day). available is false with a plain note when the source of a view has sent nothing yet.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
view required | path | string | |
from | query | string (date-time) | |
to | query | string (date-time) | |
time_span | query | string | One of: hour, day, week, month. Default: day. |
traffic_type | query | string | Only the top-traffic-* views read it. One of: all, visitors, named_bots, ai_crawlers, automation_tools. Default: all. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AnalyticsResult | The view |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
view required | string | One of: visits, visits-dispersion, bandwidth, cdn-bandwidth, edge-cache-bandwidth, disk-space, response-codes, top-countries, top-asns, top-hosts, top-referrers, top-browsers, page-views, requests, top-requests, top-paths-bytes, top-cities, top-user-agents, top-client-ips, device-series, bot-classes, bot-results, top-traffic-paths, top-traffic-user-agents, top-traffic-countries, top-traffic-ips, redirect-series, client-error-series, server-error-series, status-codes, top-404, top-cached-paths, top-bypassed-paths, php-throughput, php-share, cache-status, response-time, bot-traffic, cache-series, response-series, cache-breakdown. |
scope required | string | One of: environment, company. |
environment_id required | string or null (uuid) | UUIDv7 |
from required | string (date-time) | |
to required | string (date-time) | |
time_span required | string | One of: hour, day, week, month. |
unit required | string | One of: count, bytes, percent, ms. |
total required | number | |
available required | boolean | |
note required | string or null | |
state | string | Why a figure is missing, when it is: permission_needed means Cloudflare refused the platform token (it needs Zone > Analytics > Read), not_configured means no Cloudflare token is set, and not_on_plan means the zone's plan does not offer the field. Absent when the view has numbers or the reason is something else. One of: permission_needed, not_configured, not_on_plan. |
query_version required | string | Versions the counting rules, such as visits-v2-node for node visits. |
rows required | array of object | |
rows[].bucket required | string or null (date-time) | Start of the bucket (ISO 8601) for a series, null for a top list. |
rows[].key required | string or null | The dimension value, such as a country code, host, or client IP. Null for a total series. |
rows[].label required | string | |
rows[].value required | number | |
rows[].share required | number or null | Share of the total, 0 to 1. Null when the total is zero. Range: 0 to 1. |
rows[].bytes | integer or null | Bytes sent for the row, on top lists that know them (top requests, countries). Range: 0 to any. |
rows[].requests | integer or null | Requests for the row, on top lists that rank by something else (paths ranked by bytes carry the bytes in value). Absent on series and on lists with no request count. Range: 0 to any. |
Plan usage for one environment: visits, bandwidth, and disk against the plan
get/environments/{id}/analytics/usagePermalink to Plan usage for one environment: visits, bandwidth, and disk against the plan
- Scope:
sites:read - Permission:
sites.read
Read from the hourly rollups of the node's access logs. The default window is the current billing period; period=previous reads the whole period before it. Bots are left out of visits and bandwidth. Each day carries the server bytes and, when Cloudflare has answered, the CDN bytes. CDN bandwidth reads Cloudflare for the environment's domains; when Cloudflare cannot answer, the meter says why.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the environment. |
from | query | string (date-time) | Defaults to the start of the current billing period. |
to | query | string (date-time) | |
period | query | string | previous is the billing period before the current one (a month earlier, whole). It ignores from and to. The answer carries the dates it used. One of: current, previous. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AnalyticsUsage | Plan usage |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
scope required | string | One of: environment, company. |
environment_id required | string or null (uuid) | UUIDv7 |
from required | string (date-time) | |
to required | string (date-time) | |
billing_period required | boolean | True when the window is a whole billing period (the current one, or the previous one with period=previous), so the bars compare with the plan. |
plan_name required | string or null | |
source required | string | Where the numbers come from: the node logs, the demo seed, or nowhere yet. One of: node_logs, demo, none. |
note required | string or null | |
query_version required | string | |
last_collected_at required | string or null (date-time) | |
meters required | array of object | |
meters[].metric required | string | What the meter counts. One of: visits, server_bandwidth, cdn_bandwidth, disk, sites. |
meters[].unit required | string | bytes for disk and bandwidth, count for visits and sites. One of: count, bytes. |
meters[].used required | number or null | Null when the figure is not measured, so nothing is shown rather than a guess. Range: 0 to any. |
meters[].included required | number or null | What the plan includes for the period. Null when the plan does not limit it. Range: 0 to any. |
meters[].percent required | number or null | Used over included, as a percentage with one decimal. Null without both numbers. Range: 0 to any. |
meters[].available required | boolean | True when used holds a measured figure. |
meters[].note required | string or null | Where the figure comes from, or why it is missing, in a plain sentence. Null when none. |
meters[].state | string | permission_needed when Cloudflare refused the platform token; used is then null. One of: permission_needed, not_configured, not_on_plan. |
daily required | array of object | |
daily[].day required | string | |
daily[].visits required | integer | Range: 0 to any. |
daily[].page_views required | integer | Range: 0 to any. |
daily[].bytes required | integer | Server bandwidth without bots. Range: 0 to any. |
An analytics view for one environment
get/environments/{id}/analytics/{view}Permalink to An analytics view for one environment
- Scope:
sites:read - Permission:
sites.read
Views: visits, visits-dispersion, bandwidth, cdn-bandwidth, disk-space, response-codes, top-countries, top-asns, top-hosts, top-referrers, top-browsers, page-views, requests, top-requests, top-paths-bytes, cache-status, response-time, bot-traffic, status-codes, top-404, top-cached-paths, top-bypassed-paths, php-throughput, php-share, cache-series, response-series. cache-series and response-series answer one row per bucket and key (Hit, Miss, Bypass, or the status classes 2, 3, 4, 5), for stacked charts. top-paths-bytes ranks the busiest paths by bytes sent (unit bytes), among the 50 most requested paths of each day. status-codes ranks the exact HTTP status codes (301, 404, 500), top-404 ranks the paths that answered 404 for visitors that are not bots, and top-cached-paths and top-bypassed-paths rank the pages served from the page cache and the pages that ran PHP with no cached copy. php-throughput answers PHP requests per minute for each bucket, and php-share answers the share of requests that ran PHP against those served static or from the page cache. A server whose agent does not send these counts yet answers available false with a note. Most views read the hourly rollups of the node's access logs. cdn-bandwidth, visits-dispersion, top-browsers, and top-asns read Cloudflare for this environment's domains only. Visits follow the versioned counting rules in query_version. A view with nothing to show yet answers available false with a note. Retention is 13 months.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the environment. |
view required | path | string | |
from | query | string (date-time) | |
to | query | string (date-time) | |
time_span | query | string | One of: hour, day, week, month. Default: day. |
traffic_type | query | string | Only the top-traffic-* views read it. One of: all, visitors, named_bots, ai_crawlers, automation_tools. Default: all. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AnalyticsResult | The view |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
view required | string | One of: visits, visits-dispersion, bandwidth, cdn-bandwidth, edge-cache-bandwidth, disk-space, response-codes, top-countries, top-asns, top-hosts, top-referrers, top-browsers, page-views, requests, top-requests, top-paths-bytes, top-cities, top-user-agents, top-client-ips, device-series, bot-classes, bot-results, top-traffic-paths, top-traffic-user-agents, top-traffic-countries, top-traffic-ips, redirect-series, client-error-series, server-error-series, status-codes, top-404, top-cached-paths, top-bypassed-paths, php-throughput, php-share, cache-status, response-time, bot-traffic, cache-series, response-series, cache-breakdown. |
scope required | string | One of: environment, company. |
environment_id required | string or null (uuid) | UUIDv7 |
from required | string (date-time) | |
to required | string (date-time) | |
time_span required | string | One of: hour, day, week, month. |
unit required | string | One of: count, bytes, percent, ms. |
total required | number | |
available required | boolean | |
note required | string or null | |
state | string | Why a figure is missing, when it is: permission_needed means Cloudflare refused the platform token (it needs Zone > Analytics > Read), not_configured means no Cloudflare token is set, and not_on_plan means the zone's plan does not offer the field. Absent when the view has numbers or the reason is something else. One of: permission_needed, not_configured, not_on_plan. |
query_version required | string | Versions the counting rules, such as visits-v2-node for node visits. |
rows required | array of object | |
rows[].bucket required | string or null (date-time) | Start of the bucket (ISO 8601) for a series, null for a top list. |
rows[].key required | string or null | The dimension value, such as a country code, host, or client IP. Null for a total series. |
rows[].label required | string | |
rows[].value required | number | |
rows[].share required | number or null | Share of the total, 0 to 1. Null when the total is zero. Range: 0 to 1. |
rows[].bytes | integer or null | Bytes sent for the row, on top lists that know them (top requests, countries). Range: 0 to any. |
rows[].requests | integer or null | Requests for the row, on top lists that rank by something else (paths ranked by bytes carry the bytes in value). Absent on series and on lists with no request count. Range: 0 to any. |