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

# Get Election Map

> Returns every Senate, House and governor race of an election cycle in all 50 states, with each candidate's latest price, plus the chamber-control markets, in one response.

**Use Case:** Shade an election map, list rated races and show who leads each one, without a request per race.


> [!NOTE]
>
> This endpoint is available on staging (`https://api.tradearies.dev`). Production availability will be announced in the [changelog](/changelog.md).

## Overview

One request returns the whole cycle: every state, every race in it, and every candidate's price. Use it to drive a map, a rated race list and a chamber-control card from a single response.

```
GET /v1/predictions/elections/2026/states
```

`2026` is the only cycle served. Any other answers `404`.

## Response shape

`data.national` holds the chamber-control markets. `data.states` holds all 50 states, sorted by name, each with its `senate`, `governor` and `house` races. A state with no race for an office has an empty array, never `null`. DC is not included.

Prices in this example are illustrative, and the response is trimmed to one Senate and one House race.

```json theme={null}
{
  "success": true,
  "data": {
    "cycle": 2026,
    "electionDate": "2026-11-03",
    "asOf": "2026-10-23T07:30:23.118Z",
    "national": {
      "houseControl": {
        "eventId": "HORC_1126",
        "outcomes": [
          { "symbol": "HORC_1126_Democratic", "party": "D", "yesPrice": "0.92", "yesPriceChange24h": "0" },
          { "symbol": "HORC_1126_Republican", "party": "R", "yesPrice": "0.10", "yesPriceChange24h": "0" }
        ]
      },
      "senateControl": {
        "eventId": "SENM_1126",
        "outcomes": [
          { "symbol": "SENM_1126_Democratic", "party": "D", "yesPrice": "0.66", "yesPriceChange24h": "0" },
          { "symbol": "SENM_1126_Republican", "party": "R", "yesPrice": "0.36", "yesPriceChange24h": "0" }
        ]
      },
      "balanceOfPower": {
        "eventId": "FEDRO_1126",
        "outcomes": [
          { "symbol": "FEDRO_1126_SDHD", "senate": "D", "house": "D", "yesPrice": "0.70", "yesPriceChange24h": "0" },
          { "symbol": "FEDRO_1126_SRHD", "senate": "R", "house": "D", "yesPrice": "0.37", "yesPriceChange24h": "0" }
        ]
      }
    },
    "states": [
      {
        "code": "TX",
        "name": "Texas",
        "houseSeats": 38,
        "senate": [
          {
            "eventId": "AXXTX_110326",
            "baseEventId": "AXXTX",
            "title": "Texas Senate",
            "raceType": "general",
            "electionDate": "2026-11-03",
            "heldBy": null,
            "status": "open",
            "lastTradeDate": "2026-12-06",
            "winningSymbol": null,
            "resolvedAt": null,
            "partyMarket": {
              "eventId": "XXXTX_110326",
              "outcomes": [
                { "symbol": "XXXTX_110326_R", "party": "R", "yesPrice": "0.76", "yesPriceChange24h": "0" },
                { "symbol": "XXXTX_110326_D", "party": "D", "yesPrice": "0.25", "yesPriceChange24h": "0" }
              ]
            },
            "outcomes": [
              {
                "symbol": "AXXTX_110326_JT",
                "name": "James Talarico",
                "party": null,
                "incumbent": null,
                "yesPrice": "0.66",
                "yesPriceChange24h": "0.08",
                "tradable": true,
                "photo": null
              },
              {
                "symbol": "AXXTX_110326_KP",
                "name": "Ken Paxton",
                "party": null,
                "incumbent": null,
                "yesPrice": "0.35",
                "yesPriceChange24h": "-0.06",
                "tradable": true,
                "photo": null
              }
            ]
          }
        ],
        "governor": [],
        "house": [
          {
            "eventId": "G07TX_110326",
            "baseEventId": "G07TX",
            "title": "TX-07",
            "district": 7,
            "atLarge": false,
            "raceType": "general",
            "electionDate": "2026-11-03",
            "heldBy": null,
            "status": "open",
            "lastTradeDate": "2026-12-06",
            "winningSymbol": null,
            "resolvedAt": null,
            "partyMarket": null,
            "outcomes": [
              {
                "symbol": "G07TX_110326_LF",
                "name": "Lizzie Fletcher",
                "party": null,
                "incumbent": null,
                "yesPrice": "0.91",
                "yesPriceChange24h": "0",
                "tradable": true,
                "photo": null
              },
              {
                "symbol": "G07TX_110326_AH",
                "name": "Alexander Hale",
                "party": null,
                "incumbent": null,
                "yesPrice": "0.07",
                "yesPriceChange24h": "0",
                "tradable": true,
                "photo": null
              }
            ]
          }
        ]
      }
    ]
  }
}
```

## Races

Each race is one event on the venue. Its office and state come from the event's categories, and its type and district from the venue's ticker.

| `raceType` | Meaning |
| - | - |
| `general` | November general election |
| `special` | Special election for a vacant seat, such as Ohio's and Florida's 2026 Senate seats |
| `primary_d`, `primary_r` | Democratic or Republican primary |
| `primary_open` | Nonpartisan or top-four primary, such as Alaska's |
| `runoff` | Runoff election |

* **House races** carry `district`. A state with a single seat has `district: 1` and `atLarge: true`.
* **`partyMarket`** is the venue's market on which *party* wins the race, when it lists one. It is attached to general elections only.
* **`outcomes`** has one entry per candidate, highest `yesPrice` first, untraded candidates last. Contracts the venue withdrew are left out. A candidate who lost a primary can still be listed while the venue keeps their contract open.

## Prices

* `yesPrice` is the candidate's last YES trade, as a decimal string. Once the race has settled it is the settlement value instead: `1` for the winner, `0` for everyone else.
* `yesPriceChange24h` is `yesPrice` less the YES price 24 hours earlier. A candidate who has not traded in the last day shows `0`.
* Both are `null` for a candidate who has never traded. `yesPriceChange24h` is also `null` when every trade is in the last 24 hours.
* Prices come from the venue's pair-trade files, so they can trail the live market by several minutes. For live prices on one race, use [Stream Live Prices](/api-reference/predictions/stream-live-prices.md).

## Status and results

| `status` | Meaning |
| - | - |
| `open` | Trading |
| `closed` | Trading has ended; the result is not yet known |
| `resolved` | The venue has settled the race. `winningSymbol` and `resolvedAt` are set |

The venue settles a race after the result is certified, which can be days or weeks after election day. Until then a race stays `open` or `closed`, however clear its result. Pass `includeResolved=false` to leave settled races out.

## Party, incumbent and photo

* `party` is `D`, `R`, `I` or `O`. It is set only where the venue's own listing names it: party markets, primaries, and a party's placeholder contract. Elsewhere it is `null` for now.
* `heldBy` and `incumbent` are `null` for now.
* `photo` is a freely licensed portrait (public domain, CC0, CC BY or CC BY-SA) when one is available, else `null`. Show `credit` and `license` with the image, or on a credits page the image links to: the license requires it.

```json theme={null}
"photo": {
  "url": "https://<photo host>/2026/AXXTX_110326_KP.webp",
  "credit": "Gage Skidmore",
  "license": "CC BY-SA 4.0",
  "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0",
  "sourceUrl": "https://commons.wikimedia.org/wiki/File:K_Paxton.jpg"
}
```

## Polling

The map is the same for every caller and is rebuilt at most every few seconds, so poll it rather than stream it.

* Send the previous response's `ETag` as `If-None-Match`. While nothing in the map has changed, the answer is `304` with no body.
* Send `Accept-Encoding: gzip`. The whole map is about 360 KB as JSON and about 35 KB gzipped.
* `asOf` is when the map was built. It is not part of the `ETag`, so after a `304` keep the `asOf` you already have.
* Each filter combination has its own `ETag`.
* A 10 to 15 second interval keeps a map current.

## Examples

```bash theme={null}
curl --compressed "https://api.tradearies.dev/v1/predictions/elections/2026/states"
```

```bash theme={null}
curl --compressed "https://api.tradearies.dev/v1/predictions/elections/2026/states?state=TX"
```

```bash theme={null}
curl --compressed "https://api.tradearies.dev/v1/predictions/elections/2026/states?office=house&raceType=general"
```

```bash theme={null}
curl -i --compressed "https://api.tradearies.dev/v1/predictions/elections/2026/states" \
  -H 'If-None-Match: "359d3e5222f03038-adfa5621"'
```

## Errors

* `400` — `cycle` is not a number, or `state`, `office`, `raceType` or `includeResolved` is not one of its allowed values
* `404` — no map for that cycle
* `500` — unexpected server error


## OpenAPI

````yaml openapi.json GET /v1/predictions/elections/{cycle}/states
openapi: 3.0.3
info:
  contact:
    email: support@aries.com
    name: Aries Financial
  description: >-
    OpenAPI Specification for the Aries trading platform API.


    # Authentication


    Learn how to authenticate with the Aries API using OAuth2 and manage access
    tokens in your SDK.


    ## Overview


    The Aries API uses **OAuth2 with Bearer tokens** (JWT format) for
    authentication. All API requests require a valid access token in the
    `Authorization` header:


    ```

    Authorization: Bearer <access_token>

    ```


    ## Providing Client ID and Client Secret (SDK)


    When using the generated SDK, provide your **Client ID** and **Client
    Secret** when you create the API client (e.g. in the constructor or security
    options). The SDK will use these to obtain and refresh the access token
    internally; you do not need to manage tokens yourself.


    Obtain your OAuth2 credentials from the Aries platform (e.g. Client Center /
    Manage Account at https://app.aries.com):


    - **Client ID** – Your application identifier (pass to SDK client)

    - **Client Secret** – Your application secret key (pass to SDK client; use
    PKCE for public clients where secret cannot be stored)


    ## Authentication Flow


    ### 1. Authorization Code Flow


    For server-side or confidential clients:


    1. **Redirect the user** to the authorization URL to sign in and consent:
     - **URL:** `https://app.aries.com/oauth2/authorize`
     - **Query params:** `response_type=code`, `client_id`, `redirect_uri`, `scope`, `state`

    2. **Exchange the code for tokens** (after user is redirected back with
    `?code=.`):
     - **POST** `https://api.aries.com/v1/oauth2/token`
     - **Body:** `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `client_secret`
     - Response includes `access_token` and `refresh_token`

    3. **Call the API** with the access token: `Authorization: Bearer
    <access_token>`


    ### 2. PKCE Flow


    For SPAs and mobile apps (public clients that cannot store `client_secret`):


    1. Generate a **code_verifier** (random string) and **code_challenge** =
    BASE64URL(SHA256(code_verifier)).

    2. **Redirect the user** to `https://app.aries.com/oauth2/authorize` with
    `code_challenge`, `code_challenge_method=S256`, plus `client_id`,
    `redirect_uri`, `scope`, `state`.

    3. **Exchange the code** at POST `https://api.aries.com/v1/oauth2/token`
    with `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`,
    `code_verifier` (no client_secret).

    4. Use the returned `access_token` as Bearer.


    ### 3. MFA Verification


    If the user has MFA enabled, the authorize step may return `is_mfa: true`
    and a `next_step_auth_id`. Call **POST**
    `https://api.aries.com/v1/oauth2/authorize/mfa` with `next_step_auth_id` and
    `verification_code` (6-digit code). Then continue with **POST**
    `/v1/oauth2/authorize/confirm` to get the authorization code, and exchange
    it at `/v1/oauth2/token`.


    ## Token Management


    - **Refresh when expired:** POST `https://api.aries.com/v1/oauth2/token`
    with `grant_type=refresh_token`, `client_id`, `client_secret`,
    `refresh_token`.

    - **Using a Bearer token directly:** If you already have an access token,
    set the header `Authorization: Bearer <access_token>` on every request. The
    SDK can accept a pre-obtained token and use it until it expires.


    ## OAuth2 Scopes


    Request only the scopes your application needs. Available scopes:


    | Scope | Description |

    |-------|-------------|

    | `user:information` | View user profile and personal details |

    | `watchlist:information` | View your watchlists and their symbols |

    | `watchlist:management` | Create, update, replace, and delete your
    watchlists |

    | `account:information` | View account balances, positions, and transaction
    history |

    | `order:execution` | Place, modify, and cancel orders |

    | `order:information` | View order history and status |

    | `position:information` | View current positions and holdings |

    | `market:information` | Access live and historical market data |

    | `calendar:information` | Access earnings, economic, and market schedule
    data |

    | `options:information` | Access options chains and expiration data |

    | `analytics:information` | View analytics, ratings, and market insights |

    | `market:supplemental` | News, company profiles, financials, filings, ETF
    data, technical analysis |


    Specify multiple scopes as a space-separated string, e.g.
    `account:information order:execution market:information`.


    ## Security Best Practices


    - **Store credentials securely** – Use environment variables or a secrets
    manager for `client_id` and `client_secret`. Never hardcode them.

    - **Handle token expiration** – Check for 401 responses and refresh the
    token using the refresh_token, then retry the request.

    - **Use HTTPS** – All authorization and token endpoints must be called over
    HTTPS.

    - **Validate state** – When using the authorization code flow, validate the
    `state` parameter on the callback to prevent CSRF.


    ## Error Handling


    - **400 Bad Request** – Invalid or missing parameters, validation failures,
    or malformed JSON. Response bodies follow the same patterns as other errors
    (flat `error` string, optional `codes`, nested `error` object, or rarely no
    body).


    - **401 Unauthorized** – Invalid or expired access token; refresh the token
    or re-authenticate. JSON bodies are not identical on every route: you may
    see a flat `error` string (sometimes with `codes`), a nested `error` object
    (`type`, `code`, `message`), or rarely an empty body


    - **403 Forbidden** – Insufficient scope or permissions for the requested
    resource. Error JSON may be flat or nested, like 400/401.


    - **404 Not Found** – Resource does not exist or is not visible. Error JSON
    may be flat or nested.


    - **500 / 5xx** – Server or upstream failure; retry with backoff. Do not
    depend on a single error JSON shape; some responses may have no body.



    ---


    Endpoints in this spec: health, OAuth2 (authorize, confirm, mfa, token),
    users, accounts, orders, market data, watchlist, chart, analytics,
    calendars, company, economy, financials, indices, options, news, and
    supplemental data.
  title: Aries API — OpenAPI Specification
  version: 1.0.0
servers:
  - description: Production server
    url: https://api.aries.com
  - description: Staging server
    url: https://api.tradearies.dev
security: []
tags:
  - description: Account management endpoints for positions, orders, and balances
    name: Accounts
  - description: >-
      Analytics endpoints for market data analysis including top gainers,
      losers, volume leaders, sector analysis, analyst ratings, market breadth,
      and net inflow
    name: Analytics
  - description: Calendar and mergers/acquisitions endpoints
    name: Calendar
  - description: Chart endpoints for config, symbols, history, quotes, and server time
    name: Chart
  - description: Company profile, executives, peers, and financial metrics
    name: Company
  - description: 'Corporate actions: spinoffs, tender offers, IPO calendar, dividends'
    name: Corporate Actions
  - description: ETF profile, holdings, sector allocation, and country allocation
    name: ETF
  - description: 'Economy endpoints: inflation, inflation expectations, treasury yields'
    name: Economy
  - description: SEC filings and filing similarity index
    name: Filings
  - description: >-
      Financials: reported, statements, revenue breakdown, short volume, ratios,
      short interest
    name: Financials
  - description: >-
      Indices endpoints for groups, list, search, bar, bars, chart-bars,
      realtime values
    name: Indices
  - description: Logos search and sync endpoints
    name: Logos
  - description: Market status and market holidays by exchange
    name: Market
  - description: >-
      Market data endpoints for symbol search, real-time data access, and equity
      details
    name: Market Data
  - description: News and news sentiment endpoints
    name: News
  - description: >-
      OAuth2 token issuance: exchange authorization codes, refresh tokens, or
      client credentials for access tokens
    name: OAuth2
  - description: >-
      Options endpoints: expiry dates, contracts, activity, trades, quotes,
      unusual activity
    name: Options
  - description: >-
      Order management endpoints for placing, updating, canceling, and
      previewing orders
    name: Orders
  - description: Company, fund, insider, and institutional ownership data
    name: Ownership
  - description: Signals and bull-bear cases
    name: Signals
  - description: >-
      Transcripts, company presentation, social sentiment, investment themes,
      supply chain, and ESG data
    name: Stock Alternative
  - description: >-
      Analyst price targets, upgrades and downgrades, revenue, EBITDA, EBIT, and
      EPS estimates, and earnings surprises
    name: Stock Estimates
  - description: Stock aggregate bars, daily summaries, snapshots, trades, and quotes
    name: Stocks
  - description: >-
      Technical patterns, support and resistance levels, aggregate technical
      indicators, and indicator time series
    name: Technical Analysis
  - description: Basic information about the authenticated user
    name: Users
  - description: >-
      Watchlist endpoints for listing, creating, updating, and deleting
      watchlists
    name: Watchlist
  - description: Historical YES/NO tick data for prediction-market contracts
    name: Prediction Historical Data
  - description: >-
      Prediction-market reference data and full-text search over base events,
      events, and contracts
    name: Prediction Market Data
  - description: >-
      Closed beta. Place prediction-market orders and read back the
      authenticated user's order history.
    name: Prediction Orders
paths:
  /v1/predictions/elections/{cycle}/states:
    get:
      tags:
        - Prediction Market Data
      summary: Get every race of an election cycle with its candidates' prices
      description: >-
        Every Senate, House and governor race of the cycle in all 50 states,
        with each candidate's latest price and 24-hour change, plus the
        House-control, Senate-majority and balance-of-power markets, in one
        response. Built for an election map: poll it with `If-None-Match`.
      operationId: getElectionMap
      parameters:
        - description: Election year. `2026` is the only cycle served.
          in: path
          name: cycle
          required: true
          schema:
            example: 2026
            type: integer
        - description: Two-letter code of one of the 50 states. Returns that state only.
          in: query
          name: state
          required: false
          schema:
            example: TX
            type: string
        - description: 'Comma-separated: `senate`, `governor`, `house`. Default: all.'
          in: query
          name: office
          required: false
          schema:
            example: senate,house
            type: string
        - description: >-
            Comma-separated: `general`, `special`, `primary_d`, `primary_r`,
            `primary_open`, `runoff`. Default: all.
          in: query
          name: raceType
          required: false
          schema:
            example: general,special
            type: string
        - description: '`false` leaves out races the venue has settled.'
          in: query
          name: includeResolved
          required: false
          schema:
            default: true
            type: boolean
        - description: >-
            The `ETag` of a previous response. Answers `304` while the map is
            unchanged.
          in: header
          name: If-None-Match
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PredMdSuccessEnvelope'
                  - properties:
                      data:
                        $ref: '#/components/schemas/PredMdElectionMap'
                    type: object
          description: >-
            The election map. Gzipped when the request sends `Accept-Encoding:
            gzip`.
          headers:
            Cache-Control:
              description: '`no-cache`: revalidate with `If-None-Match` before reuse.'
              schema:
                type: string
            ETag:
              description: >-
                Changes when anything in the map but `asOf` changes, and differs
                per filter.
              schema:
                type: string
        '304':
          description: Unchanged since the `ETag` in `If-None-Match`. No body.
        '400':
          $ref: '#/components/responses/PredMdBadRequest'
        '404':
          $ref: '#/components/responses/PredMdNotFound'
        '500':
          $ref: '#/components/responses/PredMdInternalServerError'
      security: []
components:
  schemas:
    PredMdSuccessEnvelope:
      description: >-
        Standard success envelope used by all success responses. `data` is
        endpoint-specific.
      properties:
        data: {}
        success:
          example: true
          type: boolean
      required:
        - success
      type: object
    PredMdElectionMap:
      description: >-
        Every race of one election cycle in all 50 states, with each candidate's
        price, plus the chamber-control markets.
      properties:
        asOf:
          description: >-
            When this map was built. Prices are as fresh as the venue's
            pair-trade files it reads.
          example: '2026-10-22T17:32:50.815Z'
          format: date-time
          type: string
        cycle:
          example: 2026
          type: integer
        electionDate:
          description: The cycle's November general election.
          example: '2026-11-03'
          format: date
          type: string
        national:
          $ref: '#/components/schemas/PredMdElectionNational'
        states:
          description: >-
            All 50 states, sorted by name, each present even with no race. DC is
            not included.
          items:
            $ref: '#/components/schemas/PredMdElectionState'
          type: array
      required:
        - cycle
        - electionDate
        - asOf
        - national
        - states
      type: object
    PredMdElectionNational:
      description: >-
        The chamber-control markets. A market the venue does not list for the
        cycle is `null`.
      properties:
        balanceOfPower:
          allOf:
            - $ref: '#/components/schemas/PredMdElectionMarket'
          description: >-
            Which party controls each chamber: one outcome per Senate × House
            split (`FEDRO_1126`).
          nullable: true
        houseControl:
          allOf:
            - $ref: '#/components/schemas/PredMdElectionMarket'
          description: Which party controls the House (`HORC_1126`).
          nullable: true
        senateControl:
          allOf:
            - $ref: '#/components/schemas/PredMdElectionMarket'
          description: Which party holds the Senate majority (`SENM_1126`).
          nullable: true
      required:
        - houseControl
        - senateControl
        - balanceOfPower
      type: object
    PredMdElectionState:
      properties:
        code:
          example: TX
          type: string
        governor:
          items:
            $ref: '#/components/schemas/PredMdElectionRace'
          type: array
        house:
          description: Sorted by district.
          items:
            $ref: '#/components/schemas/PredMdElectionRace'
          type: array
        houseSeats:
          description: House seats under the 2020 apportionment.
          example: 38
          type: integer
        name:
          example: Texas
          type: string
        senate:
          description: 'A state can hold two: a regular race and a special.'
          items:
            $ref: '#/components/schemas/PredMdElectionRace'
          type: array
      required:
        - code
        - name
        - houseSeats
        - senate
        - governor
        - house
      type: object
    ErrorEnvelope:
      description: >-
        Prediction-market error envelope. Returned by historical-data and
        prediction-market reference endpoints on 400/404/500/502.
      properties:
        error:
          $ref: '#/components/schemas/AppError'
        success:
          example: false
          type: boolean
      required:
        - success
        - error
      type: object
    PredMdElectionMarket:
      properties:
        eventId:
          example: HORC_1126
          type: string
        outcomes:
          description: Sorted by `yesPrice`, highest first; untraded outcomes last.
          items:
            $ref: '#/components/schemas/PredMdElectionMarketOutcome'
          type: array
      required:
        - eventId
        - outcomes
      type: object
    PredMdElectionRace:
      properties:
        atLarge:
          description: >-
            House races only. `true` for a state's single at-large seat, which
            is `district` 1.
          example: false
          type: boolean
        baseEventId:
          example: AXXTX
          type: string
        district:
          description: House races only.
          example: 7
          type: integer
        electionDate:
          description: '`null` when the venue gives no day for the race.'
          example: '2026-11-03'
          format: date
          nullable: true
          type: string
        eventId:
          example: AXXTX_110326
          type: string
        heldBy:
          description: Party that holds the seat today. Always `null` for now.
          enum:
            - D
            - R
            - I
            - O
          nullable: true
          type: string
        lastTradeDate:
          description: Last day any of the race's contracts trades.
          example: '2026-12-06'
          format: date
          nullable: true
          type: string
        outcomes:
          description: >-
            One per candidate, sorted by `yesPrice`, highest first; untraded
            candidates last. Contracts the venue withdrew are left out.
          items:
            $ref: '#/components/schemas/PredMdElectionOutcome'
          type: array
        partyMarket:
          allOf:
            - $ref: '#/components/schemas/PredMdElectionMarket'
          description: >-
            The venue's market on which party wins this race, when it lists one.
            General elections only.
          nullable: true
        raceType:
          enum:
            - general
            - special
            - primary_d
            - primary_r
            - primary_open
            - runoff
          example: general
          type: string
        resolvedAt:
          description: When the winning contract settled.
          format: date-time
          nullable: true
          type: string
        status:
          description: >-
            `open` while it trades, `closed` once trading has ended and the
            result is not yet known, `resolved` once the venue has settled it.
          enum:
            - open
            - closed
            - resolved
          example: open
          type: string
        title:
          example: Texas Senate
          type: string
        winningSymbol:
          description: The contract that settled YES. Set when `status` is `resolved`.
          nullable: true
          type: string
      required:
        - eventId
        - baseEventId
        - title
        - raceType
        - electionDate
        - heldBy
        - status
        - lastTradeDate
        - winningSymbol
        - resolvedAt
        - partyMarket
        - outcomes
      type: object
    AppError:
      description: Structured application error returned inside an `ErrorEnvelope`.
      properties:
        code:
          description: Machine-readable code, e.g. `SYMBOL_REQUIRED`, `EVENT_NOT_FOUND`.
          example: SYMBOL_REQUIRED
          type: string
        details:
          additionalProperties: true
          type: object
        message:
          description: >-
            Error detail as a string. Exact message content is not fixed and
            should not be hard-coded.
          example: string
          type: string
        operation:
          type: string
        request_id:
          type: string
        service:
          type: string
        type:
          description: >-
            Categorical error type. Use this for branching error-handling logic;
            the values are stable across endpoints:

            - `VALIDATION` — request body or query parameters failed validation.

            - `AUTHENTICATION` — missing, invalid, or expired token.

            - `AUTHORIZATION` — token is valid but lacks the required
            scope/permission.

            - `NOT_FOUND` — the requested resource does not exist.

            - `CONFLICT` — request conflicts with current state (e.g.
            duplicate).

            - `INTERNAL` — server-side error; retry or contact support.

            - `TIMEOUT` — operation took too long.

            - `UNKNOWN` — uncategorized error; check `message`.

            (Additional categorical values may appear in service-specific
            responses.)
          enum:
            - UNKNOWN
            - VALIDATION
            - AUTHENTICATION
            - AUTHORIZATION
            - NOT_FOUND
            - CONFLICT
            - INTERNAL
            - TIMEOUT
            - RATE_LIMIT
            - BAD_REQUEST
            - DATABASE
            - EXTERNAL_SERVICE
            - PRECONDITION_FAILED
            - SERVICE_UNAVAILABLE
            - GRPC
            - QUEUE
            - JSON_PARSING
          type: string
      required:
        - type
        - code
        - message
      type: object
    PredMdElectionMarketOutcome:
      description: >-
        One outcome of a party or chamber-control market. `party` is set on
        party markets; `senate` and `house` on balance-of-power outcomes.
      properties:
        house:
          description: House majority this balance-of-power outcome names.
          enum:
            - D
            - R
          type: string
        party:
          enum:
            - D
            - R
            - I
            - O
          example: D
          type: string
        senate:
          description: Senate majority this balance-of-power outcome names.
          enum:
            - D
            - R
          type: string
        symbol:
          example: HORC_1126_Democratic
          type: string
        yesPrice:
          description: >-
            Last YES trade, or the settlement once settled; `null` if never
            traded. Exact decimal string.
          example: '0.55'
          format: decimal
          nullable: true
          type: string
        yesPriceChange24h:
          description: >-
            `yesPrice` less the YES price 24 hours earlier; `null` if either is
            missing. Exact decimal string.
          example: '0.01'
          format: decimal
          nullable: true
          type: string
      required:
        - symbol
        - yesPrice
        - yesPriceChange24h
      type: object
    PredMdElectionOutcome:
      description: One candidate.
      properties:
        incumbent:
          description: Always `null` for now.
          nullable: true
          type: boolean
        name:
          example: James Talarico
          type: string
        party:
          description: >-
            Set only where the venue's own listing names it: a primary, or a
            party's placeholder contract. Otherwise `null`.
          enum:
            - D
            - R
            - I
            - O
          nullable: true
          type: string
        photo:
          allOf:
            - $ref: '#/components/schemas/PredMdElectionPhoto'
          description: Candidate portrait, when one is available.
          nullable: true
        symbol:
          example: AXXTX_110326_JT
          type: string
        tradable:
          type: boolean
        yesPrice:
          description: >-
            Last YES trade, or the settlement once settled; `null` if never
            traded. Exact decimal string.
          example: '0.66'
          format: decimal
          nullable: true
          type: string
        yesPriceChange24h:
          description: >-
            `yesPrice` less the YES price 24 hours earlier; `null` if either is
            missing. Exact decimal string.
          example: '0.08'
          format: decimal
          nullable: true
          type: string
      required:
        - symbol
        - name
        - party
        - incumbent
        - yesPrice
        - yesPriceChange24h
        - tradable
        - photo
      type: object
    PredMdElectionPhoto:
      description: >-
        A freely licensed portrait (public domain, CC0, CC BY or CC BY-SA). Show
        `credit` and `license` wherever you show the image, or on a credits page
        it links to.
      properties:
        credit:
          example: Gage Skidmore
          type: string
        license:
          example: CC BY-SA 4.0
          type: string
        licenseUrl:
          example: https://creativecommons.org/licenses/by-sa/4.0
          nullable: true
          type: string
        sourceUrl:
          example: https://commons.wikimedia.org/wiki/File:K_Paxton.jpg
          type: string
        url:
          description: 256×256 webp.
          type: string
      required:
        - url
        - credit
        - license
        - licenseUrl
        - sourceUrl
      type: object
  responses:
    PredMdBadRequest:
      content:
        application/json:
          example:
            error:
              code: SYMBOL_REQUIRED
              message: string
              type: VALIDATION
            success: false
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
      description: >-
        Invalid request (validation error, malformed JSON, or missing required
        parameters). Response body is a prediction-market `ErrorEnvelope` with a
        structured `AppError`.
    PredMdNotFound:
      content:
        application/json:
          example:
            error:
              code: EVENT_NOT_FOUND
              message: string
              type: NOT_FOUND
            success: false
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
      description: >-
        Resource not found. Response body is a prediction-market `ErrorEnvelope`
        with a structured `AppError`.
    PredMdInternalServerError:
      content:
        application/json:
          example:
            error:
              code: INTERNAL_ERROR
              message: string
              type: INTERNAL
            success: false
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
      description: >-
        Unexpected server error. Response body is a prediction-market
        `ErrorEnvelope` with a structured `AppError`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.