Error in documentation

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

What is the issue or error you’re encountering

Wrong example

What steps have you taken to resolve the issue?

Id the docs there is an example:
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/d1/database/$DATABASE_ID/query
-H ‘Content-Type: application/json’
-H “X-Auth-Email: $CLOUDFLARE_EMAIL”
-H “X-Auth-Key: $CLOUDFLARE_API_KEY”
-d ‘{
“sql”: “SELECT * FROM myTable WHERE field = ? OR field = ?;”,
“params”: [
“firstParam”,
“secondParam”
]
}’
In fact, correct auth header is Authorization: Bearer $CLOUDFLARE_API_KEY

X-Auth-Email and X-Auth-Key are for using the Global API Key (not recommended)
Authorization like you show is for using API Tokens. It’s still a bit silly the default example is the more insecure one though…

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.