Overview
PrometheX uses Privy for authentication. Users log in via email, social accounts, or crypto wallets. Privy issues a JWT that authenticates all subsequent API requests.Auth Flow
User authenticates via Privy SDK
Email, social login, or wallet connection. Privy handles MFA and account linking.
PrometheX validates the token
Checks audience, issuer, expiry, and signature against Privy’s public keys.
Token Format
The Privy JWT is a standard JWT with these claims:| Claim | Value | Description |
|---|---|---|
alg | ES256 | Signing algorithm (ECDSA P-256) |
iss | privy.io | Issuer |
aud | Your Privy App ID | Audience — must match your app |
sub | did:privy:... | User’s Privy decentralized identifier |
exp | Unix timestamp | Token expiration |
iat | Unix timestamp | Token issued at |
Using the Token
Include the JWT in every authenticated request:First-Time Login
When a user authenticates for the first time, register them with PrometheX:User’s smart account address (ERC-4337 account).
Referral code from another user.
Display name.
Avatar image URL.
PrometheX internal user ID.
true if the user was just created. false for returning users.Endpoint Auth Requirements
Public (no auth)
| Endpoint | Description |
|---|---|
GET /api/v1/market/get-markets | List markets |
GET /api/v1/market/get-market-detail | Market detail |
GET /api/v1/market/get-hot-markets | Trending markets |
GET /api/v1/market/get-price-history | Price charts |
GET /api/v1/market/get-market-trades | Trade history |
Authenticated
| Endpoint | Description |
|---|---|
POST /api/v1/user/login | Register / login |
POST /api/v1/market/place-order | Buy or sell tokens |
POST /api/v1/market/claim-market-result | Claim winnings |
POST /api/v1/market/add-liquidity | Add liquidity |
POST /api/v1/market/remove-liquidity | Remove liquidity |
POST /api/v1/sse/connect | SSE stream |
POST /api/v1/user/set-avatar | Update avatar |
POST /api/v1/user/set-username | Update username |
POST /api/v1/market/follow-market | Follow a market |
Each endpoint’s reference page indicates whether authentication is required.
Token Expiry & Refresh
Privy JWTs have a short lifespan. The Privy SDK handles token refresh automatically. If you receive a401 or error code 110303 (PRIVY), the token may be expired — refresh it via the Privy SDK and retry.
