Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/graphql-api/gotchas.md
1# GraphQL Analytics API Gotchas & Troubleshooting23## Rate Limits45| Limit | Value |6|-------|-------|7| GraphQL queries per user | **Default 300 per 5 minutes** (max 320, at least 1/sec) |8| General API rate limit | 1200 requests per 5 minutes (shared across all API calls) |9| Zone scope per query | Up to **10 zones** |10| Account scope per query | Exactly **1 account** |1112The GraphQL rate limit is separate from the general API limit. Exceeding either results in `HTTP 429` and blocks all API calls for 5 minutes. Enterprise customers can contact support to raise limits.1314### "429 Too Many Requests"1516**Cause:** Exceeded rate limit.1718**Solution:** Batch multiple datasets into single queries, cache results, increase intervals between queries. Use `{ viewer { budget } }` to monitor remaining budget.1920## Sampling & Data Accuracy2122### Adaptive Bit Rate (ABR) Sampling2324Datasets with `Adaptive` in the name use adaptive sampling:25- Results are **statistically representative**, not exact26- Same query may return **slightly different numbers** each run27- Higher traffic = higher sampling rate = more accurate28- `sampleInterval` dimension shows the ratio (1 = no sampling, 10 = ~1-in-10 sampled)2930For high-confidence numbers, use `confidence(level: 0.95)` to get estimate bounds. For exact counts, use rollup nodes (`httpRequests1hGroups`, `httpRequests1dGroups`) which are pre-aggregated without sampling.3132### Rollup vs. Adaptive3334| Feature | Rollup (`*1hGroups`, `*1dGroups`) | Adaptive (`*AdaptiveGroups`) |35|---------|-----------------------------------|-----------------------------|36| Sampling | No (pre-aggregated) | Yes (ABR) |37| Flexibility | Fixed time buckets | Any granularity |38| Dimensions | Fewer | Many more |39| Accuracy | Exact | Statistical estimate |4041## Common Errors4243### "Access denied" / "authentication error"4445**Cause:** Token lacks required permission or wrong scope.4647**Solution:** Account-scoped queries need **Account Analytics: Read**. Zone-scoped queries need **Zone Analytics: Read**. Verify: `curl -s https://api.cloudflare.com/client/v4/user/tokens/verify -H "Authorization: Bearer $TOKEN"`4849### "field not found" / "Cannot query field"5051**Cause:** Wrong dataset name, nonexistent field, or wrong scope (zone vs. account).5253**Solution:** Names are case-sensitive camelCase (`httpRequestsAdaptiveGroups`). Zone datasets go under `zones(...)`, account datasets under `accounts(...)`. Use introspection to verify.5455### "filter is required" / empty results5657**Cause:** Missing required time range filter or incorrect zone/account tag.5859**Solution:** Always include `datetime_gt` / `datetime_lt` (or `_geq` / `_leq`).6061### "limit is required" / "limit exceeds maximum"6263**Cause:** Missing `limit` or exceeding node's max page size.6465**Solution:** Always specify `limit`. Max varies by dataset (typically 10,000 for groups, 100 for raw events). Check via settings query.6667### "query is too complex" / "query exceeds budget"6869**Cause:** Too many fields, datasets, or too broad a time range.7071**Solution:** Reduce time range, request fewer dimensions/metrics, break into smaller queries. Monitor `cost` and `budget` in responses.7273### 200 Response with Errors7475GraphQL returns HTTP 200 even on failures. **Always check `response.errors`:**7677```json78{ "data": null, "errors": [{ "message": "filter is required for httpRequestsAdaptiveGroups" }] }79```8081## Plan-Based Availability8283Not all datasets are available on all plans. Higher plans get more datasets, longer retention (`notOlderThan`), wider time ranges (`maxDuration`), more fields, and larger page sizes.8485### "node is not available" / "node is disabled"8687**Cause:** Dataset not on your plan, or product not enabled.8889**Solution:** Check `settings { <nodeName> { enabled } }`. Some datasets require specific subscriptions (e.g., Network Analytics requires Magic Transit/Spectrum).9091## DateTime & Timezone Handling9293- All times are **UTC only** (ISO 8601: `"2025-01-15T10:30:00Z"`)94- `Date` type: `"2025-01-15"` (used in `date_geq`/`date_leq` for storage datasets)95- `Time` type: `"2025-01-15T10:30:00Z"` (used in `datetime_gt`/`datetime_lt`)96- Filters are start-inclusive: events that start within the window are included9798## Performance Tips99100- **Narrow time ranges** are faster and cheaper101- **Select only needed dimensions** — each additional dimension increases cost102- **Use rollup nodes** (`*1dGroups`) for simple daily totals without dimension breakdowns103- **Batch datasets** into one query instead of separate HTTP requests104105## See Also106107- [README.md](README.md) - Overview, decision tree, dataset index108- [api.md](api.md) - Query structure, aggregation fields, filtering operators109- [configuration.md](configuration.md) - Authentication, client setup, introspection queries110- [patterns.md](patterns.md) - Common query patterns (time-series, top-N, per-product)111