Skip to main content

Overview

The clientOrderId is an optional identifier for tracking and managing orders with custom identifiers. It provides an additional layer of order management and tracking capabilities alongside the exchange-provided orderId.

Specifications

Type & Requirements

  • Type: String
  • Mandatory: No
  • Uniqueness: enforced only among open (pending) orders on the same market — the identifier can be reused once the previous order fills or cancels

Allowed Characters

  • Latin letters
  • Numbers
  • Dashes (-)
  • Dots (.)
  • Underscores (_)

Length and Format Guidelines

  • Recommended length: 32 characters
  • Case-sensitive: “Order1” and “order1” are different IDs
  • Leading/trailing spaces are not allowed
  • Cannot be an empty string if provided

Best Practices

Structured Naming Convention

Common Use Cases

Basic Limit Order

Order Management

Tracking Orders

Track orders using clientOrderId through the following endpoints:1. Query Active OrdersUse the Query Active Orders endpoint (/api/v4/orders) to get all unexecuted orders:
Example response includes order details such as ID, status, and execution information:
2. Query Order HistoryUse the Query Order History endpoint (/api/v4/trade-account/order/history) to get executed orders:
Example response showing execution details and final order status. The response groups orders by market name:
3. Cancelling Orders Using ClientOrderIdUse the Cancel Order endpoint (/api/v4/order/cancel) to cancel an order by its clientOrderId:
Important notes about order cancellation:
  • Use either orderId or clientOrderId, but not both in the same request
  • A request specifying both identifiers, or neither, returns a validation error

Error Handling

Common Error Cases

Duplicate ID

The clientOrderId only has to be unique among the account’s open (pending) orders on the same market. Once a previous order is filled or canceled, the same identifier can be reused on the same market. The same identifier can also be used in parallel on different markets.

Invalid Format

Ensure the ID only contains allowed characters.

Length Limit

The recommended length is 32 characters, with a maximum permissible length of 64 characters.

Order Not Found

Handle cases where an order with the specified clientOrderId does not exist.

Example error handling:

Example: Account-operator implementation

For the full Embedded Trading integration guide — program enrollment, sub-account setup, fee share model, and revenue monitoring — see Embedded Trading integration.

Account-operator implementation

ClientOrderId StructureFormat: acct-{clientId}-{orderType}-{purpose}-{timestamp} Example: acct-ind123-limit-spot-1678234567Components:
  • acct: Account-operator prefix
  • clientId: Internal client identifier
  • orderType: Order type (market/limit)
  • purpose: Trading purpose/strategy
  • timestamp: Keeps each identifier distinct across submissions

Individual Clients

acct-ind123-market-spot-1678234567

Corporate Clients

acct-corp789-limit-hedge-1678234567

Managed Portfolios

acct-port555-market-dca-1678234567

Trading Purpose Examples

Spot Trading

acct-ind123-market-spot-1678234567

DCA Strategy

acct-port555-market-dca-1678234567

Grid Trading

acct-ind123-limit-grid-1678234567

Portfolio Rebalancing

acct-port555-limit-rebal-1678234567

API Usage Example

This structured approach lets an account operator:
  • Track orders for multiple clients
  • Identify order types and purposes
  • Maintain unique identifiers
  • Query and manage orders efficiently

Order management for account operators

Client Order Management

Cancelling Client Orders

An account operator can efficiently cancel orders for any client using the structured clientOrderId:

Retrieving Historical Client Orders

The Query Order History endpoint (/api/v4/trade-account/order/history) supports exact clientOrderId lookup only: pass the full identifier to retrieve a single order. When clientOrderId is supplied, the endpoint switches to single-order lookup mode and ignores the startDate, endDate, and status filters. Pattern or prefix matching on clientOrderId is not supported.
For reporting across many client orders, retrieve history in list mode — filtered by market, startDate, and endDate (Unix seconds) — and parse the structured identifiers client-side, as shown below.

Analytics and reporting

With structured clientOrderId patterns, an account operator can reconstruct per-client reporting from order history without a separate order database — each ID segment maps to a report dimension: The critical path is the parser — split the ID and validate its shape. Aggregating parsed segments into per-client totals (order counts, dealMoney volume, per-purpose breakdowns) is standard reporting code on top of it: