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

# List orders

> Orders placed through the API on this key’s trading account, newest first. Each order names its `market_id`, `title` and `outcome`; the title and outcome are null for a market whose fixture started more than 7 days ago. Filter by status, venue, market, text in the market title or `client_order_id`, and pass `next_cursor` back as `cursor` for the next page.



## OpenAPI

````yaml api-reference/openapi.json GET /orders
openapi: 3.0.0
info:
  title: Lean API
  version: 0.1.0
  description: >-
    Programmatic access to Lean: canonical sports markets, quotes, orders,
    positions and balances.
servers:
  - url: '{baseUrl}/v1'
    description: Lean API
    variables:
      baseUrl:
        default: https://api.lean.xyz
        description: >-
          The Lean API base URL, without /v1. Same value as LEAN_API_URL in the
          guides.
security:
  - apiKey: []
paths:
  /orders:
    get:
      tags:
        - Orders
      summary: List orders
      description: >-
        Orders placed through the API on this key’s trading account, newest
        first. Each order names its `market_id`, `title` and `outcome`; the
        title and outcome are null for a market whose fixture started more than
        7 days ago. Filter by status, venue, market, text in the market title or
        `client_order_id`, and pass `next_cursor` back as `cursor` for the next
        page.
      operationId: listOrders
      parameters:
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
          required: false
          name: limit
          in: query
          example: 50
        - schema:
            type: string
            minLength: 1
            maxLength: 512
          required: false
          name: cursor
          in: query
        - schema:
            type: string
            pattern: ^[A-Za-z0-9_-]{1,64}$
            description: >-
              Only orders placed with this client_order_id by any key on this
              trading account. It is unique per key, so orders from different
              keys can share one.
            example: bot-0001
          required: false
          description: >-
            Only orders placed with this client_order_id by any key on this
            trading account. It is unique per key, so orders from different keys
            can share one.
          name: client_order_id
          in: query
        - schema:
            type: string
            enum:
              - pending
              - open
              - partially_filled
              - filled
              - canceled
              - rejected
              - expired
              - unconfirmed
              - needs_attention
              - cancel_requested
            description: Only orders in this status.
          required: false
          description: Only orders in this status.
          name: status
          in: query
        - schema:
            type: string
            enum:
              - kalshi
              - polymarket
              - polymarket_us
              - hyperliquid
            description: >-
              Only orders on this venue: a venue order there, or a routed order
              not yet placed that trades there.
          required: false
          description: >-
            Only orders on this venue: a venue order there, or a routed order
            not yet placed that trades there.
          name: venue
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 512
            description: >-
              Only orders on this market. A market id from GET /markets, or a
              venue symbol that names one market: a Polymarket token id, a
              Hyperliquid book coin (`#…`, written `%23…` in a path), or a leg
              `ticker` (`pm:…`, `hl:…`, `pmus:…` or a Kalshi market ticker) that
              lists only this outcome. A symbol that names more than one market,
              such as a Polymarket condition id, is refused with 400; use the
              token id or the market id instead.
          required: false
          description: >-
            Only orders on this market. A market id from GET /markets, or a
            venue symbol that names one market: a Polymarket token id, a
            Hyperliquid book coin (`#…`, written `%23…` in a path), or a leg
            `ticker` (`pm:…`, `hl:…`, `pmus:…` or a Kalshi market ticker) that
            lists only this outcome. A symbol that names more than one market,
            such as a Polymarket condition id, is refused with 400; use the
            token id or the market id instead.
          name: market_id
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 100
            description: >-
              Text, in any letter case, found in the title or outcome of the
              market the order trades.
          required: false
          description: >-
            Text, in any letter case, found in the title or outcome of the
            market the order trades.
          name: search
          in: query
        - schema:
            type: string
            format: date-time
            description: Only orders placed at or after this time.
          required: false
          description: Only orders placed at or after this time.
          name: created_after
          in: query
        - schema:
            type: string
            format: date-time
            description: Only orders placed before this time.
          required: false
          description: Only orders placed before this time.
          name: created_before
          in: query
      responses:
        '200':
          description: API orders on this key's trading account, newest first
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          orders:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                client_order_id:
                                  type: string
                                  minLength: 1
                                market_id:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    The market id from GET /markets, however the
                                    request named the market.
                                title:
                                  type: string
                                  nullable: true
                                  minLength: 1
                                outcome:
                                  type: string
                                  nullable: true
                                  minLength: 1
                                venue:
                                  type: string
                                  nullable: true
                                  enum:
                                    - kalshi
                                    - polymarket
                                    - polymarket_us
                                    - hyperliquid
                                ticker:
                                  type: string
                                  nullable: true
                                  minLength: 1
                                side:
                                  type: string
                                  nullable: true
                                  enum:
                                    - 'yes'
                                    - 'no'
                                action:
                                  type: string
                                  enum:
                                    - buy
                                    - sell
                                type:
                                  type: string
                                  enum:
                                    - limit
                                    - market
                                time_in_force:
                                  type: string
                                  enum:
                                    - gtc
                                    - ioc
                                    - fok
                                    - gtd
                                expires_at:
                                  type: string
                                  nullable: true
                                  format: date-time
                                quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                filled_quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                remaining_quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                  description: >-
                                    Shares still working on the venues: the
                                    unfilled size of each live venue order. Zero
                                    once the order is final, since a canceled,
                                    expired or rejected remainder no longer
                                    works.
                                limit_price:
                                  type: string
                                avg_fill_price:
                                  type: string
                                  nullable: true
                                  description: >-
                                    Average price per share filled,
                                    size-weighted across the venue orders that
                                    filled, excluding fees. Null until every
                                    filled venue order has a price.
                                notional_usd:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                filled_notional_usd:
                                  type: string
                                  nullable: true
                                  pattern: ^\d+(?:\.\d+)?$
                                status:
                                  type: string
                                  enum:
                                    - pending
                                    - open
                                    - partially_filled
                                    - filled
                                    - canceled
                                    - rejected
                                    - expired
                                    - unconfirmed
                                    - needs_attention
                                    - cancel_requested
                                venue_status:
                                  type: string
                                  nullable: true
                                venue_order_id:
                                  type: string
                                  nullable: true
                                status_reason:
                                  type: object
                                  nullable: true
                                  properties:
                                    code:
                                      type: string
                                      minLength: 1
                                    message:
                                      type: string
                                      minLength: 1
                                  required:
                                    - code
                                    - message
                                legs:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      venue:
                                        type: string
                                        enum:
                                          - kalshi
                                          - polymarket
                                          - polymarket_us
                                          - hyperliquid
                                      ticker:
                                        type: string
                                        minLength: 1
                                      side:
                                        type: string
                                        enum:
                                          - 'yes'
                                          - 'no'
                                      quantity:
                                        type: string
                                        pattern: ^\d+(?:\.\d+)?$
                                      filled_quantity:
                                        type: string
                                        pattern: ^\d+(?:\.\d+)?$
                                      limit_price:
                                        type: string
                                      avg_fill_price:
                                        type: string
                                        nullable: true
                                      status:
                                        type: string
                                        enum:
                                          - pending
                                          - open
                                          - partially_filled
                                          - filled
                                          - canceled
                                          - rejected
                                          - expired
                                          - unconfirmed
                                          - needs_attention
                                          - cancel_requested
                                      venue_status:
                                        type: string
                                        nullable: true
                                      venue_order_id:
                                        type: string
                                        nullable: true
                                      cancel_requested_at:
                                        type: string
                                        nullable: true
                                        format: date-time
                                      status_reason:
                                        type: object
                                        nullable: true
                                        properties:
                                          code:
                                            type: string
                                            minLength: 1
                                          message:
                                            type: string
                                            minLength: 1
                                        required:
                                          - code
                                          - message
                                    required:
                                      - venue
                                      - ticker
                                      - side
                                      - quantity
                                      - filled_quantity
                                      - limit_price
                                      - avg_fill_price
                                      - status
                                      - venue_status
                                      - venue_order_id
                                      - cancel_requested_at
                                      - status_reason
                                post_only:
                                  type: boolean
                                replaces_order_id:
                                  type: string
                                  nullable: true
                                  format: uuid
                                replaced_by_order_id:
                                  type: string
                                  nullable: true
                                  format: uuid
                                created_at:
                                  type: string
                                  format: date-time
                                updated_at:
                                  type: string
                                  format: date-time
                                livemode:
                                  type: boolean
                              required:
                                - id
                                - client_order_id
                                - market_id
                                - title
                                - outcome
                                - venue
                                - ticker
                                - side
                                - action
                                - type
                                - time_in_force
                                - expires_at
                                - quantity
                                - filled_quantity
                                - remaining_quantity
                                - limit_price
                                - avg_fill_price
                                - notional_usd
                                - filled_notional_usd
                                - status
                                - venue_status
                                - venue_order_id
                                - status_reason
                                - legs
                                - post_only
                                - replaces_order_id
                                - replaced_by_order_id
                                - created_at
                                - updated_at
                                - livemode
                          next_cursor:
                            type: string
                            nullable: true
                            minLength: 1
                            maxLength: 512
                          livemode:
                            type: boolean
                        required:
                          - orders
                          - next_cursor
                          - livemode
                      meta:
                        type: object
                        properties:
                          timestampMs:
                            type: integer
                            minimum: 0
                          requestId:
                            type: string
                            minLength: 1
                          traceId:
                            type: string
                            minLength: 1
                          cachedAtMs:
                            type: integer
                            minimum: 0
                          source:
                            type: string
                            enum:
                              - cache
                              - database
                              - clickhouse
                              - upstream
                              - fallback
                              - internal
                        required:
                          - timestampMs
                          - requestId
                    required:
                      - success
                      - data
                      - meta
                  - $ref: '#/components/schemas/ApiError'
              examples:
                Orders:
                  summary: Newest first
                  value:
                    success: true
                    data:
                      orders:
                        - id: 8a1e5c07-4b3f-4d62-9f18-2c7e0a95d4b1
                          client_order_id: bot-2026-10-29-0002
                          market_id: >-
                            mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                          venue: hyperliquid
                          ticker: <venue ticker>
                          side: 'yes'
                          action: buy
                          type: limit
                          time_in_force: gtc
                          expires_at: null
                          quantity: '10'
                          filled_quantity: '0'
                          remaining_quantity: '10'
                          limit_price: '0.45'
                          avg_fill_price: null
                          notional_usd: '4.5'
                          filled_notional_usd: '0'
                          status: open
                          venue_status: open
                          venue_order_id: '91234567388'
                          status_reason: null
                          post_only: false
                          replaces_order_id: null
                          replaced_by_order_id: null
                          legs:
                            - venue: hyperliquid
                              ticker: <venue ticker>
                              side: 'yes'
                              quantity: '10'
                              filled_quantity: '0'
                              limit_price: '0.45'
                              avg_fill_price: null
                              status: open
                              venue_status: open
                              venue_order_id: '91234567388'
                              cancel_requested_at: null
                              status_reason: null
                          created_at: '2026-10-11T18:04:40.902Z'
                          updated_at: '2026-10-11T18:04:41.317Z'
                          livemode: true
                        - id: 3f6c2a8e-91d4-4b7a-8c25-0e4d7b19a6f3
                          client_order_id: bot-2026-10-29-0001
                          market_id: >-
                            mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                          venue: hyperliquid
                          ticker: <venue ticker>
                          side: 'yes'
                          action: buy
                          type: limit
                          time_in_force: ioc
                          expires_at: null
                          quantity: '5'
                          filled_quantity: '5'
                          remaining_quantity: '0'
                          limit_price: '0.50'
                          avg_fill_price: '0.47'
                          notional_usd: '2.5'
                          filled_notional_usd: '2.35'
                          status: filled
                          venue_status: filled
                          venue_order_id: '91234567012'
                          status_reason: null
                          post_only: false
                          replaces_order_id: null
                          replaced_by_order_id: null
                          legs:
                            - venue: hyperliquid
                              ticker: <venue ticker>
                              side: 'yes'
                              quantity: '5'
                              filled_quantity: '5'
                              limit_price: '0.50'
                              avg_fill_price: '0.47'
                              status: filled
                              venue_status: filled
                              venue_order_id: '91234567012'
                              cancel_requested_at: null
                              status_reason: null
                          created_at: '2026-10-11T18:00:02.114Z'
                          updated_at: '2026-10-11T18:00:02.587Z'
                          livemode: true
                        - id: 8a1e5c07-4b3f-4d62-9f18-2c7e0a95d4b1
                          client_order_id: bot-2026-10-29-0002
                          market_id: >-
                            mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                          venue: hyperliquid
                          ticker: <venue ticker>
                          side: 'yes'
                          action: buy
                          type: limit
                          time_in_force: gtc
                          expires_at: null
                          quantity: '10'
                          filled_quantity: '0'
                          remaining_quantity: '10'
                          limit_price: '0.45'
                          avg_fill_price: null
                          notional_usd: '4.5'
                          filled_notional_usd: '0'
                          status: open
                          venue_status: open
                          venue_order_id: '91234567388'
                          status_reason: null
                          post_only: false
                          replaces_order_id: null
                          replaced_by_order_id: null
                          legs:
                            - venue: hyperliquid
                              ticker: <venue ticker>
                              side: 'yes'
                              quantity: '10'
                              filled_quantity: '0'
                              limit_price: '0.45'
                              avg_fill_price: null
                              status: open
                              venue_status: open
                              venue_order_id: '91234567388'
                              cancel_requested_at: null
                              status_reason: null
                          created_at: '2026-10-11T18:04:40.902Z'
                          updated_at: '2026-10-11T18:04:41.317Z'
                          livemode: true
                        - id: 3f6c2a8e-91d4-4b7a-8c25-0e4d7b19a6f3
                          client_order_id: bot-2026-10-29-0001
                          market_id: >-
                            mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                          venue: hyperliquid
                          ticker: <venue ticker>
                          side: 'yes'
                          action: buy
                          type: limit
                          time_in_force: ioc
                          expires_at: null
                          quantity: '5'
                          filled_quantity: '5'
                          remaining_quantity: '0'
                          limit_price: '0.50'
                          avg_fill_price: '0.47'
                          notional_usd: '2.5'
                          filled_notional_usd: '2.35'
                          status: filled
                          venue_status: filled
                          venue_order_id: '91234567012'
                          status_reason: null
                          post_only: false
                          replaces_order_id: null
                          replaced_by_order_id: null
                          legs:
                            - venue: hyperliquid
                              ticker: <venue ticker>
                              side: 'yes'
                              quantity: '5'
                              filled_quantity: '5'
                              limit_price: '0.50'
                              avg_fill_price: '0.47'
                              status: filled
                              venue_status: filled
                              venue_order_id: '91234567012'
                              cancel_requested_at: null
                              status_reason: null
                          created_at: '2026-10-11T18:00:02.114Z'
                          updated_at: '2026-10-11T18:00:02.587Z'
                          livemode: true
                      next_cursor: null
                      livemode: true
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
                Not recorded:
                  summary: No order with this client_order_id
                  value:
                    success: true
                    data:
                      orders: []
                      next_cursor: null
                      livemode: true
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
        '400':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                Bad cursor:
                  summary: cursor is not a next_cursor value
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid request
                      details:
                        - path: cursor
                          message: Invalid cursor
                        - path: cursor
                          message: Invalid cursor
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
        '401':
          description: Missing, invalid, expired or revoked API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                Unknown key:
                  summary: Unknown, expired or revoked key
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Invalid, expired or revoked API key
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
                Missing key:
                  summary: No Authorization header
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Missing API key
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
        '403':
          description: The key lacks the scope this route needs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                Missing scope:
                  summary: The key lacks the read scope
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: This API key lacks the read scope
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
        '429':
          description: API error
          headers:
            Retry-After:
              description: Seconds remaining in the upstream read cooldown, when available
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                Rate limited:
                  summary: Over 5 requests a second; wait for Retry-After
                  value:
                    success: false
                    error:
                      code: RATE_LIMITED
                      message: Too many requests for this API key
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
        '500':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                Internal error:
                  summary: Unexpected server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal error occurred.
                    meta:
                      timestampMs: 1791741600000
                      requestId: 7a4c0e5d-1b9f-4e26-8d73-c5f2a1b08e64
components:
  schemas:
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_ERROR
                - NOT_FOUND
                - UNAUTHORIZED
                - FORBIDDEN
                - CONFLICT
                - UPSTREAM_ERROR
                - RATE_LIMITED
                - INTERNAL_ERROR
                - FEATURE_DISABLED
                - CONDITIONAL_SELL_REJECTED
                - CONDITIONAL_SELL_ACTIVE
            message:
              type: string
              minLength: 1
            details:
              nullable: true
          required:
            - code
            - message
        meta:
          type: object
          properties:
            timestampMs:
              type: integer
              minimum: 0
            requestId:
              type: string
              minLength: 1
            traceId:
              type: string
              minLength: 1
            cachedAtMs:
              type: integer
              minimum: 0
            source:
              type: string
              enum:
                - cache
                - database
                - clickhouse
                - upstream
                - fallback
                - internal
          required:
            - timestampMs
            - requestId
      required:
        - success
        - error
        - meta
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A Lean API key, sent as `Authorization: Bearer <key>`. A test key
        (`lean_sk_test_...`) simulates orders and fills with no money; a live
        key (`lean_sk_live_...`) trades for real within the key's limits. Every
        successful response says which mode answered in `data.livemode`.

````

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