import pmxt
# API key optional — enables faster catalog-backed lookups
exchange = pmxt.Polymarket(
pmxt_api_key="YOUR_PMXT_API_KEY",
)
result = exchange.fetch_market(market_id="12345"){
"success": true,
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
},
"data": {
"marketId": "<string>",
"title": "<string>",
"description": "<string>",
"outcomes": [
{
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
}
],
"volume24h": 123,
"liquidity": 123,
"url": "<string>",
"eventId": "<string>",
"slug": "<string>",
"resolutionDate": "2023-11-07T05:31:56Z",
"volume": 123,
"openInterest": 123,
"image": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"tickSize": 123,
"status": "<string>",
"contractAddress": "<string>",
"sourceMetadata": {},
"sourceExchange": "<string>",
"yes": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
},
"no": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
},
"up": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
},
"down": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
}
}
}Fetch Market
Fetch a single market by lookup parameters. Convenience wrapper around fetchMarkets() that returns a single result or throws MarketNotFound.
import pmxt
# API key optional — enables faster catalog-backed lookups
exchange = pmxt.Polymarket(
pmxt_api_key="YOUR_PMXT_API_KEY",
)
result = exchange.fetch_market(market_id="12345"){
"success": true,
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
},
"data": {
"marketId": "<string>",
"title": "<string>",
"description": "<string>",
"outcomes": [
{
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
}
],
"volume24h": 123,
"liquidity": 123,
"url": "<string>",
"eventId": "<string>",
"slug": "<string>",
"resolutionDate": "2023-11-07T05:31:56Z",
"volume": 123,
"openInterest": 123,
"image": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"tickSize": 123,
"status": "<string>",
"contractAddress": "<string>",
"sourceMetadata": {},
"sourceExchange": "<string>",
"yes": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
},
"no": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
},
"up": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
},
"down": {
"outcomeId": "<string>",
"label": "<string>",
"price": 123,
"marketId": "<string>",
"priceChange24h": 123,
"metadata": {}
}
}
}Use cases
Look up by slug
Slugs are stable, human-readable identifiers that make your code self-documenting and resilient to ID changes. Use them whenever possible.import pmxt
# Optional: pass pmxt_api_key for ~100x faster catalog-backed lookups
api = pmxt.Polymarket()
market = api.fetch_market(slug="will-gavin-newsom-win-the-2028-us-presidential-election")
print(market.title, market.status)
import { Polymarket } from "pmxtjs";
// Optional: pass pmxtApiKey for ~100x faster catalog-backed lookups
const api = new Polymarket();
const market = await api.fetchMarket({ slug: "will-gavin-newsom-win-the-2028-us-presidential-election" });
console.log(market.title, market.status);
curl "https://api.pmxt.dev/api/polymarket/fetchMarket?slug=will-gavin-newsom-win-the-2028-us-presidential-election" \
-H "Authorization: Bearer $PMXT_API_KEY"
Look up by market ID
When you already have a venue-native market ID (e.g. from a trade confirmation or webhook), pass it directly:import pmxt
api = pmxt.Polymarket()
market = api.fetch_market(market_id="46ac6f9c-c66a-48a5-8f12-beefd6e06221")
print(market.title, market.volume)
import { Polymarket } from "pmxtjs";
const api = new Polymarket();
const market = await api.fetchMarket({ marketId: "46ac6f9c-c66a-48a5-8f12-beefd6e06221" });
console.log(market.title, market.volume);
curl "https://api.pmxt.dev/api/polymarket/fetchMarket?marketId=46ac6f9c-c66a-48a5-8f12-beefd6e06221" \
-H "Authorization: Bearer $PMXT_API_KEY"
Read outcomes and prices
Every market carries anoutcomes array and, for binary markets, yes / no convenience accessors with live prices:
import pmxt
api = pmxt.Polymarket()
market = api.fetch_market(slug="will-gavin-newsom-win-the-2028-us-presidential-election")
# Binary shorthand
print(f"Yes {market.yes.price} No {market.no.price}")
# Full outcomes list (works for multi-outcome markets too)
for outcome in market.outcomes:
print(f" {outcome.label}: {outcome.price}")
import { Polymarket } from "pmxtjs";
const api = new Polymarket();
const market = await api.fetchMarket({ slug: "will-gavin-newsom-win-the-2028-us-presidential-election" });
// Binary shorthand
console.log(`Yes ${market.yes.price} No ${market.no.price}`);
// Full outcomes list (works for multi-outcome markets too)
market.outcomes.forEach((o) => console.log(` ${o.label}: ${o.price}`));
curl "https://api.pmxt.dev/api/polymarket/fetchMarket?slug=will-gavin-newsom-win-the-2028-us-presidential-election" \
-H "Authorization: Bearer $PMXT_API_KEY"
Path Parameters
The prediction market exchange to target.
polymarket, kalshi, kalshi-demo, limitless, probable, baozi, myriad, opinion, metaculus, smarkets, polymarket_us, gemini-titan, hyperliquid, suibets, rain, hunch, router Query Parameters
Maximum number of results to return
Pagination offset — number of results to skip
Sort order for results
volume, liquidity, newest Filter by market status (default: 'active', 'inactive' and 'closed' are interchangeable)
active, inactive, closed, all Where to search (default: 'title')
title, description, both For keyword search
For slug/ticker lookup
Direct lookup by market ID
Reverse lookup -- find market containing this outcome
Find markets belonging to an event
For pagination (used by Limitless)
For semantic search (used by Limitless)
Filter by source venue (e.g. 'polymarket', 'kalshi', 'myriad'). exchange is an alias.
Alias for sourceExchange.
Response
Fetch Market response
true
Structured error envelope returned inside BaseResponse.error and ErrorResponse.error. Hosted-mode endpoints populate code, retryable, and optionally exchange / detail; legacy local-mode endpoints may still return only message.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?

