API authentication failing

I have something similar issue. I was trying to create a purge API Call

Request:
curl -X POST “https://api.cloudflare.com/client/v4/zones//purge_cache”
-H “X-Auth-Email: [email protected]
-H “X-Auth-Key: CFAU1mImL_xxxMY_AUTH_KEY”
-H “Content-Type: application/json”
–data ‘{“hosts”:[“dev.MYDOMAIN-com”]}’

Response:
{“success”:false,“errors”:[{“code”:6003,“message”:“Invalid request headers”,“error_chain”:[{“code”:6111,“message”:“Invalid format for Authorization header”}]}],“messages”:,“result”:null}

Isnt there the zone identifier missing?

My bad “<” “>” - didnot pick up. I masked with “MYZONE ID”
curl -X POST “https://api.cloudflare.com/client/v4/zones/MYZONE ID/purge_cache” \

The error message specifically refers to the authorisation header, however I still wonder why you got that “hosts” field from.

Make sure your request matches the example at https://api.cloudflare.com/#zone-purge-all-files

Ohh, you got it from https://api.cloudflare.com/#zone-purge-files-by-cache-tags-or-host. That only works on Enterprise plans.

I tried -

Request:
curl -X POST “https://api.cloudflare.com/client/v4/zones/MyZone/purge_cache
-H “X-Auth-Email: MyEmail”
-H “X-Auth-Key: MyAuthKey”
-H “Content-Type: application/json”
–data ‘{“purge_everything”:true}’

Response:
{“success”:false,“errors”:[{“code”:6003,“message”:“Invalid request headers”,“error_chain”:[{“code”:6103,“message”:“Invalid format for X-Auth-Key header”}]}],“messages”:,“result”:null}

I would double check the mentioned header. You seemingly send an invalid value.

Am I doing something wrong?? Can you please paste a working sample?

Simply follow the example given and verify it against your call.