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

# List Open Orders

> List all open orders. <br /><br />**Caution:** The maximum number of orders returned is 5000. If a client has more than 5000 open orders, an error is returned prompting the user to use Websocket API, or FIX API to stream open orders.

Use the Prime SDK or CLI to test this endpoint by following the [quickstart](/prime/introduction/quickstart) guide and running with the following examples

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    OrdersService ordersService = PrimeServiceFactory.createOrdersService(client);

    ListOpenOrdersRequest request = new ListOpenOrdersRequest.Builder()
        .portfolioId("PORTFOLIO_ID_HERE")
        .build();

    ListOpenOrdersResponse response = ordersService.listOpenOrders(request);
    ```

    For more information, please visit the [Prime Java SDK](https://github.com/coinbase-samples/prime-sdk-java).
  </Tab>

  <Tab title=".NET">
    ```csharp wrap theme={null}
    var ordersService = new OrdersService(client);

    var request = new ListOpenOrdersRequest("PORTFOLIO_ID_HERE");

    var response = ordersService.ListOpenOrders(request);
    ```

    For more information, please visit the [Prime .NET SDK](https://github.com/coinbase-samples/prime-sdk-dotnet).
  </Tab>

  <Tab title="Go">
    ```go wrap theme={null}
    ordersService := orders.NewOrdersService(client)

    request := &orders.ListOpenOrdersRequest{
        PortfolioId: "PORTFOLIO_ID_HERE",
    }

    response, err := ordersService.ListOpenOrders(context.Background(), request)
    ```

    For more information, please visit the [Prime Go SDK](https://github.com/coinbase-samples/prime-sdk-go).
  </Tab>

  <Tab title="Python">
    ```python wrap theme={null}
    prime_client = PrimeClient(credentials)

    request = ListOpenOrdersRequest(
        portfolio_id="PORTFOLIO_ID_HERE",
    )

    response = prime_client.list_open_orders(request)
    ```

    For more information, please visit the [Prime Python SDK](https://github.com/coinbase-samples/prime-sdk-py).
  </Tab>

  <Tab title="CLI">
    ```bash wrap theme={null}
    primectl list-open-orders --help
    ```

    For more information, please visit the [Prime CLI](https://github.com/coinbase-samples/prime-cli).
  </Tab>

  <Tab title="TS/JS">
    ```typescript wrap theme={null}
    const ordersService = new OrdersService(client);

    ordersService.listOpenOrders({
        portfolioId: 'PORTFOLIO_ID_HERE'
    }).then(async (response) => {
        console.log('Orders: ', response);
    })
    ```

    For more information, please visit the [Prime TS SDK](https://github.com/coinbase-samples/prime-sdk-ts).
  </Tab>
</Tabs>


## OpenAPI

````yaml GET /v1/portfolios/{portfolio_id}/open_orders
openapi: 3.0.1
info:
  title: REST API
  description: >-
    The Coinbase Prime REST API provides programmatic access to trading,
    custody, staking, market data, and account management functionality.
  version: '0.1'
servers:
  - url: https://api.prime.coinbase.com/
security: []
tags:
  - name: PrimeRESTAPI
paths:
  /v1/portfolios/{portfolio_id}/open_orders:
    get:
      tags:
        - Orders
      summary: List Open Orders
      description: >-
        List all open orders. <br /><br />**Caution:** The maximum number of
        orders returned is 5000. If a client has more than 5000 open orders, an
        error is returned prompting the user to use Websocket API, or FIX API to
        stream open orders.
      operationId: PrimeRESTAPI_GetOpenOrders
      parameters:
        - name: portfolio_id
          in: path
          description: Portfolio ID
          required: true
          schema:
            type: string
        - name: product_ids
          in: query
          description: List of products by which to filter the response
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: order_type
          in: query
          description: |-
            An order type by which to filter the response

             - UNKNOWN_ORDER_TYPE: nil value
             - MARKET: A [market order](https://en.wikipedia.org/wiki/Order_(exchange)#Market_order)
             - LIMIT: A [limit order](https://en.wikipedia.org/wiki/Order_(exchange)#Limit_order)
             - TWAP: A [time-weighted average price order](https://en.wikipedia.org/wiki/Time-weighted_average_price)
             - BLOCK: A [block trade](https://en.wikipedia.org/wiki/Block_trade)
             - VWAP: A [volume-weighted average price order](https://en.wikipedia.org/wiki/Volume-weighted_average_price)
             - STOP_LIMIT: A [conditional order combined of stop order and limit order](https://en.wikipedia.org/wiki/Order_(exchange)#Stop-limit_order)
             - RFQ: A [request for quote](https://en.wikipedia.org/wiki/Request_for_quote)
             - PEG: A pegged order that dynamically adjust based on market conditions while maintaining execution discretion and avoiding adverse selection
          schema:
            type: string
            enum:
              - MARKET
              - LIMIT
              - TWAP
              - BLOCK
              - VWAP
              - STOP_LIMIT
              - RFQ
              - PEG
        - name: cursor
          in: query
          description: >-
            **Deprecated** - this endpoint always returns one page with at most
            1000 orders. If you need to retrieve more than 1000 orders, use the
            WebSocket API instead.
          schema:
            type: string
        - name: limit
          in: query
          description: >-
            **Deprecated** - the limit for this endpoint is always 1000. If you
            need to retrieve more than 1000 orders, use the WebSocket API
            instead.
          schema:
            type: integer
            format: int32
        - name: sort_direction
          in: query
          description: Sorting order
          schema:
            type: string
            default: DESC
            enum:
              - DESC
              - ASC
        - name: start_date
          in: query
          description: A start date for the orders to be queried from
          schema:
            type: string
            format: date-time
        - name: order_side
          in: query
          description: |-
            An order side to filter on.

             - UNKNOWN_ORDER_SIDE: nil value
             - BUY: Buy order
             - SELL: Sell order
          schema:
            type: string
            enum:
              - BUY
              - SELL
        - name: end_date
          in: query
          description: An end date for the orders to be queried from
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/coinbase.public_rest_api.GetOpenOrdersResponse
components:
  schemas:
    coinbase.public_rest_api.GetOpenOrdersResponse:
      type: object
      properties:
        orders:
          title: Requested orders
          type: array
          items:
            $ref: '#/components/schemas/coinbase.public_rest_api.Order'
        pagination:
          $ref: '#/components/schemas/coinbase.public_rest_api.PaginatedResponse'
    coinbase.public_rest_api.Order:
      type: object
      properties:
        id:
          type: string
          description: The unique order ID generated by Coinbase
          example: 82c879c1-84e1-44ed-a8c2-1ac239cf09ad
        user_id:
          type: string
          description: The ID of the user that created the order
          example: '42'
        portfolio_id:
          type: string
          description: The ID of the portfolio that owns the order
          example: 3e1fe27e-26fe-46d8-b118-c752a2ae6b47
        product_id:
          type: string
          description: The ID of the product being traded by the order
          example: BTC-USD
        side:
          $ref: '#/components/schemas/coinbase.public_rest_api.OrderSide'
        client_order_id:
          type: string
          description: >-
            A client-generated order ID used for reference purposes (note: order
            will be rejected if this ID is not unique among all currently active
            orders)
          example: f69a20b1-4ac4-420e-90b5-814a12565bfa
        type:
          $ref: '#/components/schemas/coinbase.public_rest_api.OrderType'
        base_quantity:
          type: string
          description: >-
            Order size in base asset units (either `base_quantity` or
            `quote_value` is required)
          example: '50'
        quote_value:
          type: string
          description: >-
            Order size in quote asset units, i.e. the amount the user wants to
            spend (when buying) or receive (when selling); the quantity in base
            units will be determined based on the market liquidity and indicated
            `quote_value`. Either `base_quantity` or `quote_value` is required
          example: '100'
        limit_price:
          type: string
          description: >-
            The limit price (required for TWAP, VWAP, LIMIT and STOP_LIMIT
            orders)
          example: '50.12'
        start_time:
          type: string
          description: >-
            The start time of the order in UTC (only applies to TWAP, VWAP
            orders.)
          format: date-time
          example: '2021-05-31T09:59:59.000Z'
        expiry_time:
          type: string
          description: >-
            The expiry time of the order in UTC (applies to TWAP, VWAP, LIMIT,
            and STOP_LIMIT orders with `time_in_force` set to `GTD`)
          format: date-time
          example: '2021-05-31T10:59:59.000Z'
        status:
          $ref: '#/components/schemas/coinbase.public_rest_api.OrderStatus'
        time_in_force:
          $ref: '#/components/schemas/coinbase.public_rest_api.TimeInForceType'
        created_at:
          type: string
          description: The order creation time as a UTC timestamp
          format: date-time
          example: '2021-05-31T10:59:59.000Z'
        filled_quantity:
          type: string
          description: Size filled (in base asset units)
          example: '100'
        filled_value:
          type: string
          description: Market value filled (in quote asset units)
          example: '100'
        average_filled_price:
          type: string
          description: Indicates the average `filled_price`
          example: '50.19'
        commission:
          type: string
          description: >-
            Total commission paid on this order (in quote asset units) -- only
            applicable for partially- or fully-filled orders
          example: '4.99'
        exchange_fee:
          type: string
          description: >-
            Fee charged by the exchange for Cost Plus commission configurations.
            Exchange fee will be 0 for All In commission configurations.
          example: '2.50'
        historical_pov:
          type: string
          description: historical pov for the order
          example: '2.50'
        stop_price:
          type: string
          description: >-
            Specifies the stop price at which the order activates. The order is
            activated if the last trade price on Coinbase Exchange crosses the
            stop price specified on the order
          example: '50.12'
        net_average_filled_price:
          type: string
          description: Indicates the average `filled_price` net of commissions and fees
          example: '57.68'
        user_context:
          type: string
          description: >-
            Indicates a user friendly message for regarding various aspects of
            the order such as cancellation or rejection reasons
          example: User initiated cancellation
        client_product_id:
          type: string
          description: The client product ID of the fill indictating the settlment currency
          example: BTC-USDC
        post_only:
          title: Post-only flag - indicates whether the order was placed as post-only
          type: boolean
          description: Post-only flag - indicates whether the order was placed as post-only
          example: true
        order_edit_history:
          title: 'deprecated: use edit_history instead'
          type: array
          description: 'The history of order edits (deprecated: use edit_history instead)'
          items:
            $ref: >-
              #/components/schemas/coinbase.brokerage.proxy.events.materialized.api.LimitOrderEdit
        is_raise_exact:
          type: boolean
          description: >-
            Indicates if this was a raise exact order (size inclusive of fees
            for sell orders in quote)
          example: true
        display_size:
          type: string
          description: Display size for the order
          example: '10.5'
        edit_history:
          title: Order Edit History
          type: array
          description: The history of order edits
          example:
            - price: '100'
              base_quantity: '1'
              quote_value: '100'
              display_base_size: '1.00'
              display_quote_size: '1.00'
              stop_price: '120'
              expiry_time: '2021-05-31T10:59:59.000Z'
              accept_time: '2021-06-20T10:59:59.000Z'
              client_order_id: '123'
          items:
            $ref: '#/components/schemas/coinbase.public_rest_api.OrderEdit'
        display_quote_size:
          type: string
          description: >-
            The maximum order size that will show up on venue order books (in
            quote currency).
          example: '100.50'
        display_base_size:
          type: string
          description: >-
            The maximum order size that will show up on venue order books (in
            base currency).
          example: '10.5'
        peg_offset_type:
          title: PEG order specific fields
          type: string
          description: >-
            The peg offset type for PEG orders (PRICE, BASIS_POINTS, or
            CUMULATIVE_DEPTH_IN_BASE_UNITS)
          example: PEG_OFFSET_TYPE_PRICE
        offset:
          type: string
          description: The offset value for PEG orders
          example: '100'
        wig_level:
          type: string
          description: >-
            The wig (would if good) level for PEG orders - best price opposite
            to limit_price
          example: '100000'
        product_type:
          $ref: '#/components/schemas/coinbase.public_rest_api.ProductType'
        commission_detail_total:
          $ref: '#/components/schemas/coinbase.public_rest_api.CommissionDetailTotal'
    coinbase.public_rest_api.PaginatedResponse:
      required:
        - has_next
        - next_cursor
        - sort_direction
      type: object
      properties:
        next_cursor:
          type: string
          description: Cursor to navigate to next page
        sort_direction:
          $ref: '#/components/schemas/coinbase.public_rest_api.SortDirection'
        has_next:
          type: boolean
          description: >-
            A boolean value indicating whether there are more items to paginate
            through
    coinbase.public_rest_api.OrderSide:
      title: Order side
      type: string
      description: |-
        - UNKNOWN_ORDER_SIDE: nil value
         - BUY: Buy order
         - SELL: Sell order
      enum:
        - BUY
        - SELL
    coinbase.public_rest_api.OrderType:
      title: Strategy (execution algorithm)
      type: string
      description: |-
        - UNKNOWN_ORDER_TYPE: nil value
         - MARKET: A [market order](https://en.wikipedia.org/wiki/Order_(exchange)#Market_order)
         - LIMIT: A [limit order](https://en.wikipedia.org/wiki/Order_(exchange)#Limit_order)
         - TWAP: A [time-weighted average price order](https://en.wikipedia.org/wiki/Time-weighted_average_price)
         - BLOCK: A [block trade](https://en.wikipedia.org/wiki/Block_trade)
         - VWAP: A [volume-weighted average price order](https://en.wikipedia.org/wiki/Volume-weighted_average_price)
         - STOP_LIMIT: A [conditional order combined of stop order and limit order](https://en.wikipedia.org/wiki/Order_(exchange)#Stop-limit_order)
         - RFQ: A [request for quote](https://en.wikipedia.org/wiki/Request_for_quote)
         - PEG: A pegged order that dynamically adjust based on market conditions while maintaining execution discretion and avoiding adverse selection
      enum:
        - MARKET
        - LIMIT
        - TWAP
        - BLOCK
        - VWAP
        - STOP_LIMIT
        - RFQ
        - PEG
    coinbase.public_rest_api.OrderStatus:
      title: Indicates the order status
      type: string
      description: |-
        - UNKNOWN_ORDER_STATUS: nil value
         - OPEN: The order is open but unfilled
         - FILLED: The order was filled
         - CANCELLED: The order was cancelled
         - EXPIRED: The order has expired
         - FAILED: Order submission failed
         - PENDING: The order has been sent but is not yet confirmed
      enum:
        - OPEN
        - FILLED
        - CANCELLED
        - EXPIRED
        - FAILED
        - PENDING
    coinbase.public_rest_api.TimeInForceType:
      title: Indicates the order time validity
      type: string
      description: |-
        - UNKNOWN_TIME_IN_FORCE: nil value
         - GOOD_UNTIL_DATE_TIME: Expires at a certain date/time
         - GOOD_UNTIL_CANCELLED: Order stays on the books until cancelled
         - IMMEDIATE_OR_CANCEL: Order is executed immediately at submission or is cancelled
         - FILL_OR_KILL: Order is executed immediately and fully at submission or is cancelled
      enum:
        - GOOD_UNTIL_DATE_TIME
        - GOOD_UNTIL_CANCELLED
        - IMMEDIATE_OR_CANCEL
        - FILL_OR_KILL
    coinbase.brokerage.proxy.events.materialized.api.LimitOrderEdit:
      title: LimitOrderEdit represents an order edit that is accepted
      type: object
      properties:
        price:
          title: New price for the edited order
          type: string
        size:
          title: New size for the edited order
          type: string
        display_size:
          title: New display size for the edited order
          type: string
        stop_price:
          title: New stop price for the edited order
          type: string
        stop_limit_price:
          title: New stop limit price for the edited order
          type: string
        end_time:
          title: New end time for the edited order
          type: string
          format: date-time
        accept_time:
          title: Time when the edit was accepted
          type: string
          format: date-time
        client_order_id:
          title: Client order id of the order being replaced
          type: string
    coinbase.public_rest_api.OrderEdit:
      type: object
      properties:
        price:
          title: New price for the edited order
          type: string
        base_quantity:
          title: >-
            New base quantity for the edited order, populated if order is in
            base size
          type: string
        quote_value:
          title: >-
            New quote value for the edited order, populated if order is in quote
            size
          type: string
        display_base_size:
          title: >-
            Display base size for the edited order, populated if order is in
            base size
          type: string
        display_quote_size:
          title: >-
            Display quote size for the edited order, populated if order is in
            quote size
          type: string
        stop_price:
          title: New stop price for the edited order
          type: string
        expiry_time:
          title: New expiry/end time for the edited order
          type: string
          format: date-time
        accept_time:
          title: Time when the edit was accepted
          type: string
          format: date-time
        client_order_id:
          title: >-
            The new client order identifier that the order adopted after the
            replacement was successfully accepted
          type: string
    coinbase.public_rest_api.ProductType:
      title: ProductType represents the general type of product
      type: string
      description: |-
        - UNKNOWN_PRODUCT_TYPE: Unknown product type
         - SPOT: Spot product
         - FUTURE: Future product
      enum:
        - SPOT
        - FUTURE
    coinbase.public_rest_api.CommissionDetailTotal:
      type: object
      properties:
        total_commission:
          title: |-
            Total commission amount charged for the order
            This is the sum of all commission charged on the order
          type: string
        client_commission:
          title: Client commission on the trade
          type: string
          description: CB fee
        venue_commission:
          title: Venue Commission
          type: string
          description: Exchange fees
        ces_commission:
          title: CES Commission
          type: string
        financing_commission:
          title: Financing Commission
          type: string
        regulatory_commission:
          title: Regulatory Commission
          type: string
          description: NFA fees
        clearing_commission:
          title: Clearing Commission
          type: string
          description: Clearing fees
    coinbase.public_rest_api.SortDirection:
      type: string
      default: DESC
      enum:
        - DESC
        - ASC

````