Skip to main content

xRocket Exchange REST API

xRocket Exchange API allows developers to integrate xRocket exchange features in their projects to be able to create, execute or cancel orders, retrieve market data, track trading pair price dynamics, etc.

info

All public endpoints are available without authorization. Use REST API on this website or our Exchange API Swagger to test and review request/response examples and other details:

Production -

Testnet -
Important changes in this API version
  • xRocket wallet has two types of balance, Trading and Funding.

This version of API is designed to enable the interactions of the two balances.

API v1 deprecation notice

Trade API v1 (https://trade.xrocket.tg/api) is deprecated, unsupported, and will soon be removed. Please migrate to the latest Exchange API.

Authorization

  • Get your Bearer token (API Key) to use any private endpoints. In Telegram bot go to SettingsExchange settingsAPI token.
  • Add the Bearer token in the requests while using any private endpoints as follows:
"Authorization: Bearer SpjEQPuvEGMae7QLaNzR8I47D3qzUP"
warning

Please use testnet bot to get Bearer token for testnet integration.

Entities

xRocket Exchange API implies interaction of the following entities:

account // xRocket user account
balance // balance can be funding or trading and belongs to an xRocket account
symbol // a trading pair, for example BTC-USDT
order // a trading order to buy/sell asset at user-specified conditions
trade // a execution of orders on the exchange
ticker // market data of a symbol (trading pair) for a specified time interval
candle // aggregated trading data for a specified pair and time interval
orderbook // total bid/ask amounts of a trading pair with a specified depth and precision
transfer // movement of an asset within user account from/to funding/trading balance

Read more about the entities

Request/response example

In this example the GET /api/v1/orders/history method is used to request history of closed and cancelled BTC-USDT trading orders for a specified time interval. The method requests an xRocket account-related data. Such requests require authorization token that can be issued to a user account.

curl -X 'GET' \
'https://exchange.api.xrocket.tg/api/v1/orders/history?symbol=BTC-USDT&side=buy&startAt=2024-12-24T14%3A49%3A13.543Z&endAt=2024-12-24T14%3A49%3A13.543Z&currentPage=1&pageSize=20&hideCanceled=false' \
-H 'accept: application/json' \
-H 'Authorization: Bearer 10Q9DG5BG0ReG3jCdyEQ6C5yQkhHRX'

The request is sent to URL of the API method: /api/v1/orders/history

Example field and valueDescription
symbol=BTC-USDTBTC-USDT is specified as the trading pair (symbol).
side=buyOnly buy orders are requested. This field can be set to buy or sell. Don’t use the field to get all (buy and sell) orders.
startAt=2024-12-24T1:49:13.543ZThis field specifies the beginning timestamp of the requested history.
endAt=2024-12-24T14:49:13.543ZThis field specifies the ending timestamp of the requested history.
currentPage=1This field specifies the page to display in the response. A response can consist of several pages.
pageSize=20This field specifies the number of trading records on a page of the returned response.
hideCanceled=falseThis field indicates if the cancelled orders are included in the response.
'Authorization: Bearer 10Q9DG5BG0ReG3jCdyEQ6C5yQkhHRX'The GET /api/v1/orders/history method requests an xRocket account-related data. Such requests require authorization token that can be issued to a user account by xRocket bot.

Example response:

{
"orders": [

{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clientOrderId": "string",
"symbol": "BTC-USDT",
"side": "buy",
"status": "working",
"createdAt": "2024-12-05T12:51:20.917Z",
"updatedAt": "2024-12-05T12:51:20.917Z",
"dealSize": "19.781",
"dealFunds": "19.781",
"fee": "1.82",
"feeAsset": "USDT",
"remark": "string",
"timeInForce": "GTC",
"type": "stopMarket",
"size": "109.34",
"stopTriggered": false,
"stopPrice": "300.5"
}
],
"currentPage": 1,
"pageSize": 20,
"totalNum": 1,
"totalPage": 1
}
Example field and valueDescription
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"Order ID.
"clientOrderId": "string"Unique identifier created by the client.
"symbol": "BTC-USDT"Symbol (trading pair).
"side": "buy"Buy or sell order [ buy, sell ].
"status": "working"Order status [ working, rejected, cancelled, completed, expired, pending, sending ].
"createdAt": "2024-12-05T12:51:20.917Z"Order creation timestamp.
"updatedAt": "2024-12-05T12:51:20.917Z"Order updated timestamp.
"dealSize": "19.781"Executed amount in base asset (BTC).
"dealFunds": "19.781"Executed size of funds in quote asset (USDT).
"fee": "1.82"The amount of fee.
"feeAsset": "USDT"The asset to pay the fee.
"timeInForce": "GTC"Time in force parameter [ GTC, IOC, FOK ]. GTC (Good 'Til Canceled), IOC (Immediate or Cancel), and FOK (Fill or Kill).
"type": "stopMarket"Type of order [limit, market, stopLimit, stopMarket].
"size": "109.34"Order amount.
"stopTriggered": falseIndicates if the stop order is triggered or not.
"stopPrice": "300.5"Indicates the stop price.
"currentPage": 1Current page.
"pageSize": 20Max number of records on a page.
"totalNum": 1Total number of records returned.
"totalPage": 1Total number of pages returned.

Methods

Find the right endpoint for your application in the following list of all the available xRocket Exchange API methods with brief descriptions grouped by category for easy navigation.

MethodDescription
Market dataMethods for requesting exchange market public data.
Get symbolRequest details of a specified trading pair.
Get symbolsRequest the list of all currently available trading pairs.
Get tickerRequest market data of a trading pair for a specified time interval.
Get candlesRequest current market candles data for specified trading pair.
Get orderbookRequest current order book data for specified trading pair.
Get tradesRequest details of completed trading orders for a specified trading pair.
Get assetsRequest the list of all available assets.
Get assetRequest details of a specified asset.
RatesMethods for requesting public exchange rates.
Get ratesRequest current rates of specified cryptos in a specified fiat.
OrdersMethods for requesting orders details and managing orders of a specified account.
Get orders historyRequest orders history. Requires authorization
Get active ordersRequest active orders list. Requires authorization
Get orderRequest order details by order ID. Requires authorization
Delete orderCancel trading order by ID. Requires authorization
Place orderPlace trading order. Requires authorization
Get order estimationRequest order estimation. Requires authorization
AccountMethods for requesting account data.
Get account trading balancesRequest current trading balances. Requires authorization
Get exchange feesRequest current exchange fees for specified trading pair.
FundingMethods for managing funding balances and withdrawals of a specified account.
Create withdrawalCreate withdrawal. Requires authorization
Get account funding balancesRequest current funding balances. Requires authorization
Get withdrawal by IDRequest details of withdrawal by withdrawal ID. Requires authorization
Get withdrawals historyRequest withdrawal history. Requires authorization
Get withdrawal quotasRequest details of withdrawal quotas.
TransfersMethods for managing transfers of assets between funding/trading balances within specified xRocket account.
TransferTransfer assets between funding/trading balances within xRocket account. Requires authorization
Get transfers historyRequest transfers history for a specified direction and timeframe. Requires authorization
Get transfer by transfer IDRequest details of a specified transfer by ID. Requires authorization