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

# Get live midpoints for multiple markets

> Returns live orderbook midpoints for the requested venue market IDs. `venueMarketIds` accepts either a comma-separated string (`?venueMarketIds=a,b,c`) or repeated params (`?venueMarketIds=a&venueMarketIds=b`). Midpoint represents the Yes-side price (0-1). Direct GET callers should keep batches small enough to stay under CDN URL limits; AGG SDK/UI clients default to 75 IDs per request and merge multiple batches automatically. Pass `bestPrice=true` to also receive top-of-book `bestBid`/`bestAsk` on every entry, per-outcome row, and matched sibling, plus `arbReturn` — the live, quality-gated cross-venue arbitrage return for the market's cluster, computed fresh by the engine on this request. Prefer it over the `arbReturn` embedded in venue-event listings, which is synced by a background job and can be stale. Every entry carries `marketStatus`; resolved markets never serve a price — they return null prices plus a structured `error` (`code: "market_resolved"`), and unknown ids return `code: "market_not_found"`, mirroring GET /orderbooks. Returns 503 if the orderbook engine is unavailable.



## OpenAPI

````yaml /openapi/openapi.json get /midpoints
openapi: 3.0.2
info:
  title: AGG API
  version: 1.0.0
  description: >-
    Prediction market aggregator REST API — authentication, users, venue events,
    venue markets, orderbooks, charts, and execution workflows.
servers:
  - url: https://api.agg.market
    description: Production
  - url: https://api.staging.agg.market
    description: Staging
security: []
paths:
  /midpoints:
    get:
      tags:
        - Orderbook
      summary: Get live midpoints for multiple markets
      description: >-
        Returns live orderbook midpoints for the requested venue market IDs.
        `venueMarketIds` accepts either a comma-separated string
        (`?venueMarketIds=a,b,c`) or repeated params
        (`?venueMarketIds=a&venueMarketIds=b`). Midpoint represents the Yes-side
        price (0-1). Direct GET callers should keep batches small enough to stay
        under CDN URL limits; AGG SDK/UI clients default to 75 IDs per request
        and merge multiple batches automatically. Pass `bestPrice=true` to also
        receive top-of-book `bestBid`/`bestAsk` on every entry, per-outcome row,
        and matched sibling, plus `arbReturn` — the live, quality-gated
        cross-venue arbitrage return for the market's cluster, computed fresh by
        the engine on this request. Prefer it over the `arbReturn` embedded in
        venue-event listings, which is synced by a background job and can be
        stale. Every entry carries `marketStatus`; resolved markets never serve
        a price — they return null prices plus a structured `error` (`code:
        "market_resolved"`), and unknown ids return `code: "market_not_found"`,
        mirroring GET /orderbooks. Returns 503 if the orderbook engine is
        unavailable.
      operationId: getMidpoints
      parameters:
        - name: venueMarketIds
          in: query
          required: true
          schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
        - name: bestPrice
          in: query
          required: false
          schema:
            type: boolean
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      required:
                        - venueMarketId
                        - venue
                        - midpoint
                        - spread
                        - timestamp
                        - outcomes
                        - matched
                      properties:
                        venueMarketId:
                          type: string
                        venue:
                          type: string
                        midpoint:
                          type: number
                          nullable: true
                        spread:
                          type: number
                          nullable: true
                        timestamp:
                          type: number
                          nullable: true
                        outcomes:
                          type: array
                          items:
                            type: object
                            required:
                              - venueMarketOutcomeId
                              - label
                              - midpoint
                            properties:
                              venueMarketOutcomeId:
                                type: string
                              label:
                                type: string
                              midpoint:
                                type: number
                                nullable: true
                              markSource:
                                type: string
                                enum:
                                  - local
                                  - local_merged
                                  - local_one_sided
                                  - sibling
                                  - local_boundary
                                  - none
                              bookQuality:
                                type: string
                                enum:
                                  - healthy
                                  - bid_only
                                  - ask_only
                                  - endpoint_stub
                                  - wide_spread
                                  - crossed
                                  - empty
                              bestBid:
                                type: number
                                nullable: true
                              bestAsk:
                                type: number
                                nullable: true
                        matched:
                          type: array
                          items:
                            type: object
                            required:
                              - venueMarketId
                              - venue
                              - midpoint
                            properties:
                              venueMarketId:
                                type: string
                              venue:
                                type: string
                              midpoint:
                                type: number
                                nullable: true
                              outcomes:
                                type: array
                                items:
                                  type: object
                                  required:
                                    - venueMarketOutcomeId
                                    - midpoint
                                  properties:
                                    venueMarketOutcomeId:
                                      type: string
                                    label:
                                      type: string
                                    midpoint:
                                      type: number
                                      nullable: true
                                    bestBid:
                                      type: number
                                      nullable: true
                                    bestAsk:
                                      type: number
                                      nullable: true
                              bestBid:
                                type: number
                                nullable: true
                              bestAsk:
                                type: number
                                nullable: true
                        markSource:
                          type: string
                          enum:
                            - local
                            - local_merged
                            - local_one_sided
                            - sibling
                            - local_boundary
                            - none
                        siblingVenueMarketId:
                          type: string
                        bestBid:
                          type: number
                          nullable: true
                        bestAsk:
                          type: number
                          nullable: true
                        arbReturn:
                          type: number
                          nullable: true
                        marketStatus:
                          type: string
                          enum:
                            - open
                            - closed
                            - resolved
                            - unopened
                            - paused
                        error:
                          type: object
                          required:
                            - code
                            - message
                            - retryable
                          properties:
                            code:
                              type: string
                              enum:
                                - market_resolved
                                - market_not_found
                            message:
                              type: string
                            retryable:
                              type: boolean
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                properties:
                  message:
                    type: string
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                properties:
                  message:
                    type: string
        '503':
          description: '503'
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - retryable
                properties:
                  code:
                    type: string
                    enum:
                      - orderbook_service_unavailable
                  message:
                    type: string
                  retryable:
                    type: boolean
      security:
        - appId: []
components:
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-app-id
      description: Your application ID. Required for all app-tier and user-tier routes.

````