Create a Market
POST /markets
– Create a new prediction market.
Request: Send a JSON object with the market details. You must specify the question, the token address of the asset or coin the market is about, the outcome options (usually fixed to ["Yes","No"] for binary markets), the expiration time, and the currency denomination for bets.
POST /markets
Content-Type: application/json
{
"question": "Will Token X reach a market cap of 1,000,000 USD by 2025-12-31?",
"tokenAddress": "7GHsz...EByX" , /* Solana token address for Token X */
"outcomes": ["Yes", "No"],
"expireAt": "2025-12-31T00:00:00Z",
"currency": "POLYPUMP"
}
Response: If successful, returns a JSON object with the created market’s details, including a unique market
id
and initial state. Thestatus
will be "open" (active for betting). Theodds
for each outcome start at 0.5 (50%) if no initial stake, or may reflect the creator’s initial stake if provided (in this example, the creator did not favor either side, so initial odds are equal). ThefeePercentage
fields show the fee rates for burn and rewards.
{
"id": "market_8a9f5b2c",
"question": "Will Token X reach a market cap of 1,000,000 USD by 2025-12-31?",
"tokenAddress": "7GHsz...EByX",
"outcomes": [
{ "name": "Yes", "odds": 0.5, "totalStake": 0 },
{ "name": "No", "odds": 0.5, "totalStake": 0 }
],
"currency": "POLYPUMP",
"expireAt": "2025-12-31T00:00:00Z",
"status": "open",
"createdAt": "2025-09-10T13:45:30Z",
"creator": "Fx1...abc", /* wallet address of creator */
"feePercentage": {
"burn": 0.05,
"developer": 0.05
}
}
In this response:
id
is the unique identifier for the market (used for querying or betting).outcomes
lists the possible outcomes with current odds (0.5 means 50% – these will change once people bet).totalStake
is how much has been staked on each side so far (initially 0 or some amount if creator provided an initial stake).currency
indicates this market is using $POLYPUMP tokens for bets.expireAt
is the cutoff time for the event.feePercentage
shows the fee rates for burning and dev reward (in this case 5% each, meaning 10% total is taken from the losing side at resolution).
Error cases: If required fields are missing or invalid (e.g. tokenAddress not a valid Solana address, or expireAt is a past time), the API returns an error response, for example:
{
"error": "Invalid token address"
}
(HTTP 400 Bad Request).
List Markets / View Market
GET /markets
– Retrieve a list of active markets (and possibly recently closed ones).
Request: No body needed. You can filter or paginate via query parameters (for example,
GET /markets?status=open
to get only open markets, or?limit=20&offset=0
for pagination).Response: An array of market summary objects. For brevity, assume we get two markets:
[
{
"id": "market_8a9f5b2c",
"question": "Will Token X reach a market cap of 1,000,000 USD by 2025-12-31?",
"tokenAddress": "7GHsz...EByX",
"currency": "POLYPUMP",
"status": "open",
"expireAt": "2025-12-31T00:00:00Z",
"odds": { "Yes": 0.5, "No": 0.5 }
},
{
"id": "market_b7c3d1e0",
"question": "Will more than 500 tokens migrate on pump.fun by end of today?",
"tokenAddress": null,
"currency": "SOL",
"status": "open",
"expireAt": "2025-09-10T23:59:00Z",
"odds": { "Yes": 0.75, "No": 0.25 }
}
]
Each entry provides a snapshot: id
, the question text, which token it’s about (if applicable; in the second example the condition is a global event, so tokenAddress
might be null or a special indicator), the currency used for bets, current status (open or resolved), expiration, and the current odds for quick insight.
GET /markets/{id}
– Retrieve detailed info for a specific market.
Request: Provide the market ID in the URL path.
Response: A detailed market object, similar to the creation response but updated with current data. For example, for
market_b7c3d1e0
above:
{
"id": "market_b7c3d1e0",
"question": "Will more than 500 tokens migrate on pump.fun by end of today?",
"tokenAddress": null,
"details": "This market tracks the number of new token migrations on pump.fun on 2025-09-10.",
"currency": "SOL",
"status": "open",
"createdAt": "2025-09-10T00:00:00Z",
"expireAt": "2025-09-10T23:59:00Z",
"creator": "8PJ...efe",
"outcomes": [
{ "name": "Yes", "odds": 0.75, "totalStake": 150.0 },
{ "name": "No", "odds": 0.25, "totalStake": 50.0 }
],
"totalVolume": 200.0,
"feePercentage": { "burn": 0.05, "developer": 0.05 }
}
This shows that currently 150 SOL is staked on "Yes" and 50 SOL on "No", hence the odds 0.75 vs 0.25 (implying Yes is favored). totalVolume
is the sum of all stakes. The details
field (optional) can provide a human-readable description of the condition.
Once the market is resolved, the same endpoint will return updated information:
status
will change to"resolved"
.An additional field like
"result"
or"winningOutcome"
will indicate which side won.Payout info might be summarized (e.g. how much was paid out to winners).
For example, after resolution the above market might look like:
{
"id": "market_b7c3d1e0",
"question": "Will more than 500 tokens migrate on pump.fun by end of today?",
"tokenAddress": null,
"currency": "SOL",
"status": "resolved",
"expireAt": "2025-09-10T23:59:00Z",
"resolvedAt": "2025-09-11T00:10:00Z",
"winningOutcome": "Yes",
"outcomes": [
{ "name": "Yes", "totalStake": 150.0 },
{ "name": "No", "totalStake": 50.0 }
],
"payoutRatio": { "Yes": 1.3333, "No": 0 },
"feesCollected": { "burned": "9.5 POLYPUMP", "developer": "9.5 POLYPUMP" }
}
Here, winningOutcome
is "Yes". The payoutRatio
for Yes indicates each 1 SOL bet on Yes yields ~1.3333 SOL back (which matches splitting 50 SOL losers among 150 SOL winners after fees). feesCollected
shows how the 10% fee (20 SOL from the 200 SOL total pool) was handled: in this hypothetical case, 20 SOL was converted to 19 $POLYPUMP (split equally for burning and dev rewards). The specifics of fee conversion might vary, but the API reports what was burned and sent to dev. (Note: actual implementation might show fees in SOL or in USD value, but we show $POLYPUMP here to illustrate the burn.)
Checking Conditions: There isn’t usually a separate public endpoint solely for “checking” a market’s condition, since resolution is automatic. However, developers might use the data from a market to monitor progress. For instance, the details
or a separate field could include the threshold and current value if the market is still open. In our example, one could imagine an endpoint or field:
"conditionProgress": { "currentCount": 420, "target": 500, "unit": "migrations" }
This would indicate, while the market is live, that currently 420 migrations have happened today out of the 500 needed. Such information could also be derived by the developer manually via other data sources. Typically, the Polypump API focuses on market state; actual real-time metrics may come from external APIs (pump.fun’s core API for token stats).
In summary, to check the outcome condition, one normally waits for the market to resolve and then reads winningOutcome
. If developers want to proactively check how close an event is, they would query pump.fun or blockchain data directly (outside the Polypump API scope), or Polypump could expose a convenience endpoint for certain metrics in future.
Last updated