Documentation Index
Fetch the complete documentation index at: https://docs.polymarket.us/llms.txt
Use this file to discover all available pages before exploring further.
For authentication setup and code examples, see the main Authentication guide.
Common Authentication Errors
â401 Unauthorizedâ
Your JWT token is missing, invalid, or expired. Check:- Is the token included in the
Authorization: Bearer <token>header? - Has the token expired? Tokens are typically valid for 180 seconds (3 minutes)
- Is the token format correct? Should be
Bearer eyJ... - Was the token issued by the correct Auth0 domain for your environment?
â403 Forbiddenâ
Your token is valid but doesnât have the required scope for the endpoint. Check:- Decode your token at jwt.io to see which scopes you have
- Verify the endpoint requires a scope you have (see Authentication scopes)
- Scopes must be space-separated in the
scopeclaim (e.g.,"read:orders write:orders")
âinvalid_clientâ
JWT signature verification failed when requesting an access token from Auth0. Causes:- Private key doesnât match the public key registered with Polymarket
- Wrong private key file being used
- Private key file corrupted or invalid format
âinvalid_client_assertionâ
The client assertion JWT is malformed or has incorrect claims. Common causes:- Wrong
audclaim (must behttps://pmx-{env}.us.auth0.com/oauth/token, NOT the API URL) - Expired
expclaim (expiration in the past) - Missing required claims (
iss,sub,aud,iat,exp,jti) - Reused
jti(must be unique for each request) - Wrong signing algorithm (must be RS256)
Environment-Specific Issues
Using Wrong Environment Credentials
Problem: Using development credentials in production (or vice versa). Symptoms:invalid_clienterrors401 Unauthorizedon API calls- Token works in one environment but not another
- Separate key pairs (different public/private keys)
- Separate Client IDs
- Separate Auth0 domains
- Separate API audiences
| Environment | Auth Domain | API Audience |
|---|---|---|
| Development | pmx-dev01.us.auth0.com | https://api.dev01.polymarketexchange.com |
| Pre-production | pmx-preprod.us.auth0.com | https://api.preprod.polymarketexchange.com |
| Production | pmx-prod.us.auth0.com | https://api.prod.polymarketexchange.com |
Cannot Reuse Keys Across Environments
Environments are completely isolated. You cannot:- Use the same private key in multiple environments
- Use preprod credentials in production
- Transfer Client IDs between environments
Token Expiration Issues
Token Works Sometimes But Not Others
Cause: Token is expiring mid-session. Solution: Implement proactive token refresh:Token Expired Immediately After Creation
Cause: System clock is incorrect. Check: Is your system time synchronized?JWT Claim Issues
Wrong Audience Claim
Common mistake: Using API URL as theaud claim in the client assertion.
Incorrect:
Reused JTI
Problem: Using the samejti (JWT ID) for multiple requests.
Cause: jti is meant to prevent replay attacks and must be unique per request.
Solution: Generate a new UUID for each token request:
Verifying Token Claims
Decode your access token to check what scopes and claims you have:Authorization vs Authentication
Authentication proves who you are (which firm). Authorization determines what you can do (which accounts, which scopes). You may be authenticated but not authorized to:- Access specific trading accounts
- Call certain endpoints (missing scopes)
- Perform certain actions (insufficient permissions)
Missing or Incorrect x-participant-id
Errors on Trading, Positions, or Report Endpoints
Problem: Requests to account-scoped endpoints fail even though your access token is valid. Cause: Thex-participant-id header is missing or contains an incorrect value. This header is required for all account-scoped endpoints (trading, positions, reports) but is not required for market data, order book, or reference data endpoints.
Solution: Include the x-participant-id header in your requests:
Finding Your Participant ID
Institutional traders (DMA): Your participant ID is provided during onboarding. To discover or verify it:- Call
GET /v1/whoamito see your firm identity - Call
GET /v1/usersto list all users and their IDs
- Call
GET /v1/usersto see all users you can trade on behalf of
Endpoints That Do NOT Require x-participant-id
These endpoints only require a valid access token with the appropriate scope:- Market data:
/v1/orderbook/*, market data streaming - Reference data:
/v1/refdata/* - Trade statistics:
/v1/report/trades/stats - Health check:
/v1/health
Cryptographic Issues
Wrong Key Format
Private keys must be in PEM format:Wrong Algorithm
You must use RS256 (RSA with SHA-256) to sign your JWT. Donât use:- HS256 (HMAC - symmetric key)
- Other RSA variants (RS384, RS512, PS256, etc.)
Testing Authentication
Test your authentication setup: 1. Verify you can create a client assertion:Getting Help
If authentication issues persist:- Verify your credentials match your environment
- Decode and inspect your JWTs (client assertion and access token)
- Check system clock is synchronized
- Test with curl commands to isolate client code issues
- Contact support with:
- Environment (dev, preprod, prod)
- Client ID
- Error messages
- Decoded JWT claims (never share your private key!)