Why cloudflare keeps on saying 400 bad request?

Hi,
I tried to send following request to Cloudflare api
https://api.Cloudflare.com/client/v4/zones/xxx/logs/received?start=2019-06-23T00:00:00Z&end=2019-06-23T00:59:59Z&fields=ClientIP,ClientRequestHost,ClientRequestURI,CacheResponseBytes,ClientRequestBytes,OriginIP,ClientCountry

var client = new RestClient
{
BaseUrl = new Uri(url)
};

var request = new RestRequest("", Method.GET);

request.AddHeader(“X-Auth-Email”, “[email protected]”);
request.AddHeader(“X-Auth-Key”, “c1a9xxx”);
request.AddHeader(“Content-Type”, “application/json”);

no matter how I try, I always got this error message:

  "code": 1010,
  "message": "auth.forbidden"

I am sure that I put the right email and key in. Was there anything I missed? Is it possible that my account doesn’t have permission to run this API query?

thanks

That’s an Enterprise plan feature. Are you on an Enterprise plan?

https://api.Cloudflare.com/#logs-received-properties

2 Likes

hi, I see.

Some of our sites are labelled “enterprise website”, and the one I queried is “business website”. So it means that site is not on enterprise plan?

thanks

Correct. And that would account for the 400 error.

Any chance we could have more meaningful error message generally. 400 bad request is not enough to go on