Skip to content

Authentication

Every API request is authenticated with an API key sent in the Authorization header.

You need to be an admin in your organization to view, create or revoke API keys. Other members see a message that they need admin access instead of the key list.

  1. In the Safety Radar dashboard, open Settings.
  2. Under Account, select API Keys.
  3. Select New API Key.
  4. Enter a Name that says what the key is for, for example HR system sync.
  5. Choose an Expiration: Never (the default), 30 days, 90 days or 1 year. The key stops working at that time.
  6. Select Create.
  7. The new key is shown once. Select Copy, store the key in your integration’s secret store, then select Done.
  • A key has admin access to your organization’s data through the API. Treat it like a password.
  • Changes made through the API are attributed to the person who created the key.
  • A key works until it is revoked or, if you set an expiration, until it expires. A key set to Never expire works until it is revoked. You can’t change a key’s expiration after you create it; create a new key instead.
  • The API Keys page shows, for each key, when it was last used (updated at most once a minute) and when it expires. A key that expires within 7 days is highlighted, and an expired key is marked Expired.
  • A key works for one organization only.
  • Safety Radar stores only a hash of each key, so nobody can see a key again after it is created. The API Keys page shows the first characters of each key to help you tell them apart. If a key is lost, revoke it and create a new one.

Put the key in the Authorization header with the Bearer scheme:

Authorization: Bearer YOUR_API_KEY

The Bearer scheme is required. The word Bearer is not case-sensitive (bearer works too), but the header must be exactly the scheme, a space and the key. A key sent on its own, with another scheme, or with extra text after it is refused with 401.

Terminal window
curl https://safe-api.safetyradar.com/v2/events?limit=10 \
--header "Authorization: Bearer $SAFETY_RADAR_API_KEY"

A missing, malformed, unknown, revoked or expired key returns 401 Unauthorized:

{
"code": "unauthorized",
"message": "Invalid API token"
}

The message tells you which case it is:

message Cause
Missing authorization header No Authorization header was sent.
Invalid authorization header format. Expected: Bearer <API key> The header is not Bearer followed by the key.
Invalid API token The key is unknown or has been revoked.
API key has expired The key’s expiration date has passed. Create a new key.
  • Store keys as secrets. Use your platform’s secret manager or environment variables. Never commit a key to source control or put it in client-side code such as a browser or mobile app.
  • Use one key per integration. Name each key after the system that uses it, so you can revoke one integration without breaking the others.
  • Rotate keys. To replace a key, create a new one, deploy it to your integration, then revoke the old one. If a key has an expiration, rotate it before that date: requests with an expired key fail with 401.
  • Set an expiration on keys for short-lived or trial integrations, so they stop working on their own.
  • Revoke keys you no longer need. On the API Keys page, select Revoke on the key and confirm. Requests with that key fail with 401 straight away. Use the last used time on the API Keys page to spot keys that nothing uses any more.
  • Review keys when people leave. Changes made with a key are attributed to the person who created it. When that person leaves, replace their keys with ones created by a current admin, and revoke the old keys.

Earlier integrations sent an X-Team header to choose a team. The API is now scoped to the whole organization, so the header is no longer needed and is ignored. Existing integrations that still send it keep working. New integrations should not send it.

Version bd999fd · Released November 23, 2026