/v1/referral/activate-tx and for notifications.
Auth does not replace Solana transaction signing. Phoenix instructions still need the correct wallet, authority, position authority, or fee payer signature depending on the instruction.
Lifecycle
- Request a challenge from Phoenix.
- Sign the challenge with the authority wallet.
- Exchange the signature for an auth response.
- Use
Authorization: Bearer <access_token>on authenticated routes. - Refresh with
POST /v1/auth/refreshbefore the access token expires. Refresh returns a new access token and a new refresh token. - Reauthenticate when refresh fails with a terminal auth error, or when the refresh token has expired.
expires_in and refresh_expires_in are in seconds, counted from when the response was issued.
Session lifetime
A session moves through these states:
- Signed out. No session exists. Sign in to create one.
- Active. The access token is valid. Authenticated requests succeed.
- Access token expired. Authenticated requests fail with
401. CallPOST /v1/auth/refreshwith the refresh token. The refresh route does not need a valid access token. - Refreshed. Refresh returns a new access token and a new refresh token, and the session is active again. The new refresh token is valid for 7 days from the refresh, so a session stays alive for as long as you refresh at least once every 7 days.
- Ended. The session ends when you call
POST /v1/auth/logout, when 7 days pass without a refresh, or when Phoenix revokes it. Refresh then fails with a terminal error and the user must sign in again.
- A refresh token can be used once. Refresh replaces both tokens, so store the new pair before making the next request.
- If the same refresh token is sent again within a short window after it was used, for example by two tabs refreshing at once, the API returns the same new token pair. After that window, reusing it fails with
invalid_refresh_token. - The previous access token is accepted for 30 seconds after a refresh, so requests already in flight do not fail.
POST /v1/auth/logoutrevokes the session and returns204. The refresh token stops working immediately.
Endpoints
Routes that can benefit from or require auth:
- Referral-code onboarding: see Trader Onboarding.
- Notifications over REST or WebSocket.
- Any protected account, user, or builder workflow marked with bearer auth in the API reference.
- Authenticated integrations that need higher rate limits than anonymous public traffic.
Wallet login
This TypeScript example is written for a browser wallet that supportssignMessage.
Refresh
With a managed SDK session, refresh is normally automatic before authenticated HTTP and WebSocket requests. Manual refresh is still useful when you want to force rotation after loading a saved session.invalid_refresh_tokenrefresh_expiredsession_missing