tutorialintegrationssentry

How to create a Sentry auth token (with the right scopes)

Step-by-step: create a Sentry auth token, pick the minimal read-only scopes (project:read, event:read, org:read), test it with curl, and use it with self-hosted Sentry.

Hauke Jung
|August 06, 2026|
2 min read

A Sentry auth token authenticates requests to Sentry's web API — issue counts, event volume, session health. The most common mistake is over-scoping it: for reading stats you need exactly three read scopes, nothing more.

Create the token

  1. Go to sentry.io/settings/account/api/auth-tokens — or the same path on your self-hosted instance
  2. Click Create New Token
  3. Grant these scopes: project:read, event:read, and org:read
  4. Click Create Token and copy the value — Sentry shows it only once

Skip everything ending in :write or :admin. A stats consumer never needs them, and a leaked read-only token can't resolve issues, change settings, or delete projects — it can only look.

Test it with curl

This lists the organizations the token can see and confirms it works:

bash
curl -s "https://sentry.io/api/0/organizations/" \
  -H "Authorization: Bearer YOUR_TOKEN"

From there, the endpoints you'll actually want are per-project:

bash
# unresolved issue count
curl -s "https://sentry.io/api/0/projects/ORG_SLUG/PROJECT_SLUG/issues/?query=is:unresolved" \
  -H "Authorization: Bearer YOUR_TOKEN"

# events received, hourly resolution
curl -s "https://sentry.io/api/0/projects/ORG_SLUG/PROJECT_SLUG/stats/?stat=received&resolution=1h" \
  -H "Authorization: Bearer YOUR_TOKEN"

Self-hosted Sentry

The token flow is identical on a self-hosted instance — create it under the same account settings path and swap https://sentry.io for your own host in every request. Anything that consumes the token just needs a configurable API host.

What this unlocks on a public page

Error health is a trust signal: a project with a visible, low unresolved-issue count and a healthy crash-free rate looks maintained. The infra.page Sentry widget uses exactly the three scopes above to show unresolved issues, 24h event volume, and crash-free session rate — on a page where you decide what's public and what stays private. It works with sentry.io and self-hosted Sentry alike.

Related setup guides: get your beehiiv API key and create a read-only Stripe key.

Related Posts