API Authentication
REST API wallet-based auth — nonce, verify, refresh endpoints.
API Authentication
Recur uses wallet-based authentication. The subscriber proves wallet ownership by signing a server-generated nonce, then receives a JWT for subsequent API calls.
Flow overview
POST /auth/nonce
Request a nonce for the given wallet.
Request:
Response (200):
POST /auth/verify
Submit the signed message to receive a JWT.
Request:
Response (200):
Error (401):
POST /auth/refresh
Exchange a refresh token for a new JWT.
Request:
Response (200):
Using the JWT
Include the token in the Authorization header for all authenticated endpoints:
Token lifetime
- JWT: Short-lived (typically 15 minutes)
- Refresh token: Long-lived (typically 7 days)
When the JWT expires, use the refresh endpoint to obtain a new pair without re-signing.
SDK shortcut
The RecurClient.authenticate(wallet) method handles the entire flow in one call: