Documentation Index Fetch the complete documentation index at: https://dev.jup.ag/docs/llms.txt
Use this file to discover all available pages before exploring further.
BETA The Prediction Market API is currently in beta and subject to breaking changes as we continue to improve the product. If you have any feedback, please reach out in Discord .
This doc covers the data endpoints for querying positions, orders, and transaction history. Use these endpoints to build dashboards, track P&L, and maintain audit trails.
Prerequisite
To query position data, you need:
Querying Positions
Use GET /positions to retrieve position data with comprehensive P&L information.
Parameter Type Description ownerPubkeystring Wallet public key (required) marketPubkeystring Filter by market account pubkey marketIdstring Filter by market ID isYesboolean Filter by position side startnumber Pagination start index endnumber Pagination end index
List endpoints (/positions, /orders, /history) return a pagination object alongside data:
Field Type Description startinteger Start index of the current page endinteger End index of the current page totalinteger Total number of results available hasNextboolean true if more results exist beyond the current page
Position Fields
Each position includes identity, state, and P&L fields. All USD values are in micro USD (1,000,000 = $1.00).
Identity and State
Field Type Description pubkeystring Position account public key ownerPubkeystring Position owner wallet public key marketIdstring External market identifier isYesboolean true if this is a YES position, false for NOcontractsstring Number of contracts held (u64 as string) openOrdersinteger Number of currently open orders for this position claimableboolean true when the position qualifies for payout claimclaimedboolean Whether payout has already been claimed claimedUsdstring Amount claimed in micro USD openedAtinteger Unix timestamp (seconds) when the position was opened updatedAtinteger Unix timestamp (seconds) of the last position update claimableAtinteger, nullable Unix timestamp (seconds) when position becomes claimable settlementDateinteger, nullable Unix timestamp (seconds) when the market settles
Pricing and P&L
Field Type Description totalCostUsdstring Total cost basis in micro USD sizeUsdstring Alias of totalCostUsd in micro USD avgPriceUsdstring Average entry price per contract in micro USD markPriceUsdstring, nullable Current mark price per contract in micro USD; null when market is closed sellPriceUsdstring, nullable Current best exit price for this side in micro USD; null when unavailable valueUsdstring, nullable Current mark-to-market value in micro USD; null when market is closed payoutUsdstring Notional payout if position wins (contracts x $1) pnlUsdstring, nullable Unrealized P&L in micro USD; null when market is closed pnlUsdPercentnumber, nullable Unrealized P&L as percentage of cost basis pnlUsdAfterFeesstring, nullable Unrealized P&L after estimated fees in micro USD pnlUsdAfterFeesPercentnumber, nullable Unrealized P&L after fees as percentage of cost basis realizedPnlUsdnumber Realized P&L from closed portions in micro USD feesPaidUsdstring Total fees paid in micro USD
Field Type Description eventMetadataobject Parent event metadata: eventId, title, subtitle, imageUrl, isLive, isActive, category, subcategory, beginAt, closeCondition marketMetadataobject Market metadata: marketId, eventId, title, subtitle, description, status, result, openTime, closeTime
Get All Positions
const response = await fetch (
'https://api.jup.ag/prediction/v1/positions?' + new URLSearchParams ({
ownerPubkey: wallet . publicKey . toString ()
}),
{
headers: {
'x-api-key' : 'your-api-key'
}
}
);
const positions = await response . json ();
Aggregating Portfolio P&L
const positions = await fetch (
'https://api.jup.ag/prediction/v1/positions?' + new URLSearchParams ({
ownerPubkey: wallet . publicKey . toString ()
}),
{
headers: { 'x-api-key' : 'your-api-key' }
}
). then ( r => r . json ());
// Calculate totals
let totalValue = 0 ;
let totalCost = 0 ;
let totalPnl = 0 ;
for ( const position of positions . data ) {
totalValue += parseInt ( position . valueUsd ) || 0 ;
totalCost += parseInt ( position . totalCostUsd ) || 0 ;
totalPnl += parseInt ( position . pnlUsd ) || 0 ;
}
console . log ( 'Portfolio Summary:' );
console . log ( `Total Value: $ ${ ( totalValue / 1_000_000 ). toFixed ( 2 ) } ` );
console . log ( `Total Cost: $ ${ ( totalCost / 1_000_000 ). toFixed ( 2 ) } ` );
console . log ( `Total P&L: $ ${ ( totalPnl / 1_000_000 ). toFixed ( 2 ) } ` );
Get a Specific Position
const positionPubkey = 'position-pubkey-789' ;
const response = await fetch (
`https://api.jup.ag/prediction/v1/positions/ ${ positionPubkey } ` ,
{
headers: {
'x-api-key' : 'your-api-key'
}
}
);
const position = await response . json ();
Querying Orders
Use GET /orders to retrieve order history and fill details.
Parameter Type Description ownerPubkeystring Wallet public key startnumber Pagination start (or timestamp) endnumber Pagination end (or timestamp)
Order Fill Details
Field Description statuspending, filled, or failedfilledContractsNumber of contracts executed avgFillPriceUsdAverage execution price totalCostUsdTotal cost of filled portion feesPaidUsdFees charged createdAtUnix timestamp of order creation filledAtUnix timestamp of fill completion
Get All Orders
const response = await fetch (
'https://api.jup.ag/prediction/v1/orders?' + new URLSearchParams ({
ownerPubkey: wallet . publicKey . toString ()
}),
{
headers: {
'x-api-key' : 'your-api-key'
}
}
);
const orders = await response . json ();
Get Order Status
Use GET /orders/status/{orderPubkey} for detailed status and event history.
const orderPubkey = 'order-pubkey-123' ;
const response = await fetch (
`https://api.jup.ag/prediction/v1/orders/status/ ${ orderPubkey } ` ,
{
headers: {
'x-api-key' : 'your-api-key'
}
}
);
const status = await response . json ();
Transaction History
Use GET /history to retrieve a complete audit trail of all prediction market activity.
Parameter Type Description ownerPubkeystring Wallet public key positionPubkeystring Filter by specific position startnumber Start timestamp or index endnumber End timestamp or index idstring Filter by specific event ID
Event Types
Event Type Description order_createdNew order placed on-chain order_filledOrder matched and executed order_failedOrder could not be filled position_updatedPosition modified by order fill position_lostMarket resolved against position payout_claimedWinnings withdrawn
History Event Fields
Each history event includes these fields. All USD values are in micro USD (1,000,000 = $1.00).
Field Type Description idinteger Unique history event identifier eventTypestring Event type (see table above) signaturestring Solana transaction signature slotstring Solana slot number timestampinteger Unix timestamp (seconds) when the event occurred orderPubkeystring Associated order account public key positionPubkeystring Associated position account public key marketIdstring External market identifier ownerPubkeystring Position or order owner public key keeperPubkeystring Keeper that processed the transaction externalOrderIdstring Client-provided order identifier orderIdstring External order identifier from the venue isBuyboolean true when the event relates to a buy orderisYesboolean true when the event relates to the YES sidecontractsstring Number of contracts in the order filledContractsstring Number of contracts filled contractsSettledstring Number of contracts settled in this event avgFillPriceUsdstring Average fill price in micro USD maxFillPriceUsdstring Maximum fill price in micro USD maxBuyPriceUsdstring, nullable Buyer-specified max fill price in micro USD minSellPriceUsdstring, nullable Seller-specified min fill price in micro USD depositAmountUsdstring Amount deposited for this order in micro USD totalCostUsdstring Total cost of the order in micro USD feeUsdstring, nullable Fee charged for this event in micro USD grossProceedsUsdstring Gross proceeds before fees in micro USD netProceedsUsdstring Net proceeds after fees in micro USD transferAmountTokenstring, nullable Token amount transferred (native token units) realizedPnlstring, nullable Realized P&L in micro USD realizedPnlBeforeFeesstring, nullable Realized P&L before fees in micro USD payoutAmountUsdstring Payout amount in micro USD (populated for payout_claimed events) eventIdstring External event identifier marketMetadataobject Metadata for the associated market eventMetadataobject Metadata for the parent event
Get Transaction History
const response = await fetch (
'https://api.jup.ag/prediction/v1/history?' + new URLSearchParams ({
ownerPubkey: wallet . publicKey . toString ()
}),
{
headers: {
'x-api-key' : 'your-api-key'
}
}
);
const history = await response . json ();
What’s Next
Explore social features to view profiles, follow traders, and track leaderboards.
Social Features Profiles, leaderboards, and trade feeds