400 Error using the X-Auth-Email and X-Auth-Key headers for Zone Lockdown API call

For Workes & Pages, what is the name of the domain?

What is the error number?

400

What is the error message?

Invoke-RestMethod : The remote server returned an error: (400) Bad Request

What is the issue or error you’re encountering

400 Error when using the X-Auth-Email and X-Auth-Key headers for Zone Lockdown API call

What steps have you taken to resolve the issue?

Tried various combinations of the X-Auth-Email and X-Auth-Key headers but always receive a 400 error when using them for this API

What are the steps to reproduce the issue?

Built the headers as follows:

$headers = @{}
$headers.Add(“Content-Type”, “application/json”)
$headers.Add(“X-Auth-Key”, “abcdefghijklmnop”)

(have tried with and without adding $headers.Add(“X-Auth-Email”, “[email protected]”) )

Run the following API request:

$response = Invoke-RestMethod -Uri ‘https://api.cloudflare.com/client/v4/zones/correct zone id here/firewall/lockdowns’ -Method GET -Headers $headers

Screenshot of the error

Hi,

Thank you for reaching out to us.

Are you trying to create a Zone Lockdown rule? Please note that this is only available for paid plans as per: Zone Lockdown · Cloudflare Web Application Firewall (WAF) docs

Can you please confirm if you’re following the steps here: Cloudflare API Documentation

Kindly,

Yes this is on a business plan and has worked for a long time but has now stopped working. I am using the steps outlined in the api documentation and get the same result whether using poweshell or curl

Can you check the double quotes? Use straight double quotes (") instead of typographic quotes (“”). I can’t replicate the issue because I don’t have a Windows machine. You can also try using Postman if the problem persists.

Same error sadly and same error in Postman (and straight curl)