# Get Order by Order ID

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /account/orders/{order_id}:
    get:
      summary: Get Order by Order ID
      deprecated: false
      description: >-
        Get information about an existing order using the exchange generated
        order_id.


        Will only return orders from the last 30 days.
      tags:
        - One Trading Public REST API/Trading
      parameters:
        - name: order_id
          in: path
          description: The order ID to fetch order details for
          required: true
          example: 83c81e54-7384-47d4-09d1-57af45314fa1
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  order:
                    $ref: '#/components/schemas/Order'
                  trades:
                    type: array
                    items:
                      type: object
                      properties:
                        fee:
                          $ref: '#/components/schemas/Fee'
                        trade:
                          $ref: '#/components/schemas/Trade'
                      x-apidog-orders:
                        - fee
                        - trade
                      required:
                        - fee
                        - trade
                      x-apidog-ignore-properties: []
                x-apidog-orders:
                  - order
                  - trades
                required:
                  - order
                  - trades
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Success
        '400':
          description: ''
          content:
            application/json:
              schema:
                title: ''
                type: object
                properties:
                  error:
                    type: string
                    description: Reason for bad request
                x-apidog-orders:
                  - error
                required:
                  - error
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Bad Request
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                x-apidog-orders:
                  - error
                required:
                  - error
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Record Not Found
      security: []
      x-apidog-folder: One Trading Public REST API/Trading
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/349694/apis/api-3612093-run
components:
  schemas:
    Trade:
      type: object
      properties:
        account_id:
          type: string
          format: uuid
          description: Account ID the trade belongs to
        order_id:
          type: string
          format: uuid
          description: Unique identifier of the order the trade belongs to
        trade_id:
          type: string
          format: uuid
          description: Unique identifier of the trade
        time:
          type: string
          description: The time the trade was executed ((ISO 8601, milisecond precision)
          format: date-time
          deprecated: true
        time_nanos:
          type: string
          format: date-time
          description: The time the trade was executed ((ISO 8601, nanosecond precision)
        instrument_code:
          type: string
          description: The market identifier for the trade
        side:
          type: string
          enum:
            - BUY
            - SELL
          x-apidog-enum:
            - value: BUY
              name: ''
              description: ''
            - value: SELL
              name: ''
              description: ''
          description: BUY or SELL
        matched_as:
          type: string
          enum:
            - MAKER
            - TAKER
          x-apidog-enum:
            - value: MAKER
              name: ''
              description: ''
            - value: TAKER
              name: ''
              description: ''
          description: MAKER or TAKER
        amount:
          type: string
          description: The quantity that has been executed, expressed in the base currency.
          deprecated: true
        filled_amount:
          type: string
          description: The quantity that has been executed, expressed in the base currency.
        price:
          type: string
          description: The price at which the trade matched at
        sequence:
          type: string
          description: An incremental identifier for tracking the trade in the exchange
        position_id:
          type: string
          format: uuid
          description: >-
            The ID of the position associated with this trade. Included only for
            trades executed on perpetual markets.
        prev_position_id:
          type: string
          format: uuid
          description: >-
            If the trade causes a position flip (long to short or short to
            long), this field specifies the ID of the position closed by the
            trade. Present only for perpetual-market trades that result in a
            position flip.
        open_position_amount:
          type: string
          description: >-
            The post-execution open position amount. This field is included only
            for trades executed on perpetual markets.
      x-apidog-orders:
        - account_id
        - order_id
        - trade_id
        - time
        - time_nanos
        - instrument_code
        - side
        - matched_as
        - amount
        - filled_amount
        - price
        - sequence
        - position_id
        - prev_position_id
        - open_position_amount
      required:
        - account_id
        - order_id
        - trade_id
        - time
        - time_nanos
        - instrument_code
        - side
        - matched_as
        - amount
        - filled_amount
        - price
        - sequence
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Fee:
      type: object
      properties:
        fee_amount:
          type: string
          description: The amount paid in the fee currency
        fee_currency:
          type: string
          description: The currency the fee was paid in
      x-apidog-orders:
        - fee_amount
        - fee_currency
      required:
        - fee_amount
        - fee_currency
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Order:
      type: object
      properties:
        account_id:
          type: string
          format: uuid
          description: The account ID the order belongs to
        order_id:
          type: string
          format: uuid
          description: Unique identifier of the order
        client_id:
          type: string
          format: uuid
          description: >-
            Unique client identifier for the order. This can be specified at
            time of booking the order by the client, otherwise is randomly
            generated
        amount:
          type: string
          description: The amount of currency for this order
        side:
          type: string
          enum:
            - BUY
            - SELL
          x-apidog-enum:
            - value: BUY
              name: ''
              description: ''
            - value: SELL
              name: ''
              description: ''
          description: BUY or SELL
        instrument_code:
          type: string
          description: The market identifier for the order
        price:
          type: string
          description: The price at which the order is set to execute
        time:
          type: string
          format: date-time
          description: The time the order was booked at
        sequence:
          type: string
          description: An incremental identifier for tracking the order in the exchange
        total_fee:
          type: string
          description: >-
            The total cumulative fee paid for the order. This is a sum of fees
            for all trades executed for this order
        fee_currency:
          type: string
          description: The currency code that the fee was paid in
        time_last_updated:
          type: string
          description: Time of the last activity on the order
        order_book_sequence:
          type: string
          description: DEPRECATED - This will be removed soon, use sequence instead
        filled_amount:
          type: string
          description: The already filled amount of currency for this order
        status:
          $ref: '#/components/schemas/OrderStatus'
          description: >-
            The current state of the order is represented by the status, when it
            first enters the book it will have a status of *BOOKED* , as trades
            are executed, it will change to *FILL* or *FILLED_FULLY* depending
            on how much of the order is filled.

            If the order is cancelled by the user before any trades are
            executed, it will have a status of *CANCELLED*. If there are already
            trades on the order then subsequently cancelled by the user, the
            order will have a status of *FILLED_CLOSED*.

            If the order is rejected by the exchange for one of several reasons,
            it will have a state of either *FILLED_REJECTED*,
            *INSUFFICIENT_FUNDS*, or *INSUFFICIENT_LIQUIDITY*.
        average_price:
          type: string
          description: >-
            Weighed average price of all trades belonging to this order. Not
            present if there are no trades for this order.
      x-apidog-orders:
        - account_id
        - order_id
        - client_id
        - amount
        - side
        - instrument_code
        - price
        - time
        - sequence
        - total_fee
        - fee_currency
        - time_last_updated
        - order_book_sequence
        - filled_amount
        - status
        - average_price
      required:
        - account_id
        - order_id
        - client_id
        - amount
        - side
        - instrument_code
        - price
        - time
        - sequence
        - time_last_updated
        - filled_amount
        - status
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    OrderStatus:
      type: string
      enum:
        - BOOKED
        - FILL
        - MOVED
        - FILLED_FULLY
        - FILLED_CLOSED
        - FILLED_REJECTED
        - CANCELLED
        - INSUFFICIENT_FUNDS
        - INSUFFICIENT_LIQUIDITY
      x-apidog-enum:
        - value: BOOKED
          name: ''
          description: ''
        - value: FILL
          name: ''
          description: ''
        - value: MOVED
          name: ''
          description: ''
        - value: FILLED_FULLY
          name: ''
          description: ''
        - value: FILLED_CLOSED
          name: ''
          description: ''
        - value: FILLED_REJECTED
          name: ''
          description: ''
        - value: CANCELLED
          name: ''
          description: ''
        - value: INSUFFICIENT_FUNDS
          name: ''
          description: ''
        - value: INSUFFICIENT_LIQUIDITY
          name: ''
          description: ''
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.onetrading.com/fast/v1
    description: Production Env
security: []

```