Ondo Finance Orders API

The Orders API from Ondo Finance — 6 operation(s) for orders.

OpenAPI Specification

ondo-finance-orders-api-openapi.yml Raw ↑
openapi: 3.0.4
info:
  title: GM Backend Account Orders API
  description: An API spec for the Ondo GM Backend API.
  version: 1.0.0
servers:
- url: https://api.gm.ondo.finance
  description: GM Backend API
tags:
- name: Orders
paths:
  /v1/perps/orders:
    post:
      summary: Create Order
      description: 'Creates a limit or market order. Change the "type" field to switch between order types. If `postOnly` is `true` and an order would match at placement, a 400 is returned with error `post_only_has_match`.

        '
      operationId: createOrder
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddOrderReq'
            example:
              clientOrderId: order123
              market: AAPL-USD.P
              price: '1.55'
              side: buy
              size: '20.30'
      responses:
        '200':
          description: Created order
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/ApiOrder'
              example:
                success: true
                result:
                  orderId: 197ec08e001658690721be129e7fa595
                  clientOrderId: order123
                  side: buy
                  price: '227.50'
                  size: '10.00'
                  market: AAPL-USD.P
                  filledSize: '0.00'
                  lastFillSize: '0.00'
                  filledCost: '0.00'
                  fee: '0.00'
                  status: open
                  createdAt: '2025-03-05T14:30:00Z'
                  type: limit
                  timeInForce: GTC
                  reduceOnly: false
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - account_in_liquidation
                    - clientOrderID_chars_invalid
                    - clientOrderID_collision
                    - clientOrderID_length_invalid
                    - deprecated_field
                    - insufficient_funds
                    - insufficient_liquidity
                    - insufficient_margin
                    - invalid_market
                    - invalid_market_order_fields
                    - invalid_order_type
                    - invalid_stop_order
                    - invalid_time_in_force
                    - mark_price_not_available
                    - market_orders_disabled
                    - must_use_delayed_path
                    - net_position_too_large
                    - order_invalid_price
                    - order_invalid_size
                    - order_matches_against_self
                    - order_negative_price
                    - order_negative_size
                    - order_price_outside_min_max_bounds
                    - order_price_outside_safe_bounds
                    - post_only_has_match
                    - price_over_ui_limit_10MM
                    - redirect
                    - reduce_only_flipping_position
                    - reduce_only_increasing_position
                    - reduce_only_invalid_tif
                    - reduce_only_no_open_position
                    - stop_order_crosses_mark_price
                    - stop_order_crosses_order_price
                    - stop_order_trigger_price_exceeds_max
                    - stop_order_trigger_price_invalid_increment
                    - stop_order_trigger_price_negative
                    - too_many_open_orders
                    - trading_disabled
              example:
                success: false
                error: Description of the error
                error_code: account_in_liquidation
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      summary: Get Orders
      description: Returns a paginated list of orders matching the given parameters.
      operationId: getOrders
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: limit
        in: query
        description: Maximum number of results to return
        required: false
        schema:
          type: integer
          example: 1000
      - name: cursor
        in: query
        description: Pagination cursor
        required: false
        schema:
          type: string
          example: NQ5WWO3THN3Q====
      - name: market
        in: query
        description: Filter by trading market
        required: false
        schema:
          type: string
          example: AAPL-USD.P
      - name: status
        in: query
        description: Filter by order status
        required: false
        schema:
          type: string
          enum:
          - open
          - canceled
          - fullyfilled
          example: open
      - name: startTime
        in: query
        description: Filter orders placed at or after this time (UTC milliseconds)
        required: false
        schema:
          type: integer
          example: 1684814400000
      - name: endTime
        in: query
        description: Filter orders placed at or before this time (UTC milliseconds)
        required: false
        schema:
          type: integer
          example: 1672549200000
      responses:
        '200':
          description: Paginated list of orders, reverse chronological
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      type: array
                      items:
                        $ref: '#/components/schemas/ApiOrder'
                    pageInfo:
                      $ref: '#/components/schemas/PageInfo'
              example:
                success: true
                result:
                - orderId: 197ec08e001658690721be129e7fa595
                  side: buy
                  price: '227.50'
                  size: '10.00'
                  market: AAPL-USD.P
                  filledSize: '5.00'
                  lastFillSize: '2.50'
                  filledCost: '1137.50'
                  fee: '0.57'
                  status: open
                  createdAt: '2025-03-05T14:30:00Z'
                  type: limit
                  timeInForce: GTC
                  reduceOnly: false
                pageInfo:
                  nextCursor: NQ5WWO3THN3Q====
                  prevCursor: O4ZTGM3RGM2DG===
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - bad_query_param
                    - failed_to_parse_timestamp
                    - invalid_cursor
                    - invalid_market
              example:
                success: false
                error: Description of the error
                error_code: bad_query_param
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      summary: Cancel All Orders
      description: 'Cancels all orders for the authenticated user. Optionally restricted to a single market.

        '
      operationId: cancelAllOrders
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: market
        in: query
        description: If specified, only cancel orders for this market
        required: false
        schema:
          type: string
          example: AAPL-USD.P
      responses:
        '200':
          description: Orders cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
              example:
                success: true
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - bad_query_param
              example:
                success: false
                error: Description of the error
                error_code: bad_query_param
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/orders/delayed:
    post:
      summary: Create Order (Delayed)
      description: Redirect target for speed-bumped order placement. When POST /v1/perps/orders returns a 307 redirect due to a speed bump, clients should resubmit the same request to this endpoint.
      operationId: createOrderDelayed
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddOrderReq'
      responses:
        '200':
          description: Created order
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/ApiOrder'
              example:
                success: true
                result:
                  orderId: 197ec08e001658690721be129e7fa595
                  side: buy
                  price: '227.50'
                  size: '10.00'
                  market: AAPL-USD.P
                  filledSize: '0.00'
                  lastFillSize: '0.00'
                  filledCost: '0.00'
                  fee: '0.00'
                  status: open
                  createdAt: '2025-03-05T14:30:00Z'
                  type: limit
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - account_in_liquidation
                    - clientOrderID_chars_invalid
                    - clientOrderID_collision
                    - clientOrderID_length_invalid
                    - deprecated_field
                    - insufficient_funds
                    - insufficient_liquidity
                    - insufficient_margin
                    - invalid_market
                    - invalid_market_order_fields
                    - invalid_order_type
                    - invalid_stop_order
                    - invalid_time_in_force
                    - mark_price_not_available
                    - market_orders_disabled
                    - net_position_too_large
                    - order_invalid_price
                    - order_invalid_size
                    - order_matches_against_self
                    - order_negative_price
                    - order_negative_size
                    - order_price_outside_min_max_bounds
                    - order_price_outside_safe_bounds
                    - post_only_has_match
                    - price_over_ui_limit_10MM
                    - reduce_only_flipping_position
                    - reduce_only_increasing_position
                    - reduce_only_invalid_tif
                    - reduce_only_no_open_position
                    - stop_order_crosses_mark_price
                    - stop_order_crosses_order_price
                    - stop_order_trigger_price_exceeds_max
                    - stop_order_trigger_price_invalid_increment
                    - stop_order_trigger_price_negative
                    - too_many_open_orders
                    - trading_disabled
              example:
                success: false
                error: Description of the error
                error_code: account_in_liquidation
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/orders/batch:
    post:
      summary: Create Batched Orders
      description: 'Creates multiple orders in a single API call. Some orders may succeed while others fail. The response code is 2XX as long as there is no internal server error. Returns 400 with `error_code=batch_order_empty` if the `orders` array is empty. Returns 400 with `error_code=batch_order_too_many_orders` if too many orders are provided (max 20).

        '
      operationId: createBatchOrders
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchAddOrderReq'
      responses:
        '200':
          description: Batch order result
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/BatchAddOrderRes'
              example:
                success: true
                result:
                  addedOrders:
                  - orderId: 197ec08e001658690721be129e7fa595
                    side: buy
                    price: '227.50'
                    size: '10.00'
                    market: AAPL-USD.P
                    filledSize: '0.00'
                    lastFillSize: '0.00'
                    filledCost: '0.00'
                    fee: '0.00'
                    status: open
                    createdAt: '2025-03-05T14:30:00Z'
                    type: limit
                  failedOrders: []
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - account_in_liquidation
                    - batch_order_empty
                    - batch_order_too_many_orders
                    - clientOrderID_chars_invalid
                    - clientOrderID_collision
                    - clientOrderID_length_invalid
                    - deprecated_field
                    - insufficient_funds
                    - insufficient_liquidity
                    - insufficient_margin
                    - invalid_market
                    - invalid_market_order_fields
                    - invalid_order_type
                    - invalid_stop_order
                    - invalid_time_in_force
                    - mark_price_not_available
                    - market_orders_disabled
                    - net_position_too_large
                    - order_invalid_price
                    - order_invalid_size
                    - order_matches_against_self
                    - order_negative_price
                    - order_negative_size
                    - order_price_outside_min_max_bounds
                    - order_price_outside_safe_bounds
                    - post_only_has_match
                    - price_over_ui_limit_10MM
                    - redirect
                    - reduce_only_flipping_position
                    - reduce_only_increasing_position
                    - reduce_only_invalid_tif
                    - reduce_only_no_open_position
                    - stop_order_crosses_mark_price
                    - stop_order_crosses_order_price
                    - stop_order_trigger_price_exceeds_max
                    - stop_order_trigger_price_invalid_increment
                    - stop_order_trigger_price_negative
                    - too_many_open_orders
                    - trading_disabled
              example:
                success: false
                error: Description of the error
                error_code: account_in_liquidation
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      summary: Batch Cancel Orders
      description: 'Cancels multiple orders in a single call. Returns results for each order. Provide a comma-separated list of order IDs via the `orderIDs` query parameter. Each entry can be an internal order ID or `client:{clientOrderID}`.

        '
      operationId: batchCancelOrders
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: orderIDs
        in: query
        description: Comma-separated list of order IDs to cancel
        required: true
        schema:
          type: string
          example: abc123,def456
      responses:
        '200':
          description: Batch cancel result
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/BatchCancelResult'
              example:
                success: true
                result:
                  successfulCancels:
                  - orderId: 197ec08e001658690721be129e7fa595
                    side: buy
                    price: '227.50'
                    size: '10.00'
                    market: AAPL-USD.P
                    filledSize: '0.00'
                    lastFillSize: '0.00'
                    filledCost: '0.00'
                    fee: '0.00'
                    status: canceled
                    createdAt: '2025-03-05T14:30:00Z'
                    canceledAt: '2025-03-05T14:35:00Z'
                    type: limit
                  failedCancels: []
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - batch_cancel_empty
                    - batch_cancel_too_many_orders
                    - order_already_canceled
                    - order_already_fully_filled
                    - order_not_found
                    - order_not_in_cancelable_state
                    - trading_disabled
              example:
                success: false
                error: Description of the error
                error_code: batch_cancel_empty
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/orders/batch/delayed:
    post:
      summary: Create Batched Orders (Delayed)
      description: Redirect target for speed-bumped batch order placement. When POST /v1/perps/orders/batch returns a 307 redirect due to a speed bump, clients should resubmit the same request to this endpoint.
      operationId: createBatchOrdersDelayed
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchAddOrderReq'
      responses:
        '200':
          description: Batch order result
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/BatchAddOrderRes'
              example:
                success: true
                result:
                  addedOrders:
                  - orderId: 197ec08e001658690721be129e7fa595
                    side: buy
                    price: '227.50'
                    size: '10.00'
                    market: AAPL-USD.P
                    filledSize: '0.00'
                    lastFillSize: '0.00'
                    filledCost: '0.00'
                    fee: '0.00'
                    status: open
                    createdAt: '2025-03-05T14:30:00Z'
                    type: limit
                  failedOrders: []
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - account_in_liquidation
                    - batch_order_empty
                    - batch_order_too_many_orders
                    - clientOrderID_chars_invalid
                    - clientOrderID_collision
                    - clientOrderID_length_invalid
                    - deprecated_field
                    - insufficient_funds
                    - insufficient_liquidity
                    - insufficient_margin
                    - invalid_market
                    - invalid_market_order_fields
                    - invalid_order_type
                    - invalid_stop_order
                    - invalid_time_in_force
                    - mark_price_not_available
                    - market_orders_disabled
                    - net_position_too_large
                    - order_invalid_price
                    - order_invalid_size
                    - order_matches_against_self
                    - order_negative_price
                    - order_negative_size
                    - order_price_outside_min_max_bounds
                    - order_price_outside_safe_bounds
                    - post_only_has_match
                    - price_over_ui_limit_10MM
                    - reduce_only_flipping_position
                    - reduce_only_increasing_position
                    - reduce_only_invalid_tif
                    - reduce_only_no_open_position
                    - stop_order_crosses_mark_price
                    - stop_order_crosses_order_price
                    - stop_order_trigger_price_exceeds_max
                    - stop_order_trigger_price_invalid_increment
                    - stop_order_trigger_price_negative
                    - too_many_open_orders
                    - trading_disabled
              example:
                success: false
                error: Description of the error
                error_code: account_in_liquidation
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/orders/{orderID}:
    get:
      summary: Get Order by ID
      description: 'Gets an individual order by order ID. The `orderID` path parameter can be: - An internal order ID (e.g. `197ec08e001658690721be129e7fa595`) - A client order ID prefixed with `client:` (e.g. `client:abc123`)

        '
      operationId: getOrderByID
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: orderID
        in: path
        description: Internal order ID, or `client:{clientOrderID}` for client order ID lookup
        required: true
        schema:
          type: string
          example: 197ec08e001658690721be129e7fa595
      responses:
        '200':
          description: Order
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/ApiOrder'
              example:
                success: true
                result:
                  orderId: 197ec08e001658690721be129e7fa595
                  side: buy
                  price: '227.50'
                  size: '10.00'
                  market: AAPL-USD.P
                  filledSize: '10.00'
                  lastFillSize: '5.00'
                  filledCost: '2275.00'
                  fee: '1.14'
                  status: fullyfilled
                  createdAt: '2025-03-05T14:30:00Z'
                  filledAt: '2025-03-05T14:30:05Z'
                  type: limit
                  timeInForce: GTC
                  reduceOnly: false
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - order_not_found
              example:
                success: false
                error: Description of the error
                error_code: order_not_found
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      summary: Cancel Order by ID
      description: 'Cancels an individual order by order ID. The `orderID` path parameter can be: - An internal order ID (e.g. `197ec08e001658690721be129e7fa595`) - A client order ID prefixed with `client:` (e.g. `client:abc123`)

        Returns 400 with error codes `order_already_canceled`, `order_not_in_cancelable_state`, or `order_already_filled` if the order cannot be cancelled.

        '
      operationId: cancelOrderByID
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: orderID
        in: path
        description: Internal order ID, or `client:{clientOrderID}` for client order ID lookup
        required: true
        schema:
          type: string
          example: 197ec08e001658690721be129e7fa595
      responses:
        '200':
          description: Cancelled order
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      $ref: '#/components/schemas/ApiOrder'
              example:
                success: true
                result:
                  orderId: 197ec08e001658690721be129e7fa595
                  side: buy
                  price: '227.50'
                  size: '10.00'
                  market: AAPL-USD.P
                  filledSize: '0.00'
                  lastFillSize: '0.00'
                  filledCost: '0.00'
                  fee: '0.00'
                  status: canceled
                  createdAt: '2025-03-05T14:30:00Z'
                  canceledAt: '2025-03-05T14:35:00Z'
                  type: limit
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - order_already_canceled
                    - order_already_fully_filled
                    - order_not_found
                    - order_not_in_cancelable_state
                    - trading_disabled
              example:
                success: false
                error: Description of the error
                error_code: order_already_canceled
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/orders/csv:
    get:
      summary: Get Orders CSV
      description: Export filled orders as CSV, sorted reverse chronologically.
      operationId: getOrdersCSV
      tags:
      - Orders
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: market
        in: query
        description: Filter by trading market
        required: false
        schema:
          type: string
          example: AAPL-USD.P
      - name: status
        in: query
        description: Filter by order status
        required: false
        schema:
          type: string
          example: open
      - name: startTime
        in: 

# --- truncated at 32 KB (46 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/ondo-finance/refs/heads/main/openapi/ondo-finance-orders-api-openapi.yml