> ## 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.

# Compute order route

> Computes a fill quote across available venues for a specific venue market outcome and returns the suggested fills. When a user JWT is supplied the quote is scoped to the user's wallet balances and may be executed; without a JWT the response is a preview-only quote.



## OpenAPI

````yaml /openapi/openapi.json get /orderbook/{venueMarketOutcomeId}/route
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:
  /orderbook/{venueMarketOutcomeId}/route:
    get:
      tags:
        - Orderbook
      summary: Compute order route
      description: >-
        Computes a fill quote across available venues for a specific venue
        market outcome and returns the suggested fills. When a user JWT is
        supplied the quote is scoped to the user's wallet balances and may be
        executed; without a JWT the response is a preview-only quote.
      operationId: getSmartRoute
      parameters:
        - name: venueMarketOutcomeId
          in: path
          required: true
          schema:
            type: string
        - name: mode
          in: query
          required: false
          schema:
            type: string
            enum:
              - live
              - paper
        - name: chainBalances
          in: query
          required: false
          schema:
            type: string
        - name: slipCapBps
          in: query
          required: false
          schema:
            minimum: 0
            type: number
        - name: maxSpend
          in: query
          required: false
          schema:
            exclusiveMinimum: true
            type: number
            minimum: 0
        - name: sellShares
          in: query
          required: false
          schema:
            exclusiveMinimum: true
            type: number
            minimum: 0
        - name: compareVenues
          in: query
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: allowedVenues
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  type: string
                  enum:
                    - kalshi
                    - polymarket
                    - limitless
                    - opinion
                    - predict
                    - probable
                    - myriad
                    - hyperliquid
              - type: string
                enum:
                  - kalshi
                  - polymarket
                  - limitless
                  - opinion
                  - predict
                  - probable
                  - myriad
                  - hyperliquid
        - name: side
          in: query
          required: false
          schema:
            type: string
            enum:
              - buy
              - sell
        - name: deepEstimate
          in: query
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                required:
                  - quoteId
                  - venueMarketOutcomeId
                  - venueMarketId
                  - estimatedCostRaw
                  - expiresAt
                  - refreshAt
                  - status
                  - fills
                  - totalFilled
                  - rawExecCost
                  - solveTimeMs
                  - verifyTimeMs
                  - matchedMarkets
                properties:
                  quoteId:
                    type: string
                  venueMarketOutcomeId:
                    type: string
                  venueMarketId:
                    type: string
                  estimatedCostRaw:
                    type: string
                  expiresAt:
                    type: string
                  refreshAt:
                    type: string
                  status:
                    type: string
                    enum:
                      - ok
                      - infeasible
                      - checker_rejected
                      - solver_error
                      - invalid_input
                      - no_orderbooks
                      - insufficient_input_amount
                      - engine_unavailable
                      - min_order_size_violated
                      - insufficient_balance
                      - insufficient_position
                      - insufficient_depth
                      - no_bids_above_min_price
                  fills:
                    type: array
                    items:
                      type: object
                      required:
                        - venue
                        - venueMarketId
                        - venueMarketOutcomeId
                        - chain
                        - avgPrice
                        - yesPrice
                        - noPrice
                        - fills
                        - venueQty
                      properties:
                        venue:
                          type: string
                        venueMarketId:
                          type: string
                        venueMarketOutcomeId:
                          type: string
                        chain:
                          type: string
                        avgPrice:
                          type: number
                        yesPrice:
                          type: number
                        noPrice:
                          type: number
                        fills:
                          type: array
                          items:
                            type: object
                            required:
                              - price
                              - size
                              - fill
                            properties:
                              price:
                                type: number
                              size:
                                type: number
                              fill:
                                type: number
                        venueQty:
                          type: number
                        venueFee:
                          type: number
                  totalFilled:
                    type: number
                  rawExecCost:
                    type: number
                  solveTimeMs:
                    type: number
                  verifyTimeMs:
                    type: number
                  matchedMarkets:
                    type: array
                    items:
                      type: object
                      required:
                        - venue
                        - venueMarketId
                      properties:
                        venue:
                          type: string
                        venueMarketId:
                          type: string
                  error:
                    type: string
                  venueSoloQuotes:
                    type: array
                    items:
                      type: object
                      required:
                        - quoteId
                        - venue
                        - avgPrice
                        - filledQty
                        - rawExecCost
                        - estimatedPayout
                        - estimatedProfit
                        - returnPct
                        - status
                        - fills
                      properties:
                        quoteId:
                          type: string
                          nullable: true
                        venue:
                          type: string
                        avgPrice:
                          type: number
                          nullable: true
                        filledQty:
                          type: number
                        rawExecCost:
                          type: number
                        estimatedPayout:
                          type: number
                        estimatedProfit:
                          type: number
                        returnPct:
                          type: number
                        status:
                          type: string
                        fills:
                          type: array
                          items:
                            type: object
                            required:
                              - venue
                              - venueMarketId
                              - venueMarketOutcomeId
                              - chain
                              - avgPrice
                              - yesPrice
                              - noPrice
                              - fills
                              - venueQty
                            properties:
                              venue:
                                type: string
                              venueMarketId:
                                type: string
                              venueMarketOutcomeId:
                                type: string
                              chain:
                                type: string
                              avgPrice:
                                type: number
                              yesPrice:
                                type: number
                              noPrice:
                                type: number
                              fills:
                                type: array
                                items:
                                  type: object
                                  required:
                                    - price
                                    - size
                                    - fill
                                  properties:
                                    price:
                                      type: number
                                    size:
                                      type: number
                                    fill:
                                      type: number
                              venueQty:
                                type: number
                              venueFee:
                                type: number
                        allocations:
                          type: array
                          items:
                            type: object
                            required:
                              - sourceChainId
                              - venue
                              - amount
                            properties:
                              sourceChainId:
                                type: string
                              venue:
                                type: string
                              amount:
                                type: number
                              sourceTokenAddress:
                                type: string
                              custodyKind:
                                type: string
                                enum:
                                  - EOA
                                  - DEPOSIT_WALLET
                              custodyAddress:
                                type: string
                              exactToken:
                                type: boolean
                        bridgeSteps:
                          type: array
                          items:
                            type: object
                            required:
                              - sourceChainId
                              - destChainId
                              - amount
                              - cost
                            properties:
                              sourceChainId:
                                type: string
                              destChainId:
                                type: string
                              amount:
                                type: number
                              cost:
                                type: number
                              sourceTokenAddress:
                                type: string
                              destTokenAddress:
                                type: string
                        setupCosts:
                          type: array
                          items:
                            type: object
                            required:
                              - kind
                              - venue
                              - costUsd
                              - alreadyPaid
                            properties:
                              kind:
                                type: string
                                enum:
                                  - chainApproval
                                  - venueMarketAta
                              venue:
                                type: string
                              chainId:
                                type: number
                              venueMarketId:
                                type: string
                              costUsd:
                                type: number
                              alreadyPaid:
                                type: boolean
                        setupCostsTotal:
                          type: number
                  allocations:
                    type: array
                    items:
                      type: object
                      required:
                        - sourceChainId
                        - venue
                        - amount
                      properties:
                        sourceChainId:
                          type: string
                        venue:
                          type: string
                        amount:
                          type: number
                        sourceTokenAddress:
                          type: string
                        custodyKind:
                          type: string
                          enum:
                            - EOA
                            - DEPOSIT_WALLET
                        custodyAddress:
                          type: string
                        exactToken:
                          type: boolean
                  bridgeSteps:
                    type: array
                    items:
                      type: object
                      required:
                        - sourceChainId
                        - destChainId
                        - amount
                        - cost
                      properties:
                        sourceChainId:
                          type: string
                        destChainId:
                          type: string
                        amount:
                          type: number
                        cost:
                          type: number
                        sourceTokenAddress:
                          type: string
                        destTokenAddress:
                          type: string
                  feeBreakdown:
                    type: object
                    required:
                      - rawExecCost
                      - venueFees
                      - bridgeFees
                      - executionGas
                      - totalCost
                    properties:
                      rawExecCost:
                        type: number
                      venueFees:
                        type: number
                      bridgeFees:
                        type: number
                      executionGas:
                        type: number
                      totalCost:
                        type: number
                      setupCosts:
                        type: array
                        items:
                          type: object
                          required:
                            - kind
                            - venue
                            - costUsd
                            - alreadyPaid
                          properties:
                            kind:
                              type: string
                              enum:
                                - chainApproval
                                - venueMarketAta
                            venue:
                              type: string
                            chainId:
                              type: number
                            venueMarketId:
                              type: string
                            costUsd:
                              type: number
                            alreadyPaid:
                              type: boolean
                      setupCostsTotal:
                        type: number
                      appFee:
                        type: number
                      appFeeBips:
                        type: number
                      appFeeCategory:
                        type: string
                  slippage:
                    type: object
                    required:
                      - vwap
                      - refMidpoint
                      - slippage
                      - slippageBps
                    properties:
                      vwap:
                        type: number
                      refMidpoint:
                        type: number
                      slippage:
                        type: number
                      slippageBps:
                        type: number
                  optima:
                    type: object
                    required:
                      - maxFilledQty
                      - minSlippage
                      - minCost
                      - minRisk
                      - minBridges
                      - minVenues
                    properties:
                      maxFilledQty:
                        type: number
                      minSlippage:
                        type: number
                      minCost:
                        type: number
                      minRisk:
                        type: number
                      minBridges:
                        type: number
                      minVenues:
                        type: number
                  warnings:
                    type: array
                    items:
                      type: object
                      required:
                        - venue
                        - venueMarketOutcomeId
                        - reason
                      properties:
                        venue:
                          type: string
                        venueMarketOutcomeId:
                          type: string
                        reason:
                          type: string
                  message:
                    type: string
                  settlementPlan:
                    type: object
                    required:
                      - redeemId
                      - status
                      - message
                      - totalRedeemableShares
                      - totalRedeemShares
                      - totalSellShares
                      - redeemLegs
                    properties:
                      redeemId:
                        type: string
                      status:
                        type: string
                        enum:
                          - redeem_only
                          - partial_redeem
                      message:
                        type: string
                      totalRedeemableShares:
                        type: number
                      totalRedeemShares:
                        type: number
                      totalSellShares:
                        type: number
                      redeemLegs:
                        type: array
                        items:
                          type: object
                          required:
                            - action
                            - venue
                            - venueMarketId
                            - venueMarketOutcomeId
                            - positionId
                            - size
                            - redeemPath
                          properties:
                            action:
                              type: string
                              enum:
                                - redeem
                            venue:
                              type: string
                            venueMarketId:
                              type: string
                            venueMarketOutcomeId:
                              type: string
                            positionId:
                              type: string
                            size:
                              type: string
                            redeemPath:
                              type: string
                              enum:
                                - evm
                                - svm
                  estimatedPayout:
                    type: number
                  totalCostIncFees:
                    type: number
                  estimatedProfit:
                    type: number
                  returnPct:
                    type: number
                  positionAvailability:
                    type: object
                    required:
                      - totalSellableShares
                      - venueMarketOutcomes
                    properties:
                      totalSellableShares:
                        type: number
                      venueMarketOutcomes:
                        type: array
                        items:
                          type: object
                          required:
                            - id
                            - venue
                            - venueMarketId
                            - availableShares
                          properties:
                            id:
                              type: string
                            venue:
                              type: string
                            venueMarketId:
                              type: string
                            availableShares:
                              type: number
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                properties:
                  message:
                    type: string
                  code:
                    type: string
                    enum:
                      - quote_not_found
                      - quote_expired
                      - quote_already_executed
                      - quote_cancelled
                      - quote_user_mismatch
                      - quote_app_blocked
                      - quote_unfillable
                      - quote_stale_status
                      - quote_stale_price
                      - quote_insufficient_balance
                      - quote_market_inactive
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                properties:
                  message:
                    type: string
        '403':
          description: '403'
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                properties:
                  message:
                    type: string
        '404':
          description: '404'
          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.

````