Developer Documentation
API Reference.
Complete reference for the PaperDEX v2 REST API. Execute spot trades atomically on Sepolia testnet, query live orderbook markets, and read on-chain portfolios.
All public programmatic endpoints are versioned under /api/v2/*.
Pass your Key ID and Raw Secret joined by a colon. Validated via constant-time SHA-256 hash.
Limits apply per API key. Returns HTTP 429 and Retry-After on breach.
Get All Markets
Retrieve real-time market data for all supported tokens on PaperDEX, including spot prices, 24-hour price changes, and 24-hour trading volumes.
Response Example (200 OK)
{
"success": true,
"data": [
{
"symbol": "BTCP",
"name": "Bitcoin Paper",
"price": 98450.25,
"change24h": 3.12,
"volume24h": 42500000000,
"sparkline": [
96200,
97100,
96800,
98450.25
]
},
{
"symbol": "ETHP",
"name": "Ethereum Paper",
"price": 3890.1,
"change24h": -0.45,
"volume24h": 18200000000,
"sparkline": [
3920,
3905,
3880,
3890.1
]
},
{
"symbol": "SOLP",
"name": "Solana Paper",
"price": 215.8,
"change24h": 5.64,
"volume24h": 6800000000,
"sparkline": [
204,
208,
212,
215.8
]
},
{
"symbol": "USDTP",
"name": "Tether Paper USD",
"price": 1,
"change24h": 0,
"volume24h": 85000000000,
"sparkline": [
1,
1,
1,
1
]
}
]
}curl -X GET "https://paper-dex-beta.vercel.app/api/v2/markets" \ -H "Authorization: pdx_id_<YOUR_KEY_ID>:<YOUR_SECRET>"
Get Single Market
Retrieve current price, percentage change, and volume details for a specific trading asset.
Parameters
Response Example (200 OK)
{
"success": true,
"data": {
"symbol": "BTCP",
"name": "Bitcoin Paper",
"price": 98450.25,
"change24h": 3.12,
"volume24h": 42500000000,
"sparkline": [
96200,
97100,
96800,
98450.25
]
}
}curl -X GET "https://paper-dex-beta.vercel.app/api/v2/markets/BTCP" \ -H "Authorization: pdx_id_<YOUR_KEY_ID>:<YOUR_SECRET>"
Get User Portfolio
Returns real-time on-chain token balances and computed USD valuations for the wallet associated with the API key.
Response Example (200 OK)
{
"success": true,
"data": [
{
"symbol": "USDTP",
"balance": "99727.43006",
"price": 1,
"change24h": 0,
"usdValue": "99727.43"
},
{
"symbol": "BTCP",
"balance": "0.50000",
"price": 98450.25,
"change24h": 3.12,
"usdValue": "49225.13"
},
{
"symbol": "ETHP",
"balance": "4.25000",
"price": 3890.1,
"change24h": -0.45,
"usdValue": "16532.93"
},
{
"symbol": "SOLP",
"balance": "25.00000",
"price": 215.8,
"change24h": 5.64,
"usdValue": "5395.00"
}
]
}curl -X GET "https://paper-dex-beta.vercel.app/api/v2/portfolio" \ -H "Authorization: pdx_id_<YOUR_KEY_ID>:<YOUR_SECRET>"
Execute Spot Trade
Executes an atomic spot market buy or sell order directly on the Sepolia blockchain. The server handles on-chain transaction submission with guaranteed price quotes. No MetaMask popups or client-side private keys required.
Parameters
Response Example (200 OK)
{
"success": true,
"data": {
"txHash": "0x7a83f9e421ba89...",
"blockNumber": 7824102,
"token": "BTCP",
"side": "BUY",
"amount": "0.100000000000000000",
"price": 98450.25,
"usdValue": "9845.03"
}
}curl -X POST "https://paper-dex-beta.vercel.app/api/v2/trade" \
-H "Authorization: pdx_id_<YOUR_KEY_ID>:<YOUR_SECRET>" \
-H "Content-Type: application/json" \
-d '{"token": "BTCP", "side": "BUY", "amount": "0.1"}'Standard Error Codes
When an API request fails, the response returns standard HTTP status codes along with a JSON error payload containing a specific machine-readable code.
| HTTP Status | Error Code | Description |
|---|---|---|
| 401 Unauthorized | API_KEY_INVALID | Missing or malformed Authorization header. Expected format pdx_id_<id>:<secret> |
| 401 Unauthorized | API_KEY_NOT_FOUND | The provided API key ID does not exist in the database. |
| 401 Unauthorized | API_KEY_EXPIRED | The API key has passed its configured expiration date. |
| 401 Unauthorized | API_KEY_REVOKED | The key owner manually revoked this API key. |
| 403 Forbidden | API_KEY_SCOPE_DENIED | The endpoint requires TRADE scope, but the provided key only has READ_ONLY scope. |
| 429 Too Many Requests | RATE_LIMIT_EXCEEDED | Exceeded the rate limit window (300 req/15m for read, 100 req/15m for trade). |
| 400 Bad Request | INSUFFICIENT_BALANCE | User does not possess sufficient USDTP (for buy) or token (for sell). |
| 400 Bad Request | LIQUIDITY_UNAVAILABLE | The PaperDEX vault does not currently hold enough inventory to fill the order. |
