Review common errors associated with API keys and tokens
Common issues
The token itself is not verified
You can ensure the token has been verified by running the following curl and confirm the response returns "status": "active"
.
#CURL (example) curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \ -H "Authorization: Bearer" \ -H "Content-Type:application/json" #Response (example) { "success": true, "errors": [], "messages": [], "result": { "id": "f267e341f3dd4697bd3b9f71dd96247f", "status": "active", "not_before": "2018-07-01T05:20:00Z", "expires_on": "2020-01-01T00:00:00Z" }
The token has incorrect permissions
Send us a screenshot of the permissions you have set up so that we can verify that the permission has been correctly set.
Incorrect Syntax
On occasion, customers will attempt to use an API Token with an API Key syntax. Ensure you are using the Bearer option, rather than the Email and API key pair.
curl -X GET "https://api.cloudflare.com/client/v4/user/tokens?page=1&per_page=20&direction=desc" \ -H "Authorization: Bearer 8M7wS6hCpXVc-DoRnPPY_UCWPgy8aea4Wy6kCe5T"
Incorrect User Permissions when attempting to create Token
You cannot create a token for yourself exceeding the permission granted to you on your account. For example, if you have been granted an Admin (Read only) role, you would need your Super Administrator to update your role so that you could create a token for yourself.