API and integrationsI get 401 API_KEY_INVALID

I get 401 API_KEY_INVALID

Fix Opttab API calls that fail with 401 API_KEY_INVALID.

401 API_KEY_INVALID means the API could not accept the key you sent. Opttab gives the same answer for every cause on purpose, so check each one.

Check the header

The request must send exactly Authorization: Bearer opt_live_…, with one space after Bearer. A browser session, an X-API-Key header or an ?api_key= parameter does not work.

curl https://api.opttab.com/v1/external/workspace \
  -H "Authorization: Bearer opt_live_xxxxxxxx"

Check the secret

Make sure you copied the whole secret, with no extra spaces or line breaks.

Check the key in Settings › API

Ask an owner or admin to open Settings › API. If the key is gone, it was revoked. If Expiration reads Expired, its date has passed.

Create a new key

If you still get 401, create a new key and update your tool. See API keys.

See also: Authentication, limits and errors.