Docs Concepts

Authentication

Every request carries an API key as a bearer token.

Send your key

Put the key in the Authorization header of every request. There is no other way to authenticate, and keys never go in the URL.
curl
curl "https://api.trendwatching.com/v1/innovations?limit=1" \
  -H "Authorization: Bearer $TW_API_KEY"

Look after your keys

Create keys in API keys. The full key is shown once, when you create or rotate it, so store it in a secret manager or an environment variable. Keep keys on your server: anyone who sees a key in a web page or app can use it.

Rotate and revoke

Rotate issues a new key and stops the old one, for a planned change. Revoke stops a key at once, for a key that may have leaked. Either way, requests with the old key fail straight away. Use separate keys for separate systems so you can retire one without touching the others; each key's requests show up separately under Usage.

When it fails

No header gives 401 missing_api_key. A wrong, revoked or expired key gives 401 invalid_api_key. A good key on an account whose plan isn't active gives 403 subscription_inactive.