Claude
Skills
Sign in
Back

cloudflare

Included with Lifetime
$97 forever

Manages Cloudflare zones via API. Use when purging cache, querying DNS records, or checking zone analytics.

Backend & APIs

What this skill does


# Cloudflare API

## Authentication

All requests use `--oauth2-bearer` for auth:
```
--oauth2-bearer "$CLOUDFLARE_API_TOKEN" -H "Content-Type: application/json"
```

## Common operations

List zones:
```
GET https://api.cloudflare.com/client/v4/zones
```

Purge cached URLs:
```
POST https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache
Body: {"files":["https://example.com/path/to/asset"]}
```

DNS records:
```
GET https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records
```

Analytics (last 24h):
```
POST https://api.cloudflare.com/client/v4/graphql
Body: {"query":"{ viewer { zones(filter: {zoneTag: \"ZONE_ID\"}) { httpRequests1dGroups(limit: 1, filter: {date_geq: \"YYYY-MM-DD\"}) { sum { requests pageViews bytes threats } } } } }"}
```
Set `date_geq` to yesterday's date. Adapt the query for other datasets — see [Cloudflare GraphQL Analytics docs](https://developers.cloudflare.com/analytics/graphql-api/).

## Notes

- Always look up the zone ID first if not provided
- Use `jq` to format responses
- Keep output concise — summarize rather than dump raw JSON

Related in Backend & APIs