Authentication
Overview
The Issuance and Redemption API uses a two-step authentication process:
API Key Authentication: Your partner API key identifies your organization
JWT Token Authentication: JWT tokens authorize operations for specific wallet addresses
API Key Authentication
API Key Format
<keyId>.<secret>Components:
keyId: Public identifier (e.g.,
partner_abc123)secret: Private secret (e.g.,
sk_live_1234567890abcdef)
Using API Keys
API keys are used only for JWT token issuance and refresh operations.
Header Format:
X-API-Key: <keyId>.<secret>Endpoints that accept API keys:
POST /token- Issue new JWT token (modern)POST /token/refresh- Refresh JWT token (modern)
Obtaining an API Key
To request a partner API key, contact [email protected] with:
Your organization name
Use case description
Expected transaction volume
Technical contact information
API Key Security
Store API keys in environment variables or secret management systems
Never commit API keys to version control
Rotate API keys regularly
JWT Token Authentication
Token Structure
JWT tokens are RS256-signed JSON Web Tokens containing:
Key Claims:
sub: Wallet address (lowercase)exp: Expiration timestamp (1 year from issuance)verified_credentials: Array of verified wallet addressesazp: Partner IDhttps://universal.xyz/partner_id: Your partner identifierhttps://universal.xyz/type: User type (B2Bfor partners)
Obtaining JWT Tokens
Request:
Response:
Using JWT Tokens
Include the JWT token in the Authorization header for all API requests:
Example:
Token Validation
The API validates:
✅ Token signature using RS256 algorithm
✅ Token expiration (
expclaim)✅ Issuer (
issclaim)✅ Audience (
audclaim)✅ Wallet address matches verified credentials
✅ User wallet status is active
Wallet Address Binding
Important: Each JWT token is bound to a specific wallet address. All operations performed with that token will be associated with the wallet address specified in the sub claim.
To use multiple wallet addresses:
Token Refresh
Refresh tokens before expiration to maintain uninterrupted access:
Request:
Response:
Error Responses
Invalid API Key
Malformed API Key
Expired JWT Token
Invalid JWT Token
Inactive Wallet
Best Practices
Token Caching: Cache JWT tokens and reuse them until near expiration
Proactive Refresh: Refresh tokens before they expire (e.g., when 90% of lifetime has elapsed)
Error Handling: Implement retry logic for 401/403 errors after token refresh
Secure Storage: Store tokens securely, never in client-side JavaScript
HTTPS Only: Always use HTTPS for API requests
Wallet Management: Track which token corresponds to which wallet address
Next Steps
Last updated