Why am I getting 401 'Missing Authorization: Bearer <apiKey>'?

The request had no API key. Add the header Authorization: Bearer YOUR_KEY and send it again.

Last updated

Fix

curl -s https://api.clearrun.net/api/score \
  -H "Authorization: Bearer $CLEARRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "responseText": "Our API never stores customer data." }'

If you use $CLEARRUN_API_KEY, check it is set: echo ${CLEARRUN_API_KEY:0:5} should print crun_.

Common causes

  • The variable is empty in this shell or CI job.
  • A proxy or tool removed the header.
  • Bearer is missing before the key.