Skip to main content
GET
/
api
/
v1
/
order?market=ETH-USD&order-id=01HZ36SYBP4Z80GRX30P49XHB5
Get Order By ID
curl --request GET \
  --url 'https://order.trade.rails.xyz/api/v1/order?market=ETH-USD&order-id=01HZ36SYBP4Z80GRX30P49XHB5' \
  --header 'Authorization: Bearer <token>'
{
  "order": {
    "market": "ETH-USD",
    "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",
    "postOnly": false,
    "avgFillPrice": "3772.272138"
  }
}
See rate limit applied to this endpoint. Violating the rate limit may result in a soft ban.

Polling Order Status

Both this endpoint and the Get Account Open Order By ID endpoint can be used to poll the status of an order. However, there are a couple of enhancements the current endpoint provides:
  • Recent Cancelled Orders: It returns the most recent cancelled orders, which is not available in the Get Account Open Order By ID endpoint. You should be able to get the order details if the order was cancelled within one hour. The order status will be cancelled in the response.
  • Recent Filled Orders: It returns the most recent filled orders, which is not available in the Get Account Open Order By ID endpoint. You should be able to get the order details if the order was filled within one hour. The order status will be filled in the response.
Note that the cancelled or filled order information will no longer be available after one hour and you will get a 404 Not Found response if you try to retrieve the order details after that time.

Order ID and Client Request ID

First, you need to provide market in the query parameters. Then, you can provide either order-id or client-request-id but not both to specify the order you want to retrieve. Typically, you would use order-id when you have the order ID from a previous order creation while client-request-id is used when you want to retrieve an order that you haven’t received a confirmation for yet.

Order Quantity Fields

In the order object, quantity represents the remaining quantity and filledQuantity represents the cumulative filled quantity. The two values will add up to the original order quantity.

Rate Limit Headers

This endpoint includes special headers to help you manage your API usage and avoid rate limit violations:
Header NameDescriptionAlways Present
X-Api-Quota-UsedThe number of requests you have made in the current rate limit windowYes
X-Api-Quota-LimitYour current rate limit (requests per minute)Yes
Retry-AfterNumber of seconds to wait before making another request (429 responses only)No
Example Response Headers Normal Response (200 OK):
X-Api-Quota-Used: 8000
X-Api-Quota-Limit: 10000
Rate Limited Response (429 Too Many Requests):
X-Api-Quota-Used: 10001
X-Api-Quota-Limit: 10000
Retry-After: 59
Using Rate Limit Headers You should monitor these headers in your application to:
  1. Track Usage: Use X-Api-Quota-Used and X-Api-Quota-Limit to monitor how close you are to hitting your rate limit
  2. Implement Proactive Throttling: When X-Api-Quota-Used approaches X-Api-Quota-Limit, slow down your request rate
  3. Handle 429 Responses: When you receive a 429 response, wait for the number of seconds specified in the Retry-After header before making another request

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

market
string
required

Example value: ETH-USD. To get all supported markets, call /api/v1/markets endpoint.

order-id
string

Example value: 01J4MD3R7N4HH4G76PT47VG3QC. This is the unique identifier of the order. You can get this value from the create order response.

client-request-id
string

Example value: 0835bf3e-4a20-41f0-908d-8213f2b7a285. This is the same value as the clientRequestId field in the create order request.

Response

order
object