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

# private/get_user_trades_by_order

> Retrieves all trades that were executed from a specific order. When an order is filled, it may result in multiple trades (partial fills). This method returns all trades associated with a given order ID.

Results can be sorted in ascending or descending order by trade ID. Use `historical` to retrieve historical trade data. This is useful for tracking how an order was filled and analyzing execution quality.

Main accounts may use the `subaccount_id` parameter to retrieve trade data for a specific subaccount (requires `mainaccount` scope).

**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)

**Scope:** `rat#view` or `wallet:transactions:read`

[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_order)





## OpenAPI

````yaml /api-reference/coinbase-deribit-app-api/adv-starbase-openapi.json get /private/get_user_trades_by_order
openapi: 3.0.0
info:
  description: Coinbase Retail Advanced Trade API for derivatives trading.
  title: Coinbase Retail Advanced Trade (Deribit) API
  version: 2.1.1
servers:
  - url: https://drb.coinbase.com/api/v2
security: []
tags:
  - description: Can only be used over websockets.
    name: WebSocket Only
  - description: Public methods can be used without authentication.
    name: Public
  - description: >-
      <p>Private methods require authentication. All requests must include a
      valid OAuth2 token.</p>

      <p>A token can be requested using the <a
      href="#public-auth">/public/auth</a> method.</p>

      <p>When using the websockets protocol, the token must be included as a
      parameter <code>access_token</code> in the message. When using REST (HTTP
      GET), the token may also be passed in the <code>Authorization</code>
      header.</p>
    name: Private
  - name: Authentication
  - name: Session Management
  - description: >-
      Subscription works as [notifications](#notifications), so users will
      automatically (after subscribing) receive messages from the server.
      Overview for each channel response format is described in
      [subscriptions](#subscriptions) section.
    name: Subscription Management
  - name: Account Management
  - name: Trading
  - name: Market Data
paths:
  /private/get_user_trades_by_order:
    get:
      tags:
        - Trading
        - Private
      description: >+
        Retrieves all trades that were executed from a specific order. When an
        order is filled, it may result in multiple trades (partial fills). This
        method returns all trades associated with a given order ID.


        Results can be sorted in ascending or descending order by trade ID. Use
        `historical` to retrieve historical trade data. This is useful for
        tracking how an order was filled and analyzing execution quality.


        Main accounts may use the `subaccount_id` parameter to retrieve trade
        data for a specific subaccount (requires `mainaccount` scope).


        **📖 Related Article:** [Accessing Historical Trades and Orders Using
        API](https://docs.deribit.com/articles/accessing-historical-trades-orders)


        **Scope:** `rat#view` or `wallet:transactions:read`


        [Try in API
        console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_order)

      parameters:
        - description: The order id
          in: query
          name: order_id
          required: true
          schema:
            $ref: '#/components/schemas/order_id'
        - description: >-
            Direction of results sorting (`default` value means no sorting,
            results will be returned in order in which they left the database)
          in: query
          name: sorting
          required: false
          schema:
            $ref: '#/components/schemas/sorting'
        - description: >
            Determines whether historical trade and order records should be
            retrieved.


            - `false` (default): Returns recent records: orders for 30 min,
            trades for 24h.

            - `true`: Fetches historical records, available after a short delay
            due to indexing. Recent data is not included.


            **📖 Related Article:** [Accessing Historical Trades and Orders
            Using
            API](https://docs.deribit.com/articles/accessing-historical-trades-orders)
          in: query
          name: historical
          required: false
          schema:
            type: boolean
        - description: Id of a subaccount
          in: query
          name: subaccount_id
          required: false
          schema:
            example: 9
            type: integer
      requestBody:
        content:
          application/json:
            examples:
              request:
                description: JSON-RPC Request Example
                value:
                  id: 3466
                  jsonrpc: '2.0'
                  method: private/get_user_trades_by_order
                  params:
                    order_id: ETH-584830574
        description: JSON-RPC request body
      responses:
        '200':
          $ref: '#/components/responses/PrivateGetUserTradesByOrderResponse'
components:
  schemas:
    order_id:
      description: Unique order identifier
      example: ETH-100234
      type: string
    sorting:
      enum:
        - asc
        - desc
        - default
      type: string
    PrivateGetUserTradesByOrderResponse:
      properties:
        id:
          description: The id that was sent in the request
          type: integer
        jsonrpc:
          description: The JSON-RPC version (2.0)
          enum:
            - '2.0'
          type: string
      required:
        - jsonrpc
      type: object
  responses:
    PrivateGetUserTradesByOrderResponse:
      content:
        application/json:
          examples:
            response:
              description: Response example
              value:
                id: 3466
                jsonrpc: '2.0'
                result:
                  - amount: 100
                    direction: buy
                    fee: 0.00036801
                    fee_currency: ETH
                    index_price: 203.89
                    instrument_name: ETH-PERPETUAL
                    liquidity: T
                    mark_price: 203.78
                    matching_id: null
                    order_id: ETH-584830574
                    order_type: market
                    post_only: false
                    price: 203.8
                    reduce_only: false
                    state: filled
                    tick_direction: 3
                    timestamp: 1590480712800
                    trade_id: ETH-2696068
                    trade_seq: 1966042
          schema:
            $ref: '#/components/schemas/PrivateGetUserTradesByOrderResponse'
      description: Success response

````