Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Cloudflare has two different interfaces that people call the “Web Analytics API.” The account-scoped Web Analytics site-info API manages RUM sites (list, retrieve, create, update, and delete). The separate GraphQL Analytics API queries aggregated Cloudflare network and product data. Choose the interface by your goal: configure a Web Analytics site with site-info endpoints, or retrieve analytics data with GraphQL.

How do I use the Cloudflare Web Analytics API?

Start by identifying the operation you need. The RUM site-info API is a REST-style resource interface for managing Web Analytics sites associated with an account. The documented operation family includes listing sites, retrieving one site, creating a site, updating a site, and deleting a site. Cloudflare’s current API reference should be treated as authoritative for the exact paths, path parameter names, request bodies, response schemas, and permissions; those details are not interchangeable with the GraphQL API.

If your objective is reporting—such as querying request counts, performance measurements, or product datasets—use the GraphQL Analytics API instead. It is a single endpoint that accepts POST requests containing a GraphQL document and variables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the interface by task

Need Use What it does
Manage which Web Analytics sites exist RUM site-info endpoint family List, get, create, update, and delete Web Analytics site resources.
Query aggregated traffic or product measurements GraphQL Analytics API Runs filtered and aggregated queries across Cloudflare network and product datasets.
Collect visitor data from a website Web Analytics setup Installs or enables the Beacon collection method for the site.

What is the Cloudflare Web Analytics site-info endpoint?

It is the management surface for Web Analytics (RUM) site records at the account scope. Cloudflare lists operations to enumerate the account’s sites, read an individual site, create one, modify one, and remove one. These operations concern site configuration and metadata; they are not a substitute for querying historical analytics measurements.

Verify the live contract before coding

The available reference description does not establish endpoint-level URLs, JSON fields, response envelopes, or permission requirements. Do not infer those from the operation names or from examples for another Cloudflare API. Open the current Cloudflare API reference, select the Web Analytics site-info operation you need, and copy its path, required account identifier, body schema, and authentication scope exactly. Check whether your account or zone is supported and whether deletion is reversible before sending a destructive request.

Authentication boundaries

Cloudflare recommends API tokens for the GraphQL Analytics API. Its documented token configuration uses Account → Account Analytics → Read, with optional zone-resource restrictions, client-IP restrictions, and a token lifetime. The token is shown only when it is created, so store it in a secret manager or environment variable. These GraphQL permissions must not be assumed to be the exact scopes required by every RUM site-info operation; verify each operation in the current reference.

How do I get Web Analytics data from Cloudflare?

Send an HTTP POST request to https://api.cloudflare.com/client/v4/graphql with a JSON object containing query and variables. The query selects the dataset and dimensions documented for the product or network measurement you need. A request can contain multiple dataset queries, but Cloudflare waits for all of them and the request fails if any one fails.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Minimal request shape

The following shows the transport shape without inventing a dataset name or field that may change. Replace the query with the operation from Cloudflare’s current GraphQL schema.

POST https://api.cloudflare.com/client/v4/graphql
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
  "query": "query ($accountTag: String!) { ... }",
  "variables": { "accountTag": "YOUR_ACCOUNT_ID" }
}

Use the schema explorer or current documentation to select valid types, filters, dimensions, and measures for your account. Handle both HTTP errors and GraphQL errors in the response; a successful HTTP transport does not guarantee that every field-level query succeeded.

Important billing qualification

Cloudflare explicitly says GraphQL Analytics data is not a billing measure. The API measures overall consumption, while billable traffic can exclude traffic such as DDoS traffic. Use the API for analytics, dashboards, and integrations—not to reproduce an invoice total.

How do I enable Cloudflare Web Analytics on a site?

Non-proxied sites

  1. Open the Web Analytics dashboard and add the site.
  2. Copy the JavaScript snippet Cloudflare provides.
  3. Insert it in the site’s HTML immediately before the closing </body> tag.
  4. Deploy the change and wait a few minutes for data to appear.

If you use a deployment pipeline, verify the snippet is present in the rendered production HTML rather than only in a source template.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sites proxied through Cloudflare

  1. Add the hostname in the Web Analytics dashboard.
  2. Leave automatic setup enabled if you want Cloudflare to inject the Beacon.
  3. In the setup options, choose whether to exclude EU visitor data, install the snippet manually, or disable Web Analytics.

Automatic setup cannot modify an original payload served with Cache-Control: public, no-transform. Remove that directive where appropriate, or install the snippet manually.

Cloudflare Pages

For a Pages project, enable Web Analytics from the project’s Metrics page. Cloudflare adds the JavaScript snippet on the next deployment, so publish a new deployment after enabling it.

Current Web Analytics limits

Cloudflare’s limits page was last updated August 12, 2026; recheck it before building a long-lived integration.

Limit Documented value Qualification
Non-proxied Web Analytics sites 10 Account limit listed by Cloudflare.
Proxied Web Analytics sites No site-count limit stated Applies to proxied sites on the limits page.
Dashboard aggregate view 1,000 websites in parallel For larger portfolios, select specific sites or extract data with GraphQL.
Rules on Free 0 Rules are available only for proxied sites; with zero rules, injection applies to all subdomains.
Rules on Pro 5 Rules are available only for proxied sites.
Rules on Business 20 Rules are available only for proxied sites.
Rules on Enterprise 100 Rules are available only for proxied sites.

Implementation workflow for a production integration

  1. Define the job. Decide whether you are changing site configuration or reading analytics data.
  2. Confirm account context. Record the account ID, site or hostname, and the Cloudflare plan that controls applicable limits.
  3. Create a least-privilege token. For GraphQL, use the documented Account Analytics read permission and restrict resources or client IPs where practical. For site-info operations, use the permissions shown by the current endpoint reference.
  4. Prototype against the live schema. Validate the exact path or GraphQL fields with a non-production account or read-only request.
  5. Store secrets safely. Keep tokens out of source control, browser code, logs, and error messages.
  6. Validate responses. Check HTTP status, the API success indicator or GraphQL errors, and expected identifiers before updating local state.
  7. Add retries carefully. Retry transient network and rate-limit failures with exponential backoff; do not blindly retry create or delete operations unless you have an idempotency strategy supported by the endpoint.
  8. Monitor collection separately. A successful site record does not prove that the Beacon is installed or receiving data. Check the rendered page and allow several minutes for first data.

Troubleshooting common failures

The request returns an authentication or authorization error

Confirm the token is sent as Authorization: Bearer, has not expired, and belongs to the intended account. For GraphQL, verify Account Analytics read permission and resource restrictions. For RUM site-info calls, compare the operation’s required scope with the current API reference instead of reusing GraphQL permissions.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The GraphQL response contains errors despite HTTP 200

Inspect the response’s GraphQL error collection and correct the query, variables, dataset, or field names. When multiple datasets are requested, one failing dataset causes the overall request to fail.

No Web Analytics data appears

For a non-proxied site, confirm the snippet is before </body> in the deployed HTML. For a proxied site, check that automatic setup is enabled and that Cache-Control: public, no-transform is not preventing payload modification. For Pages, confirm a deployment occurred after enabling Metrics. Allow a few minutes, then inspect browser and network errors.

Only some hostnames collect data

Review proxied-site rules and subdomain behavior. On plans with zero rules, Cloudflare documents injection on all subdomains; plans with rules let you control matching behavior within the plan’s stated rule count.

Dashboard aggregation does not show the whole portfolio

The aggregate dashboard view is limited to 1,000 websites in parallel. Select subsets of sites or query the relevant datasets through GraphQL for a larger portfolio.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For automated page images or PDFs, ScreenshotNeo provides a single request instead of maintaining a browser and consent-banner scripts. It removes cookie and consent banners, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response identifies the page verdict and billing status. Its MCP server gives AI agents—including Claude, Cursor, and other MCP clients—tools for screenshots, page information, and PDFs.

Use the API documentation at https://screenshotneo.com/docs/ for all options. A basic call is:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

There is a free allowance of 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

FAQ

Is the Cloudflare GraphQL Analytics API the same as Web Analytics?

No. GraphQL queries aggregated Cloudflare network and product datasets; the Web Analytics site-info family manages RUM site resources.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can GraphQL data be used to calculate my Cloudflare bill?

No. Cloudflare says its GraphQL measurements include overall consumption that differs from billable traffic.

How quickly does a newly enabled site show data?

Cloudflare’s setup guidance says data may take a few minutes to appear after the snippet or automatic setup is active.

Frequently Asked Questions

Is the Cloudflare GraphQL Analytics API the same as Web Analytics?

No. GraphQL queries aggregated Cloudflare network and product datasets; the Web Analytics site-info family manages RUM site resources.

Can GraphQL data be used to calculate my Cloudflare bill?

No. Cloudflare says its GraphQL measurements include overall consumption that differs from billable traffic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How quickly does a newly enabled site show data?

Cloudflare’s setup guidance says data may take a few minutes to appear after the snippet or automatic setup is active.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.