Triagebellfor Sentry
Guide

Sentry auth tokens and the Sentry API: which token to use

By the Triagebell team · Updated · 3 min read · How we check guides

Short answer

A Sentry auth token is a bearer token you send as Authorization: Bearer $SENTRY_AUTH_TOKEN to the REST API under https://sentry.io/api/0/. Use an organization token for CI and Sentry CLI (fixed permissions), an internal integration when a service needs wider org-level API access with scopes you choose, and a personal (user) token for scripts that act as you. Create one token per use, so you can revoke one without breaking the others.

Steps

  1. Pick the token typeOrganization token for CI and Sentry CLI, internal integration for org-wide API work, personal token for your own scripts.
  2. Create itGo to Settings, Developer Settings for org tokens and integrations, or Personal Tokens in the account menu.
  3. Choose minimal scopesFor personal tokens and integrations, grant only the read or write scopes the job needs.
  4. Store it as a secretCopy it at once into your CI secret store as SENTRY_AUTH_TOKEN; organization tokens are shown only once.
  5. Test with curlCall the projects endpoint on your region's domain with Authorization: Bearer and check for a 200 response.

The three kinds of Sentry auth token

Organization tokenInternal integrationPersonal (user) token
Bound toOne organization, all its projectsOne organization, all its projectsA user: every org and project they can access
PermissionsFixed, not customizableChosen and editableScopes chosen at creation, not editable later; never more than the user's own role
Made forCI and Sentry CLI (releases, source maps)Full API access on behalf of the org, for example creating projectsAPI calls as one person
WhereSettings, Developer Settings, Organization TokensSettings, Developer Settings, your integrationPersonal Tokens, from the account menu at the top left
Formatsntrys_ followed by a payload, about 180 to 250 characters64 hex characterssntryu_ plus 64 hex characters

Organization tokens are shown in full only once, right after you create them. Any member can create one; owners get a security email, and only owners and managers can revoke them. Internal integration tokens don't expire on their own, and each integration can hold up to 20 at a time. Don't use a personal token in CI: it stops working when its creator leaves the organization. Legacy API keys (HTTP Basic auth, 32 hex characters) still work where they exist but are disabled for new accounts.

Scopes

Personal tokens and internal integrations carry scopes. The Sentry API maps them to HTTP methods:

ResourceGETPUT / POSTDELETE
Organizationsorg:readorg:writeorg:admin
Projectsproject:readproject:writeproject:admin
Teamsteam:readteam:writeteam:admin
Membersmember:readmember:writemember:admin
Issues & eventsevent:readevent:write (PUT only)event:admin
Releasesproject:releasesproject:releasesproject:releases

org:ci covers CI and deployment work such as uploading source maps, creating releases and managing code mappings. Events are immutable: event:write and event:admin act on issues, and an event goes away only when its issue is deleted. One trap: a personal token with project:releases can create releases and upload artifact bundles for any project in the organization, even ones in teams the user isn't on.

For a read-only triage script, org:read, project:read and event:read are enough. Add event:write only if it resolves or assigns issues.

Call the Sentry REST API

The current API version is v0 and lives under /api/0/. Send the token in the Authorization header:

export SENTRY_AUTH_TOKEN=sntryu_...
curl -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
  https://sentry.io/api/0/organizations/acme/projects/

Regions. sentry.io stores data in the US (Iowa) or the EU (Frankfurt), chosen when the organization is created and never changeable. Use the region domain so requests are processed in your data storage location, which is also usually faster:

# US organization
curl -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
  https://us.sentry.io/api/0/organizations/acme/projects/

# EU organization
curl -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
  https://de.sentry.io/api/0/organizations/acme/projects/

Account-level data such as users, organization settings and DSN keys is stored in the US and served from sentry.io.

Pagination. List endpoints return a Link header with rel="previous" and rel="next" URLs, each with a results="true" or results="false" flag and a cursor such as 0:100:0. Follow rel="next" until results="false"; a next link is always present, so checking only for its existence loops forever.

Rate limits. Every response carries X-Sentry-Rate-Limit-Limit, X-Sentry-Rate-Limit-Remaining, X-Sentry-Rate-Limit-Reset (UTC epoch seconds), X-Sentry-Rate-Limit-ConcurrentLimit and X-Sentry-Rate-Limit-ConcurrentRemaining. Limits are per caller and per endpoint, and are tracked by identity, so extra tokens for the same user don't raise them.

When a token is rejected, check in this order

  1. Header format. It must be Authorization: Bearer <token>. Authorization: DSN works only on the few endpoints that document it, and a DSN is not an auth token.
  2. Wrong token type. An organization token can't do things outside CI work, such as creating a project. Use an internal integration.
  3. Missing scope. Personal token scopes can't be edited; create a new token with the scope you need and revoke the old one.
  4. Wrong organization slug or region. Use the slug from your organization's URL, and the de.sentry.io domain for an EU organization.
  5. Revoked token. The creator left (personal token), or an owner or manager revoked the organization token.
  6. Role limits. A personal token can never do more than its user's role allows.

The next mistake is pasting a full token into a ticket or log while debugging. Sentry publishes the token formats so secret scanners can find sntrys_ and sntryu_ strings; revoke any token that leaks.

Questions

Where do I find my Sentry auth token?

You can't retrieve an organization token after creation; only its last characters are shown. Create a new one under Settings, Developer Settings, Organization Tokens and revoke the old one if it is lost.

Which token should Sentry CLI use?

An organization token. It is designed for CI and Sentry CLI, has fixed permissions, and keeps working when people leave the organization.

Do Sentry auth tokens expire?

Internal integration tokens don't expire automatically; revoke them when you no longer need them. Sentry's auth token docs don't describe an automatic expiry for organization or personal tokens.

What is the Sentry API base URL?

https://sentry.io/api/0/, or the region domain us.sentry.io or de.sentry.io for organization data, which keeps requests in your data storage location.

Sources

  1. Auth Tokensdocs.sentry.io
  2. API Authenticationdocs.sentry.io
  3. Permissions & Scopesdocs.sentry.io
  4. Token and Credential Formatsdocs.sentry.io