PaperDEX
/
Connect Wallet

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.

Base Endpoint URL
https://paper-dex-beta.vercel.appCopy

All public programmatic endpoints are versioned under /api/v2/*.

Header Authentication
Authorization: pdx_id_<id>:<secret>

Pass your Key ID and Raw Secret joined by a colon. Validated via constant-time SHA-256 hash.

Rate Limits & Quotas
Read: 300 / 15mTrade: 100 / 15m

Limits apply per API key. Returns HTTP 429 and Retry-After on breach.

GET/api/v2/marketsREAD_ONLY
Rate Limit: 300 req / 15 min

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.

No URL or body parameters required.

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/api/v2/markets/:symbolREAD_ONLY
Rate Limit: 300 req / 15 min

Get Single Market

Retrieve current price, percentage change, and volume details for a specific trading asset.

Parameters

symbolstring (path)required
Token symbol (BTCP, ETHP, SOLP, USDTP)

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/api/v2/portfolioREAD_ONLY
Rate Limit: 300 req / 15 min

Get User Portfolio

Returns real-time on-chain token balances and computed USD valuations for the wallet associated with the API key.

No URL or body parameters required.

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>"
POST/api/v2/tradeTRADE
Rate Limit: 100 req / 15 min

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

tokenstring (body)required
Target asset symbol: "BTCP", "ETHP", or "SOLP"
sidestring (body)required
Order direction: "BUY" or "SELL"
amountstring (body)required
Positive token amount string (e.g. "0.1")

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 StatusError CodeDescription
401 UnauthorizedAPI_KEY_INVALIDMissing or malformed Authorization header. Expected format pdx_id_<id>:<secret>
401 UnauthorizedAPI_KEY_NOT_FOUNDThe provided API key ID does not exist in the database.
401 UnauthorizedAPI_KEY_EXPIREDThe API key has passed its configured expiration date.
401 UnauthorizedAPI_KEY_REVOKEDThe key owner manually revoked this API key.
403 ForbiddenAPI_KEY_SCOPE_DENIEDThe endpoint requires TRADE scope, but the provided key only has READ_ONLY scope.
429 Too Many RequestsRATE_LIMIT_EXCEEDEDExceeded the rate limit window (300 req/15m for read, 100 req/15m for trade).
400 Bad RequestINSUFFICIENT_BALANCEUser does not possess sufficient USDTP (for buy) or token (for sell).
400 Bad RequestLIQUIDITY_UNAVAILABLEThe PaperDEX vault does not currently hold enough inventory to fill the order.
>_CLI TerminalCtrl+`
PS|
Session 1
Windows PowerShell Copyright (C) PaperDEX Foundation. All rights reserved. PaperDEX Developer CLI Sandbox v2.0 Type "help" for available commands, or "examples" for instant curl templates.
PS PaperDEX:\api\v2>