---
title: "Get Prediction Market PnL by Market"
method: POST
path: "/api/v1/prediction-market/pnl-by-market"
tags: ["Prediction Markets"]
---

# Get Prediction Market PnL by Market

`POST /api/v1/prediction-market/pnl-by-market`

## Request

- Base URL: `https://api.nansen.ai`
- URL: `https://api.nansen.ai/api/v1/prediction-market/pnl-by-market`
- Auth: API key in header `apiKey`
- TypeScript: <https://skmtc.dev/nansen/apis/nansen-api/docs/api/v1/prediction-market/pnl-by-market/post.ts> (a function with typed inputs; its response is checked against the schema)

Get profit and loss breakdown for all traders in a specific prediction market.
Includes buy cost, sell proceeds, redemption values, and unrealized positions.

**What it helps to answer:**

1. **Who are the biggest winners and losers in this market?**
2. **What is the PnL distribution across traders?**
3. **How much unrealized value exists in open positions?**

## Request body

- PnlByMarketRequest: Request for PnL by market endpoint.
  - `market_id` string, required: Polymarket market ID
  - `pagination` PaginationRequest: Pagination parameters for API requests.
    - `page` integer: Page number (1-based)
    - `per_page` integer: Number of records per page (max 1000)
  - `order_by` SortOrderPnlByMarketSortField[]: Sort order
    - `field` 'total_pnl_usd', required: Sortable fields for PnL by market endpoint.
    - `direction` 'ASC' | 'DESC', required: Enum for sort directions.

## Response `200`

PnL by market data

- PnlByMarketResponse: Response for PnL by market endpoint.
  - `pagination` PaginationInfo: Pagination information for API responses.
    - `page` integer: Current page number
    - `per_page` integer: Number of records per page
    - `is_last_page` boolean: Whether this is the last page
  - `data` PnlByMarketItem[], required: List of PnL by market records
    - `address` string: Trader address (hex)
    - `owner_address` string: SAFE proxy owner address (hex)
    - `side_held` string: Side held: Yes, No, or Both. Reflects last known position even if fully exited (unrealized_value_usd = 0). Null only if no buy activity on record.
    - `net_buy_cost_usd` number: Net buy cost in USD
    - `net_sell_proceeds_usd` number: Net sell proceeds in USD
    - `redemption_value_usd` number: Redemption value in USD
    - `unrealized_value_usd` number: Unrealized value in USD
    - `total_pnl_usd` number: Total PnL in USD
    - `question` string: Market question
    - `event_id` string: Parent event ID
    - `event_title` string: Parent event title
    - `market_resolved` boolean: Whether market is resolved
    - `market_id` string, required: Market ID

## Other responses

- `400`: Bad Request - Invalid request parameters or malformed request
- `401`: Authentication error - No API key found in request
- `402`: Payment Required - This endpoint supports pay-per-request via x402 and MPP. x402 responses advertise payment options in `Payment-Required`; MPP responses advertise a fresh `WWW-Authenticate: Payment ...` challenge. Successful MPP responses may include `Payment-Receipt`.
- `403`: Forbidden - User does not have required subscription tier or has exceeded credit limit
- `404`: Not Found - The requested resource was not found
- `422`: Validation error - Invalid request parameters
- `429`: Too Many Requests - Rate limit exceeded
- `500`: Internal Server Error - An unexpected error occurred

---

[API](https://skmtc.dev/nansen/apis/nansen-api.md) - [All operations](https://skmtc.dev/nansen/apis/nansen-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nansen/apis/nansen-api/revisions/02a4d2e7d827?raw)
