How can I get package_id for getting WAF Rules?

Im trying to work on getting WAF Rules via API callback

I do keep getting error “Invalid or missing WAF Package ID”. How can I get the package_id to make this work?

Thanks in advance

Hi there,

Thank you for contacting us.

Could you please try the following solution:

Use the Cloudflare API to get the package_id. You can create an API token from the Cloudflare dashboard, go to My Profile > API Tokens and select Create Token. Once you have the token, you can use the API to get the package_id by making a GET request to the /zones/:zone_identifier/firewall/waf/packages endpoint (Cloudflare API Documentation).

Once you have the package_id, you can use it in your API callback to work with WAF Rules in Cloudflare. If you are still getting the error “Invalid or missing WAF Package ID”, make sure that you are using the correct package_id and that it is formatted correctly in your API request.

I hope this helps. Please let us know if you have other questions.

1 Like

i’m also trying to get the package_id info but unfortunately i recieve by the provided api call no package_id:

{
    "result": [],
    "result_info": {
        "page": 1,
        "per_page": 20,
        "total_pages": 0,
        "count": 0,
        "total_count": 0
    },
    "success": true,
    "errors": [],
    "messages": []
}

Any Idea @Lili84 or someone else?

No One here who can help me?

You’ve got the result (not an error message). That means your zone does not have any rule package, which is typical for instance for Free Plan zones, as WAF (Previous Edition) does not have Managed Rules in Free Plan zones.

If you want to list your Firewall Rules, you should use a different endpoint: Cloudflare API Documentation

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.