Filter resources by tag
The GET /accounts/{account_id}/tags/resources endpoint supports tag filtering via the tag query parameter. Multiple tag parameters combine with AND logic. For the full endpoint specification, refer to the Resource Tagging API reference ↗.
Match resources that have a specific tag key, regardless of value.
# All resources with an "environment" tag (any value)curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=environment" \ -H "Authorization: Bearer $API_TOKEN"Match resources where a tag key has a specific value.
# All resources with environment=productioncurl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=environment=production" \ -H "Authorization: Bearer $API_TOKEN"Match resources where a tag key has any of the specified values. Separate values with commas.
# environment=production OR environment=stagingcurl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=environment=production,staging" \ -H "Authorization: Bearer $API_TOKEN"Maximum of 10 OR values per filter (error code 1013 if exceeded).
Match resources that do not have a specific tag key.
# All resources without an "archived" tagcurl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=!archived" \ -H "Authorization: Bearer $API_TOKEN"Match resources where a tag key does not have a specific value.
# All resources where region is NOT us-west-1curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=region!=us-west-1" \ -H "Authorization: Bearer $API_TOKEN"Multiple tag parameters combine with AND logic. All conditions must match.
# Production resources in US regions, excluding archivedcurl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=environment=production&tag=region=us-west-1,us-east-1&tag=!archived" \ -H "Authorization: Bearer $API_TOKEN"Maximum of 20 tag filters per query (error code 1010 if exceeded).
curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/keys" \ -H "Authorization: Bearer $API_TOKEN"curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/values/environment" \ -H "Authorization: Bearer $API_TOKEN"Optionally filter by resource type:
curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/values/environment?type=worker" \ -H "Authorization: Bearer $API_TOKEN"All list endpoints use cursor-based pagination with a fixed page size of 100 results.
When the response includes a non-null result_info.cursor, pass it as a query parameter to get the next page:
curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=environment=production&cursor=$CURSOR" \ -H "Authorization: Bearer $API_TOKEN"When cursor is null, you have reached the last page. Pagination works seamlessly with tag filters.