Both flows begin with a wallet signature. The sign-in message includes the current Terms of Use and related disclosures. Successful verification records acceptance of that terms version.
Create a browser wallet session
1
Request a challenge
Send the wallet address to The response contains
POST /auth/challenge.data.challenge_id, data.nonce, and data.message. Keep the challenge ID for verification.2
Sign the returned message
Ask the wallet to sign the exact UTF-8 bytes in
data.message. Do not reconstruct, trim, or normalize the message.Signing proves control of the address. It does not submit a transaction or spend a token record.3
Verify the signature
Send the address, signature, and returned challenge ID to A successful response sets access and refresh tokens as httpOnly cookies. The JSON body returns the wallet address,
POST /auth/verify. The example stores the returned cookies in session.cookies.expires_at, server_time, session details, and a CSRF token. Use expires_at - server_time to calculate the remaining lifetime.4
Send authenticated requests
Include the cookie jar on subsequent requests. Add the CSRF token in
X-CSRF-Token for state-changing session requests.POST /auth/refresh rotates the refresh token and sets fresh cookies. If two refreshes race, one can return 409; retry the original API request after the successful refresh completes.
Create an API token for a backend
API-token creation requires an authenticated browser session and acceptance of the current Terms of Use. If a protected request returns403 with code terms_required, repeat the wallet sign-in flow with a new challenge.
ss_... token once. Store it before closing the response. Later list responses expose only token metadata and a prefix.
Use the token as a bearer credential:
Credential boundaries
- A valid wallet signature establishes wallet control, not administrator authority.
- API tokens cover protected data and route endpoints. API-token management and administrative endpoints require a wallet session.
- WebSocket clients can request a short-lived ticket with a browser session or API token. They must renew authentication before the 60-second ticket expires.
- Never place session cookies, CSRF tokens, or API tokens in URLs or logs.
- Revoke a backend token with
DELETE /api-tokens/{id}when it is no longer needed. - Use
GET /auth/sessionsandPOST /auth/sessions/{session_id}/revoketo manage wallet sessions. - Use
POST /auth/logoutfor the current session orPOST /auth/logout-allfor every wallet session.