# Polymarket Market API - Odds, Volume & Liquidity (`stas_k/polymarket-market-api`) Actor

A market that looks like the one you meant can be a different question with different odds, and a wrong number costs money. This actor reads Polymarket by link, condition id or slug: outcomes, odds, volume, liquidity and end date, one row per market.

- **URL**: https://apify.com/stas_k/polymarket-market-api.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** Developer tools, Automation, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.90 / 1,000 markets

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Polymarket Market API

Prediction markets are quoted in probabilities, and a market that merely looks like the
one you meant carries different odds. This actor reads Polymarket markets by identity the
source itself confirms: an event link, a market link, a condition id or a market slug.

One delivered market is one paid row. A row carries the question, the outcomes and their
prices (0 to 1), last trade, best bid and ask, the spread, volume, 24h volume, liquidity,
the one day price change, the end date and a link to the market page.

### What you send

`events` is a list of identities. Each line can be:

- an event link, for example `https://polymarket.com/event/next-ceo-of-nvidia`. An event
  carries many markets (the biggest ones carry more than a hundred), and every market
  inside it is delivered as its own row;
- a market link, for example
  `https://polymarket.com/market/will-donald-trump-win-the-2028-republican-presidential-nomination`;
- a condition id, that is `0x` followed by 64 hex characters;
- a market slug, for example `will-the-arizona-cardinals-win-the-2027-nfl-league-championship`.

Identity is exact on purpose. A near name is not guessed: odds are a number you act on,
and a different market with a right-looking price is worse than a refusal. A line that
looks like an id but is not a full condition id comes back free with that reason.

An event link, a market link and a condition id of the same market are one market. The run
keys the dedupe on the condition id the source answered with, not on the line you sent, so
the same market is charged once per run.

### What costs money

One delivered market is one paid event, price `$0.0009`. The Store prints it as
`$0.90 / 1,000 markets`.

Free, with a reason in the row and no market data:

- `NOT_FOUND`: the source carries no event and no market under that identity.
- `NO_PRICE`: the market exists but carries no odds yet, so the row would have nothing to
  act on.
- `DUPLICATE`: the same market arrived again in this run under another shape (an event
  link, a market link, a condition id), so it is not charged twice.
- `INVALID_INPUT`: the line is not a Polymarket identity (an empty line, a foreign host, a
  truncated id).
- `NOT_CHECKED_CAP`: the line was cut by `maxEvents`, or the event carries more markets
  than `maxMarketsPerEvent`. The row names the real count, so a cut is never silent.
- `NOT_CHECKED_ERROR`: the source could not be read. This is not a verdict about the
  market and it is not charged.
- `NOT_CHECKED_BILLING`: the price list could not say how many rows fit the remaining
  budget, so nothing is delivered and nothing is charged.
- `NOT_CHECKED_TIME`: the run ran out of time before that line.

### Limits

- `maxMarketsPerEvent`: how many markets of one event this run delivers. Default 50,
  maximum 200. When an event carries more, a free `NOT_CHECKED_CAP` row names the real
  count.
- `maxEvents`: how many lines this run reads. Default and maximum 50.
- The spending cap you set on the run is respected before every write: a batch is cut by
  the remaining budget, and the rows past it come back free with their own reason.

### Rate limit

The source is keyless and fast: ten pages of twenty markets take about a second. The
reader sends one request per identity (two when a bare slug has to be looked up as an event
and then as a market) and pauses once for a few seconds if the source answers HTTP 429. A
second 429 on the same request is reported as a throttle, never as "the market does not
exist".

### What this actor does not do

- It does not guess a market by a near name. Pass a link, a condition id or the exact slug.
- It does not read the order book, the trade history or the holders. The public source
  publishes the odds and the totals listed above, and those are what a row carries.
- It does not trade, sign or place anything.
- It does not invent a number. A field the source does not publish is `null`, never `0`.

### Output

One row per market. Status rows carry `actorInput`, `actorIndex`, `status`, `reason` and
`billable: false`, and never carry market data. The run summary lives in the run key value
store under `RUN_SUMMARY`, with a copy under `RUN_SUMMARY-<runId>` in the named store
`polymarket-summary`, so two runs do not overwrite each other.

# Actor input Schema

## `events` (type: `array`):

Polymarket identities: an event link such as https://polymarket.com/event/next-ceo-of-nvidia (it delivers every market inside the event), a market link, a condition id (0x plus 64 hex characters) or a market slug. Identity is exact on purpose: a near name is not guessed, because odds are a number you act on. An event link, a market link and a condition id of the same market are one market and are charged once. The last line of the default list does not exist, so it comes back free.

## `maxMarketsPerEvent` (type: `integer`):

How many markets of one event this run delivers. Default 50, maximum 200. When an event carries more, the dataset gets a free NOT_CHECKED_CAP row that names the real count, so a cut is never silent.

## `maxEvents` (type: `integer`):

How many lines of the list this run reads. Default and maximum 50; a line past the cap comes back as a free NOT_CHECKED_CAP row that names the cap.

## Actor input object example

```json
{
  "events": [
    "https://polymarket.com/event/jensen-huang-rejoins-nvidia-byptptpt",
    "will-the-arizona-cardinals-win-the-2027-nfl-league-championship",
    "0x7f47df08bd8b390e2d566761feead7cb20507e8e2ac37f7664f7e3a9d12b7f33",
    "no-such-market-xyz-123"
  ],
  "maxMarketsPerEvent": 50,
  "maxEvents": 50
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per prediction market. A paid row carries question, marketSlug, conditionId, eventTitle, eventSlug, outcomes, outcomePrices (the same order as outcomes, 0 to 1), lastTradePrice, bestBid, bestAsk, spread, volumeUsd, volume24hrUsd, liquidityUsd, oneDayPriceChange, endDate, closed, active, url and fetchedAt. Every row carries billable (true on a paid row, false on a free status row). A status row carries status (OK, DUPLICATE, NOT_FOUND, NO_PRICE, INVALID_INPUT, NOT_CHECKED_CAP, NOT_CHECKED_ERROR, NOT_CHECKED_BILLING, NOT_CHECKED_TIME) and note with the plain reason, plus actorInput and actorIndex, and never carries market data. A market that carries no odds is never a paid row. A number the source does not publish is null, never 0. Status rows are written in batches, so sort by actorIndex to get the input order back.

## `summary` (type: `string`):

Counters of the run: requested, attempted, delivered, chargedEvents, deliveredUncharged, deliveredUnverified, chargeUncertain, writeErrors, cappedNotCharged, marketsNotFound, marketsWithoutPrice, marketsInvalid, marketsDuplicate, marketsCutByLimit, cutByDeadline, cutByStop, cutByLimit, byStatus, counterMismatch, stopReason, datasetNote, firstFailure, billingActive, priceNote, eventName, maxMarketsPerEvent, maxEvents, source, startedAt, finishedAt and runId. The bare RUN_SUMMARY lives in the default store of the run; a copy under RUN_SUMMARY-<runId> is kept in the named store polymarket-summary, so two runs do not overwrite each other.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "events": [
        "https://polymarket.com/event/jensen-huang-rejoins-nvidia-byptptpt",
        "will-the-arizona-cardinals-win-the-2027-nfl-league-championship",
        "0x7f47df08bd8b390e2d566761feead7cb20507e8e2ac37f7664f7e3a9d12b7f33",
        "no-such-market-xyz-123"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/polymarket-market-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "events": [
        "https://polymarket.com/event/jensen-huang-rejoins-nvidia-byptptpt",
        "will-the-arizona-cardinals-win-the-2027-nfl-league-championship",
        "0x7f47df08bd8b390e2d566761feead7cb20507e8e2ac37f7664f7e3a9d12b7f33",
        "no-such-market-xyz-123",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/polymarket-market-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "events": [
    "https://polymarket.com/event/jensen-huang-rejoins-nvidia-byptptpt",
    "will-the-arizona-cardinals-win-the-2027-nfl-league-championship",
    "0x7f47df08bd8b390e2d566761feead7cb20507e8e2ac37f7664f7e3a9d12b7f33",
    "no-such-market-xyz-123"
  ]
}' |
apify call stas_k/polymarket-market-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stas_k/polymarket-market-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/zidHO0Il54oTacBKy/builds/uU64nkVtEdFMN1KZL/openapi.json
