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

# Find a market by a venue's own market id

> The market universal id and every venue leg of the market a venue's own id names, read as orders read it; 404 when none lists it.



## OpenAPI

````yaml /openapi.json get /public/v1/markets
openapi: 3.1.0
info:
  description: >-
    Prediction-market data across Polymarket, Kalshi, Limitless and predict.fun
    over REST, and (Beta) order placement. Every request sends three headers,
    `X-Client-Id`, `X-Api-Key` and `X-Api-Secret`; try any endpoint from its
    page.
  title: TrendlineLabs Public API
  version: '1'
servers:
  - description: Production
    url: https://systems.trendlinelabs.ai
security: []
tags:
  - description: 'Read back the key you are calling with: its scopes, tier and rate limit.'
    name: Your key
  - description: Events group markets across venues; each carries a `universal_id`.
    name: Events
  - description: One market's order book, price history and trades on one venue.
    name: Markets
  - description: Current prices for a set of markets in one call.
    name: Prices
  - description: Live cross-venue price gaps on the same market.
    name: Opportunities
  - description: >-
      Beta, not yet enabled: place and cancel limit orders on your own venue
      accounts.
    name: Trading
paths:
  /public/v1/markets:
    get:
      tags:
        - Markets
      summary: Find a market by a venue's own market id
      description: >-
        The market universal id and every venue leg of the market a venue's own
        id names, read as orders read it; 404 when none lists it.
      operationId: getMarketByVenueId
      parameters:
        - description: the venue whose market id this is
          in: query
          name: venue
          required: true
          schema:
            description: the venue whose market id this is
            enum:
              - kalshi
              - polymarket
              - limitless
              - predictfun
            title: Venue
            type: string
        - description: >-
            the venue's own market id, as orders take it: Polymarket's and
            Limitless's slug, predict.fun's id, Kalshi's ticker
          in: query
          name: venue_market_id
          required: true
          schema:
            description: >-
              the venue's own market id, as orders take it: Polymarket's and
              Limitless's slug, predict.fun's id, Kalshi's ticker
            maxLength: 256
            minLength: 1
            title: Venue Market Id
            type: string
      responses:
        '200':
          content:
            application/json:
              example:
                markets:
                  - event_universal_id: ev-btc-100k-2026
                    legs:
                      kalshi:
                        state: live
                        venue_market_id: KXBTC-26DEC31-B100000
                      polymarket:
                        state: live
                        venue_market_id: bitcoin-above-100k-on-december-31
                    title: Bitcoin above $100,000 on December 31?
                    universal_id: mk-btc-100k-2026
                venue: polymarket
                venue_market_id: bitcoin-above-100k-on-december-31
              schema:
                $ref: '#/components/schemas/PublicVenueMarketLookup'
          description: Successful Response
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            unauthorized: missing or partial credential headers, parts that do
            not belong together, or a key that is unknown, revoked or expired.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            WWW-Authenticate:
              description: ApiKey realm="public-api"
              schema:
                type: string
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            insufficient_scope: the key lacks the scope this route needs;
            ip_not_allowed: the request came from an address outside the key's
            allowlist; tier_required: the key owner's plan does not include API
            access; access_not_granted: API access is free but granted on
            request; request it on https://trendlinelabs.ai/developer.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: 'not_found: no such event, market or key.'
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            invalid_request: a parameter is missing, unknown, malformed or out
            of bounds, or a cursor does not match.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            rate_limited: too many requests, or too many failed authentications;
            wait Retry-After seconds.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Retry-After:
              description: seconds to wait before retrying
              schema:
                type: integer
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            internal_error: an unexpected failure on our side; quote the request
            id. The body may instead be text/plain with no envelope and no
            X-RateLimit-* headers when a failure escapes the route's own
            handling.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            dependency_unavailable: one of our own stores could not be read;
            retry later; upstream_unavailable: the data source is unreadable,
            absent or older than its bound; never an empty 200.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
      security:
        - ApiKey: []
          ApiSecret: []
          ClientId: []
      x-codeSamples:
        - label: cURL
          lang: bash
          source: >
            #!/bin/sh

            # getMarketByVenueId: Find a market by a venue's own market id.
            Needs TRENDLINE_CLIENT_ID, TRENDLINE_API_KEY and
            TRENDLINE_API_SECRET; TRENDLINE_API_BASE overrides the base.

            curl -sS
            "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/markets?venue=polymarket&venue_market_id=bitcoin-above-100k-on-december-31"
            \
              -H "X-Client-Id: $TRENDLINE_CLIENT_ID" \
              -H "X-Api-Key: $TRENDLINE_API_KEY" \
              -H "X-Api-Secret: $TRENDLINE_API_SECRET"
        - label: Python
          lang: python
          source: >
            """getMarketByVenueId: Find a market by a venue's own market id.
            Needs TRENDLINE_CLIENT_ID, TRENDLINE_API_KEY and
            TRENDLINE_API_SECRET; TRENDLINE_API_BASE overrides the base."""

            import os


            import requests


            BASE = os.environ.get("TRENDLINE_API_BASE",
            "https://systems.trendlinelabs.ai")

            HEADERS = {"X-Client-Id": os.environ["TRENDLINE_CLIENT_ID"],
            "X-Api-Key": os.environ["TRENDLINE_API_KEY"],
                       "X-Api-Secret": os.environ["TRENDLINE_API_SECRET"]}

            r = requests.get(f"{BASE}/public/v1/markets", params={"venue":
            "polymarket", "venue_market_id":
            "bitcoin-above-100k-on-december-31"}, headers=HEADERS, timeout=10)

            r.raise_for_status()

            print(r.json())
        - label: JavaScript
          lang: javascript
          source: >
            // getMarketByVenueId: Find a market by a venue's own market id.
            Needs TRENDLINE_CLIENT_ID, TRENDLINE_API_KEY and
            TRENDLINE_API_SECRET; TRENDLINE_API_BASE overrides the base.

            const BASE = process.env.TRENDLINE_API_BASE ??
            "https://systems.trendlinelabs.ai";

            const HEADERS = { "X-Client-Id": process.env.TRENDLINE_CLIENT_ID,
            "X-Api-Key": process.env.TRENDLINE_API_KEY,
              "X-Api-Secret": process.env.TRENDLINE_API_SECRET };
            const r = await
            fetch(`${BASE}/public/v1/markets?venue=polymarket&venue_market_id=bitcoin-above-100k-on-december-31`,
            { headers: HEADERS });

            console.log(r.status, await r.json());
components:
  schemas:
    PublicVenueMarketLookup:
      properties:
        markets:
          description: every market with that leg, usually one; active markets first
          items:
            $ref: '#/components/schemas/PublicVenueMarket'
          title: Markets
          type: array
        venue:
          description: as sent
          enum:
            - kalshi
            - polymarket
            - limitless
            - predictfun
          title: Venue
          type: string
        venue_market_id:
          description: as sent
          title: Venue Market Id
          type: string
      required:
        - venue
        - venue_market_id
        - markets
      title: PublicVenueMarketLookup
      type: object
    PublicError:
      properties:
        error:
          $ref: '#/components/schemas/PublicErrorBody'
          description: the refusal
      required:
        - error
      title: PublicError
      type: object
    PublicVenueMarket:
      properties:
        event_universal_id:
          anyOf:
            - type: string
            - type: 'null'
          description: the market's event universal id
          title: Event Universal Id
        legs:
          additionalProperties:
            $ref: '#/components/schemas/PublicVenueMarketLeg'
          description: the market's leg on each venue that lists it
          propertyNames:
            enum:
              - kalshi
              - polymarket
              - limitless
              - predictfun
          title: Legs
          type: object
        title:
          anyOf:
            - type: string
            - type: 'null'
          description: the market's title
          title: Title
        universal_id:
          description: the market universal id every market-data and order route takes
          title: Universal Id
          type: string
      required:
        - universal_id
        - legs
      title: PublicVenueMarket
      type: object
    PublicErrorBody:
      properties:
        code:
          description: >-
            a machine-readable code from x-known-codes; a new code may be added,
            so handle an unknown one by its status
          title: Code
          type: string
          x-known-codes:
            - access_not_granted
            - dependency_unavailable
            - idempotency_conflict
            - insufficient_scope
            - internal_error
            - invalid_request
            - ip_not_allowed
            - jurisdiction_refused
            - limit_exceeded
            - market_closed
            - not_found
            - order_not_cancellable
            - order_not_found
            - price_off_tick
            - rate_limited
            - request_in_progress
            - tier_required
            - trade_not_granted
            - trading_halted
            - trading_tier_required
            - unauthorized
            - upstream_unavailable
            - venue_auth_failed
            - venue_leg_unverified
            - venue_not_connected
            - venue_not_listed
            - venue_rejected
            - venue_unavailable
            - venue_unsupported
        message:
          description: a human-readable explanation; never parse it
          title: Message
          type: string
        request_id:
          description: >-
            this request's id, also sent as the X-Request-Id header; quote it
            when asking for help
          title: Request Id
          type: string
      required:
        - code
        - message
        - request_id
      title: PublicErrorBody
      type: object
    PublicVenueMarketLeg:
      properties:
        state:
          description: closed when the venue no longer trades this leg
          enum:
            - live
            - closed
          title: State
          type: string
        venue_market_id:
          description: the market's id on this venue, as orders take it
          title: Venue Market Id
          type: string
      required:
        - venue_market_id
        - state
      title: PublicVenueMarketLeg
      type: object
  securitySchemes:
    ApiKey:
      description: the key's id; public
      in: header
      name: X-Api-Key
      type: apiKey
    ApiSecret:
      description: >-
        the key's secret (tl_live_…), shown once at creation; never log or share
        it
      in: header
      name: X-Api-Secret
      type: apiKey
    ClientId:
      description: the key's own client id (cli_…), different for every key; public
      in: header
      name: X-Client-Id
      type: apiKey

````

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