> ## Documentation Index
> Fetch the complete documentation index at: https://docs.predictiondata.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Finding Available Files

> List and download Polymarket exports by slug or asset ID

You can query available files by market slug, event slug, or asset ID. These endpoints return metadata about available data files that you can then download from the datasets API.

**Note:** The event slug is what you see in your address bar when you view a Polymarket market. Fetching the exports by event slug is easiest, as it will show all of the market slugs for that event.

## Authentication

For listing exports (API), no key is required. For **downloading** files from the datasets endpoint, pass your API key as the `apikey` query parameter. Get an API key from [calder@predictiondata.dev](mailto:calder@predictiondata.dev).

## Base URL

All endpoints use the base URL: `https://api.predictiondata.dev`

## Endpoints

### By Market Slug

Returns all exports for a given market.

```bash theme={null}
GET /v1/exports/{exchange}/markets/{slug}
```

**Example:**

```bash theme={null}
curl "https://api.predictiondata.dev/v1/exports/polymarket/markets/will-the-seattle-seahawks-win-super-bowl-2026"
```

### By Market Slug and Side

Returns exports for a specific side (YES or NO) of a market.

```bash theme={null}
GET /v1/exports/{exchange}/markets/{slug}/{side}
```

**Parameters:**

* `side`: Either `YES` or `NO` (case-insensitive)

**Example:**

```bash theme={null}
curl "https://api.predictiondata.dev/v1/exports/polymarket/markets/will-the-seattle-seahawks-win-super-bowl-2026/YES"
```

### By Event Slug

Returns all exports for all markets within an event.

```bash theme={null}
GET /v1/exports/{exchange}/events/{slug}
```

**Example:**

```bash theme={null}
curl "https://api.predictiondata.dev/v1/exports/polymarket/events/super-bowl-champion-2026-731"
```

### By Asset ID

Returns all exports for a specific asset ID.

```bash theme={null}
GET /v1/exports/{exchange}/assets/{assetId}
```

**Example:**

```bash theme={null}
curl "https://api.predictiondata.dev/v1/exports/polymarket/assets/91737931954079461205792748723730956466398437395923414328893692961489566016241"
```

## Response Format

All endpoints return data grouped by export type:

```json theme={null}
{
  "count": 872,
  "exports": {
    "books": [
      {
        "event_slug": "super-bowl-champion-2026-731",
        "market_slug": "will-the-seattle-seahawks-win-super-bowl-2026",
        "asset_id": "91737931954079461205792748723730956466398437395923414328893692961489566016241",
        "is_yes_contract": true,
        "date": "2026-02-09T00:00:00Z",
        "export_type": "books",
        "exchange": "polymarket",
        "filename": "2026-2-9.csv.gz"
      }
    ],
    "trades": [...],
    "onchain": [...]
  }
}
```

## Export Types

* **books**: Order book snapshots (tick-level reconstructions)
* **trades**: Trade messages from websockets
* **onchain**: Onchain fill data from smart contracts

## Using the Results

Once you have the export metadata from the API response, you can download the data files using the asset ID and date.

### Download by Asset ID

```bash theme={null}
curl -G "https://datasets.predictiondata.dev/polymarket/{export_type}/{asset_id}/{date}.csv.gz" \
  --data-urlencode "apikey=YOUR_API_KEY"
```

**Example:**

```bash theme={null}
curl -G "https://datasets.predictiondata.dev/polymarket/books/91737931954079461205792748723730956466398437395923414328893692961489566016241/2026-2-9.csv.gz" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  --output orderbook_2026-2-9.csv.gz
```

### Download by Market Slug + Outcome

Alternatively, use market slug and outcome (YES/NO) instead of looking up the asset ID:

```bash theme={null}
curl -G "https://datasets.predictiondata.dev/polymarket/{export_type}/{market_slug}/{outcome}/{date}.csv.gz" \
  --data-urlencode "slug=true" \
  --data-urlencode "apikey=YOUR_API_KEY"
```

**Example:**

```bash theme={null}
curl -G "https://datasets.predictiondata.dev/polymarket/books/will-the-seattle-seahawks-win-super-bowl-2026/YES/2026-2-9.csv.gz" \
  --data-urlencode "slug=true" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  --output orderbook_2026-2-9.csv.gz
```

Replace:

* `{export_type}`: `books`, `trades`, or **`onchain/fills`** (onchain data uses the path segment `onchain/fills`, not `onchain`)
* `{asset_id}`: The asset ID from the API response
* `{market_slug}`: The market slug
* `{outcome}`: Either `YES` or `NO`
* `{date}`: Date in `YYYY-MM-DD` format (note: day may be single digit, e.g., `2025-11-8` instead of `2025-11-08`)

**Onchain example:** `https://datasets.predictiondata.dev/polymarket/onchain/fills/{asset_id}/{date}.csv.gz?apikey=...` — see [Onchain Fills](/datasets/polymarket/onchain-fills) for slug-based URLs.
