Cloudflare Enablement
Analytics
Testing
Edit this page on GitHub
Set theme to dark (⇧+D)

Querying Firewall Events with GraphQL

In this example, we are going to use the GraphQL Analytics API to query for Firewall Events over a specified time period.

The following API call will request Firewall Events over a one hour period, and output the requested fields. Be sure to replace CLOUDFLARE_ZONE_ID, CLOUDFLARE_EMAIL, and CLOUDFLARE_API_KEY with your zone tag and API credentials, and adjust the datetime_geg and datetime_leq values to your liking.

​​ API Call

The results returned will be in JSON (as requested), so piping the output to jq will make them easier to read, for example: