Skip to main content
Manually refresh your authentication token using the stored refresh token.

Usage

sentry auth refresh [options]

Description

Manually refresh your authentication token using the stored refresh token. Token refresh normally happens automatically when making API requests. Use this command to force an immediate refresh or to verify the refresh mechanism is working correctly.
This command only works with OAuth sessions. API tokens and environment variable tokens cannot be refreshed.

Options

--json
boolean
default:"false"
Output result as JSON. The JSON format includes success, refreshed, message, expiresIn, and expiresAt fields.
--force
boolean
default:"false"
Force refresh even if token is still valid. By default, the command only refreshes if the token is expired or about to expire.

Examples

Basic refresh

sentry auth refresh
Expected output:
✓ Token refreshed successfully. Expires in 59 minutes.

Force refresh

sentry auth refresh --force
Expected output:
✓ Token refreshed successfully. Expires in 60 minutes.

Token still valid

If the token doesn’t need refreshing:
sentry auth refresh
Expected output:
Token still valid (expires in 45 minutes).
Use --force to refresh anyway.

JSON output

sentry auth refresh --json
Expected output:
{
  "success": true,
  "refreshed": true,
  "message": "Token refreshed successfully",
  "expiresIn": 3600,
  "expiresAt": "2026-03-05T12:00:00.000Z"
}
Token refresh happens automatically when you run commands that make API requests, so you rarely need to run this command manually.

Limitations

Environment variable tokens

If you’re using SENTRY_AUTH_TOKEN or SENTRY_TOKEN environment variables:
SENTRY_AUTH_TOKEN=sntrys_xxx sentry auth refresh
Expected output:
Error: Cannot refresh an environment variable token.
Token refresh is only available for OAuth sessions.
Update SENTRY_AUTH_TOKEN to change your token.

Manual API tokens

If you logged in with sentry auth login --token:
sentry auth refresh
Expected output:
Error: No refresh token available. You may be using a manual API token.
Run 'sentry auth login' to authenticate with OAuth and enable auto-refresh.

Build docs developers (and LLMs) love