|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Loading prices...
API Reference
User Data API
Access user-specific data including balances, positions, orders, and trade history.
All user data endpoints require valid Polymarket API credentials. See the Authentication section.
Available Endpoints
GET
Portfolio balance/api/user/balanceGET
Open positions/api/user/positionsGET
Active orders/api/user/ordersGET
Trade history/api/user/tradesGET
Full history/api/user/historyGet Balance
Retrieve the user's portfolio and cash balances:
curl "http://localhost:3000/api/user/balance?address=0xYourAddress"Response
{
"portfolioValue": 1250.50,
"cashBalance": 500.00,
"totalValue": 1750.50
}Get Positions
Retrieve all open positions for a user:
curl "http://localhost:3000/api/user/positions?address=0xYourAddress"Response
{
"positions": [
{
"marketId": "...",
"outcome": "YES",
"size": 100,
"avgPrice": 0.45,
"currentPrice": 0.65,
"unrealizedPnl": 20.00
}
]
}Get Orders
Retrieve all active (unfilled) orders:
curl "http://localhost:3000/api/user/orders?address=0xYourAddress&credentials=ENCODED_CREDENTIALS"Response
{
"orders": [
{
"orderId": "...",
"marketId": "...",
"side": "BUY",
"outcome": "YES",
"price": 0.60,
"size": 50,
"filledSize": 0,
"status": "OPEN",
"createdAt": "2024-01-15T10:30:00Z"
}
]
}Pass API credentials as a URL-encoded JSON object in the
credentials query parameter.