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

# Get Order By ID

> This endpoint retrieves order details by order ID or client request ID.



## OpenAPI

````yaml GET /api/v1/order
openapi: 3.1.0
info:
  title: Order API
  version: 1.0.0
servers:
  - url: https://order.sandbox.rails.xyz
security: []
paths:
  /api/v1/order:
    get:
      summary: Get Order By ID
      operationId: getOrderById
      parameters:
        - $ref: '#/components/parameters/requiredMarket'
        - $ref: '#/components/parameters/order-id'
        - $ref: '#/components/parameters/client-request-id'
      responses:
        '200':
          description: ''
          headers:
            X-Api-Quota-Used:
              description: >-
                The number of requests you have made in the current rate limit
                window
              schema:
                type: integer
            X-Api-Quota-Limit:
              description: Your current rate limit (requests per minute)
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getOrderByIdResponse'
              example:
                order:
                  market: ETH-USDT
                  orderId: 01HZ36SYBP4Z80GRX30P49XHB5
                  orderType: sell
                  tradeType: limit
                  price: '3772.272138'
                  quantity: '1'
                  filledQuantity: '0.5'
                  leverage: '1'
                  createdAt: 1717020981622
                  updatedAt: 1717020982756
                  orderStatus: active
                  clientRequestId: 0835bf3e-4a20-41f0-908d-8213f2b7a285
                  reduceOnly: false
                  postOnly: false
                  avgFillPrice: '3772.272138'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: ''
          headers:
            X-Api-Quota-Used:
              description: >-
                The number of requests you have made in the current rate limit
                window
              schema:
                type: integer
            X-Api-Quota-Limit:
              description: Your current rate limit (requests per minute)
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    description: An object containing error details.
                    properties:
                      slug:
                        type: string
                        description: A short string identifier for the error type.
                      code:
                        type: string
                        description: A string code representing the error.
                    required:
                      - slug
                      - code
                  message:
                    type: string
                    description: A human-readable message describing the error.
                required:
                  - error
                  - message
              example:
                error:
                  slug: NOT_FOUND
                  code: '0007'
                message: order not found
        '429':
          description: ''
          headers:
            X-Api-Quota-Used:
              description: >-
                The number of requests you have made in the current rate limit
                window
              schema:
                type: integer
            X-Api-Quota-Limit:
              description: Your current rate limit (requests per minute)
              schema:
                type: integer
            Retry-After:
              description: >-
                Number of seconds to wait before making another request (429
                responses only)
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    description: An object containing error details.
                    properties:
                      slug:
                        type: string
                        description: A short string identifier for the error type.
                      code:
                        type: string
                        description: A string code representing the error.
                    required:
                      - slug
                      - code
                  message:
                    type: string
                    description: A human-readable message describing the error.
                required:
                  - error
                  - message
              example:
                error:
                  slug: TOO_MANY_REQUESTS
                  code: '0003'
                message: api rate limit exceeded
      security:
        - bearerAuth: []
components:
  parameters:
    requiredMarket:
      name: market
      in: query
      description: >-
        Market name. Example value: `ETH-USDT`. To get all supported markets,
        call [/api/v1/markets](/latest/perps/rest-api/get-supported-markets)
        endpoint.
      required: true
      schema:
        type: string
    order-id:
      name: order-id
      in: query
      description: >-
        Unique identifier of the order. Example value:
        `01J4MD3R7N4HH4G76PT47VG3QC`. You can get this value from the create
        order response.
      required: false
      schema:
        type: string
    client-request-id:
      name: client-request-id
      in: query
      description: >-
        Client-generated UUID for correlation. Example value:
        `0835bf3e-4a20-41f0-908d-8213f2b7a285`. This is the same value as the
        `clientRequestId` field in the create order request.
      required: false
      schema:
        type: string
  schemas:
    getOrderByIdResponse:
      type: object
      properties:
        order:
          $ref: '#/components/schemas/order'
          description: Order object containing all details for the requested order.
      required:
        - order
    order:
      type: object
      properties:
        market:
          type: string
          description: 'Market name. Example: ''ETH-USDT''.'
        orderId:
          type: string
          description: Unique identifier for the order.
        orderType:
          type: string
          description: Order side.
          enum:
            - buy
            - sell
        tradeType:
          type: string
          description: Order type.
          enum:
            - limit
            - market
        price:
          type: string
          description: Price used.
        quantity:
          type: string
          description: Remaining quantity.
        filledQuantity:
          type: string
          description: Filled quantity.
        leverage:
          type: string
          description: Leverage used at order creation.
        createdAt:
          type: number
          description: Order creation timestamp (milliseconds since epoch).
        updatedAt:
          type: number
          description: Order last update timestamp (milliseconds since epoch).
        orderStatus:
          type: string
          description: Order status.
          enum:
            - active
            - pending
            - cancelling
            - cancelled
            - modifying
            - modified
            - rejected
            - filled
        clientRequestId:
          type: string
          description: Client-generated UUID for correlation.
        reduceOnly:
          type: boolean
          description: >-
            Reduce-only flag. When `true`, the order can only reduce an existing
            position.
        postOnly:
          type: boolean
          description: Maker-only creation flag.
        avgFillPrice:
          type: string
          description: Average price across fills.
      required:
        - market
        - orderId
        - orderType
        - tradeType
        - price
        - quantity
        - filledQuantity
        - leverage
        - createdAt
        - updatedAt
        - orderStatus
        - reduceOnly
        - postOnly
  responses:
    Unauthorized:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: A human-readable message describing the error.
            required:
              - message
          example:
            message: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````