Authentication Error on Cloudflare API calls for Turnstile

Hi. All my API calls to Turnstile endpoints are returning code 10000 and “Authentication error”. I have these permissions on my token for my account: Turnstile:Edit, Turnstile:Read. I made the following requests:

❯ curl --request PUT \
  --url https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/challenges/widgets/<SITEKEY> \
  --header 'Authorization: Bearer <TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
    "bot_fight_mode": false,
    "clearance_level": "managed",
    "domains": [],
    "mode": "managed",
    "name": "Test",
    "offlabel": true
  }'

{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
❯ curl --request GET \
  --url https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/challenges/widgets \
  --header 'Authorization: Bearer <TOKEN>' \
  --header 'Content-Type: application/json'

{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}

Not sure why this is happening.

Hi @srijonauth0 are you the superadmin on the account? If so and you’re still encountering this, can you open an Account ticket with the Support team and share your ticket number here?

You can open an Account ticket here, https://dash.cloudflare.com/?to=/:account/support

@cloonan I’m a Administrator on the account. Do I need Super Admin role to interact with the API?

You don’t have to be the superadmin to use the api, but you do need to have a role that lets you perform the necessary actions and the token you’re using needs to have the appropriate permissions.

If the problem persists, ask the superadmin to generate a new token and then try again. Before you try again, clear your browser cache and try in incognito mode.
Here are the steps:

  1. Have the superadmin navigate to the API Tokens page.
  2. Check if the token they shared with you has the necessary permissions.
  3. If not, have them either edit the token or create a new one with the required permissions.
  4. Use this token in your API calls.

If that does not help, can you open an Account ticket with the Support team and share your ticket number here? You can open an Account ticket here, https://dash.cloudflare.com/?to=/:account/support.