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

# Get order books

> Full books for a batch of markets, keyed by venue. A market that could not be read carries `status` and `error` rather than failing the batch, so check each entry. No Agg session needed.



## OpenAPI

````yaml /openapi/client-api.yaml get /clients/me/integrations/agg/orderbooks
openapi: 3.1.0
info:
  title: Portal Client API
  version: '3.0'
  description: >
    The Portal Client API provides endpoints for managing wallets, building
    transactions,

    and interacting with blockchain networks. All endpoints require
    authentication via a

    Client API Key or Client Session Token (CST) passed as a Bearer token.


    ## Base URL

    `https://api.portalhq.io/api/v3`


    ## Authentication

    Include your Client API Key or Client Session Token as a Bearer token in the

    `Authorization` header of every request.


    ## Chain ID Format

    Chain parameters use either friendly names (e.g. `ethereum`, `solana`) or
    CAIP-2 format

    (e.g. `eip155:1`, `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`). When using
    CAIP-2 format

    in URLs, ensure the colon is URI-encoded (`%3A`).


    ## Support requests

    Every response carries an `X-Trace-Id` header. Include it when you contact
    support about a

    request, so Portal can find that exact request in its logs.
servers:
  - url: https://api.portalhq.io/api/v3
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Clients
    description: Core client management endpoints
  - name: Wallet
    description: >-
      Read wallet state — balances, NFTs, transaction history, capabilities, and
      transaction details
  - name: Transactions
    description: Build, broadcast, and evaluate blockchain transactions
  - name: Funding
    description: Fund wallets with testnet tokens
  - name: Wallet Shares
    description: Manage signing and backup share pairs
  - name: Delegations
    description: Manage token approvals, revocations, and delegated transfers
  - name: Session Keys
    description: Manage EIP-7702 session keys for smart accounts
  - name: 0x
    description: Token swap endpoints powered by the 0x protocol
  - name: Yield.xyz
    description: Yield opportunities and staking actions powered by Yield.xyz
  - name: Yield.xyz Borrow
    description: >-
      Supply collateral, borrow, repay and withdraw from lending markets (Aave
      V3, Morpho Blue, SparkLend, Lista) powered by Yield.xyz Borrow
  - name: Yield.xyz Perps
    description: >-
      Trade perpetual futures — open/close leveraged positions, manage
      stop-loss/take-profit, and fund/withdraw a trading account — powered by
      Yield.xyz Perps
  - name: Agg
    description: >-
      Prediction markets across venues (Polymarket, Kalshi and more) through one
      Agg account per client — powered by Agg
  - name: Li.Fi
    description: Cross-chain swaps and bridging powered by Li.Fi
  - name: CCTP
    description: >-
      Crosschain USDC transfers powered by Circle's Cross-Chain Transfer
      Protocol (CCTP)
  - name: Blockaid
    description: Transaction and address security scanning powered by Blockaid
  - name: Hypernative
    description: >-
      Transaction, address, token, and NFT security scanning powered by
      Hypernative
  - name: Noah
    description: KYC onboarding, payins, and payouts powered by Noah
  - name: Meld
    description: Buy and sell crypto with fiat through aggregated providers powered by Meld
  - name: Due
    description: Payins, payouts, virtual accounts, and FX powered by Due
  - name: EIP-7702
    description: EIP-7702 account type detection and authorization management
  - name: Deprecated
    description: >-
      Legacy endpoints scheduled for removal. Use the newer equivalents listed
      in each endpoint's description.
paths:
  /clients/me/integrations/agg/orderbooks:
    get:
      tags:
        - Agg
      summary: Get order books
      description: >-
        Full books for a batch of markets, keyed by venue. A market that could
        not be read carries `status` and `error` rather than failing the batch,
        so check each entry. No Agg session needed.
      operationId: getAggOrderbooks
      parameters:
        - name: venueMarketIds
          in: query
          required: true
          description: Comma-separated market ids.
          schema:
            type: string
        - name: depth
          in: query
          required: false
          description: Levels per side, up to 100.
          schema:
            type: integer
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/AggOrderbooks'
        '400':
          description: >-
            Invalid request, or Agg rejected it. Agg error codes are surfaced as
            `details.code`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Agg rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Agg returned a response that does not match the schema Portal
            expects (`id: INTEGRATION_RESPONSE_SCHEMA_DRIFT`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationSchemaDriftErrorResponse'
        '503':
          description: Agg is unreachable or returned an upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AggOrderbooks:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              venueMarketId:
                type: string
              status:
                type: string
                description: '`ok`, or why the book is missing, e.g. `market_resolved`.'
              error:
                anyOf:
                  - type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      retryable:
                        type: boolean
                    required:
                      - code
                      - message
                      - retryable
                    additionalProperties: false
                  - type: 'null'
              requestedMarket:
                anyOf:
                  - type: object
                    properties:
                      venueMarketId:
                        type: string
                      venue:
                        type: string
                      marketStatus:
                        type: string
                      tickSize:
                        anyOf:
                          - type: number
                          - type: 'null'
                      sizeStepRaw:
                        type: string
                      minSizeRaw:
                        type: string
                      endDate:
                        anyOf:
                          - type: string
                          - type: 'null'
                      resolutionDate:
                        anyOf:
                          - type: string
                          - type: 'null'
                    required:
                      - venueMarketId
                      - venue
                      - marketStatus
                      - tickSize
                      - endDate
                      - resolutionDate
                    additionalProperties: false
                  - type: 'null'
              venueOrderbooks:
                type: object
                propertyNames:
                  type: string
                additionalProperties:
                  $ref: '#/components/schemas/AggVenueOrderbook'
              matchedMarkets:
                type: array
                items:
                  type: object
                  properties:
                    venue:
                      type: string
                    venueMarketId:
                      type: string
                    marketStatus:
                      type: string
                    tickSize:
                      anyOf:
                        - type: number
                        - type: 'null'
                    sizeStepRaw:
                      type: string
                    minSizeRaw:
                      type: string
                    hasOrderbook:
                      type: boolean
                    deployerVenue:
                      anyOf:
                        - type: string
                        - type: 'null'
                  required:
                    - venue
                    - venueMarketId
                    - marketStatus
                    - tickSize
                    - hasOrderbook
                  additionalProperties: false
            required:
              - venueMarketId
              - status
              - error
              - requestedMarket
              - venueOrderbooks
              - matchedMarkets
            additionalProperties: false
        meta:
          type: object
          properties:
            requestedCount:
              type: integer
            okCount:
              type: integer
            errorCount:
              type: integer
          required:
            - requestedCount
            - okCount
            - errorCount
          additionalProperties: false
      required:
        - data
        - meta
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
    IntegrationSchemaDriftErrorResponse:
      type: object
      description: >-
        Returned (HTTP 500) when a third-party response no longer matches the
        schema Portal proxies for it. The `id` is stable: SDKs should key off it
        and fail gracefully. Portal is alerted automatically and fixes the
        mapping server-side.
      required:
        - error
        - id
        - details
      properties:
        error:
          type: string
          example: >-
            yield-xyz-borrow returned a response for GET /v1/positions that does
            not match the expected schema
        id:
          type: string
          enum:
            - INTEGRATION_RESPONSE_SCHEMA_DRIFT
        details:
          type: object
          required:
            - integration
            - endpoint
            - issues
          properties:
            integration:
              type: string
              example: yield-xyz-borrow
            endpoint:
              type: string
              description: The upstream vendor endpoint whose response drifted.
              example: GET /v1/positions
            issues:
              type: array
              items:
                type: object
                required:
                  - path
                  - message
                  - code
                properties:
                  path:
                    type: string
                    description: Dotted path of the offending field in the vendor response.
                    example: supplyBalances.0.balanceUsd
                  message:
                    type: string
                    example: Expected string, received number
                  code:
                    type: string
                    example: invalid_type
    AggVenueOrderbook:
      type: object
      properties:
        venueMarketId:
          type: string
        tickSize:
          anyOf:
            - type: number
            - type: 'null'
        sizeStepRaw:
          type: string
        minSizeRaw:
          type: string
        orderbook:
          $ref: '#/components/schemas/AggOrderbook'
        tick:
          anyOf:
            - type: number
            - type: 'null'
        markSource:
          type: string
        deployerVenue:
          anyOf:
            - type: string
            - type: 'null'
        sideHealth:
          description: Which sides of the book are usable, e.g. `healthy`, `bid_only`.
          type: string
      required:
        - venueMarketId
        - tickSize
        - orderbook
      additionalProperties: false
    AggOrderbook:
      type: object
      properties:
        bids:
          type: array
          items:
            $ref: '#/components/schemas/AggOrderbookLevel'
        asks:
          type: array
          items:
            $ref: '#/components/schemas/AggOrderbookLevel'
        negRisk:
          type: boolean
      required:
        - bids
        - asks
      additionalProperties: false
    AggOrderbookLevel:
      type: object
      properties:
        price:
          type: number
        size:
          type: number
      required:
        - price
        - size
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Client API Key or Client Session Token (CST). Pass as a Bearer token in
        the

        Authorization header.

````

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