# Rujira REST API

### Introduction

This document outlines the REST API endpoints available for RUJI Trade orderbook DEX and RUJI token supply, to be used by integrating partners such as CoinGecko and CoinMarketCap.

If you need a more complete, higher performance API, we recommend using our GraphQL API available here: <https://api.rujira.network/api/graphiql>.

#### General API Information

* The base endpoints are available at <https://api.rujira.network/api/>
* Responses are provided in JSON format.
* Data is returned in descending order. Newest first, oldest last.
* All time and timestamp related fields in the JSON responses are in milliseconds.
* Timestamp parameters (e.g. start\_time, end\_time) must be passed in milliseconds.
* The API has a dynamic rate limit set by Cloudflare to prevent spamming.

### RUJI Trade Orderbook DEX

#### Endpoints Overview

<table><thead><tr><th width="60">No.</th><th width="220">Endpoint</th><th>Description</th></tr></thead><tbody><tr><td>1.</td><td>/trade/tickers</td><td>Market related statistics for all markets for the last 24 hours.</td></tr><tr><td>2.</td><td>/trade/orderbook</td><td>Order book depth of any given trading pair, split into two different arrays for bid and ask orders.</td></tr><tr><td>3.</td><td>/trade/historical_trades</td><td>Historical trade data for any given trading pair. </td></tr></tbody></table>

#### Endpoint 1: /trade/tickers (Market Info)

The <https://api.rujira.network/api/trade/tickers> endpoint provides 24-hour pricing and volume information on each market pair available on RUJI Trade DEX.

| Example response                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\[</p><p>  {</p><p>    "ticker\_id": "TCY\_RUNE",</p><p>    "base\_currency": "TCY",</p><p>    "target\_currency": "RUNE",</p><p>    "last\_price": "0.24",</p><p>    "base\_volume": 0,</p><p>    "target\_volume": 0,</p><p>    "pair\_id": "thor12ds7fxj5g47jwzfzvzzhzxxd3cp6v55flgwxva0803r8k5mzm44skth6wa",</p><p>    "bid": "0.186",</p><p>    "ask": "0.22"</p><p>  }</p><p>]</p> |

/trade/tickers endpoint response description:

<table><thead><tr><th width="180">Name</th><th width="180">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>ticker_id</td><td>string</td><td>Identifier of a ticker with delimiter to separate base/target, e.g. BTC_ETH</td></tr><tr><td>base_currency</td><td>string</td><td>Symbol/Currency code/Contract Address of a the base cryptoasset, e.g. BTC</td></tr><tr><td>target_currency</td><td>string</td><td>Symbol/Currency code/Contract Address of the target cryptoasset, e.g. ETH (Contract address for DEX)</td></tr><tr><td>last_price</td><td>decimal</td><td><p>Last transacted price of base currency based on given target currency<br>e.g.</p><p>1 base = X target</p></td></tr><tr><td>base_volume</td><td>decimal</td><td>24 hour trading volume for the pair (unit in base)</td></tr><tr><td>target_volume</td><td>decimal</td><td>24 hour trading volume for the pair (unit in target)</td></tr><tr><td>pair_id</td><td>string</td><td>Contract address for the pair</td></tr><tr><td>bid</td><td>decimal</td><td>Current highest bid price</td></tr><tr><td>ask</td><td>decimal</td><td>Current lowest ask price</td></tr></tbody></table>

#### Endpoint 2: /trade/orderbook (Orderbook depth details)

The trade/orderbook/ticker\_id endpoint provides orderbook information for a given market pair/ticker.

Endpoint parameters:

<table><thead><tr><th width="180">Name</th><th width="130">Type</th><th width="130">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td>ticker_id</td><td>string</td><td>Yes</td><td>A ticker such as "BTC_ETH", with delimiter between different cryptoassets</td></tr><tr><td>depth</td><td>integer</td><td>No</td><td>Orders depth quantity: [0, 100, 200, 500...]. 0 returns full depth. Depth = 100 means 50 for each bid/ask side.</td></tr></tbody></table>

Example query: <https://api.rujira.network/api/trade/orderbook?ticker_id=BTC_USDC&depth=100>

| Example response                                                                                                                                                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>{</p><p>  "ticker\_id": "BTC\_USDC",</p><p>  "asks": \[</p><p>    \[</p><p>      "116329",</p><p>      "0.00157858"</p><p>    ]</p><p>  ],</p><p>  "bids": \[</p><p>    \[</p><p>      "115400",</p><p>      "182.89939237"</p><p>    ]</p><p>  ]</p><p>}</p> |

/trade/orderbook response descriptions:

<table><thead><tr><th width="180">Name</th><th width="180">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>ticker_id</td><td>string</td><td>A pair such as "BTC_ETH", with delimiter between different cryptoassets</td></tr><tr><td>bids</td><td>decimal</td><td>An array containing 2 elements. The offer price and quantity for each bid order</td></tr><tr><td>asks</td><td>decimal</td><td>An array containing 2 elements. The ask price and quantity for each ask order</td></tr></tbody></table>

#### Endpoint 3: /trade/historical\_trades (Historical Data)

The /trade/historical\_trades/ticker\_id endpoint is used to return data on historical completed trades for a given market pair.

Endpoint parameters:

<table><thead><tr><th width="180">Name</th><th width="130">Data Type</th><th width="130">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td>ticker_id</td><td>string</td><td>Yes</td><td>A pair such as "BTC_ETH", with delimiter between different cryptoassets</td></tr><tr><td>type</td><td>string</td><td>No</td><td>To indicate nature of trade - buy/sell</td></tr><tr><td>limit</td><td>integer</td><td>No</td><td>Number of historical trades to retrieve from time of query. [0, 200, 500...]. 0 returns full history.</td></tr><tr><td>start_time</td><td>date</td><td>No</td><td>Start time from which to query historical trades from</td></tr><tr><td>end_time</td><td>date</td><td>No</td><td>End time for historical trades query</td></tr></tbody></table>

Example query: <https://api.rujira.network/api/trade/historical_trades?ticker_id=BTC_USDC&limit=10>

| Example response                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\[</p><p>  {</p><p>    "trade\_id": 21230,</p><p>    "price": "116659.0",</p><p>    "base\_volume": "0.00128579",</p><p>    "target\_volume": "150",</p><p>    "trade\_timestamp": 1754571399738,</p><p>    "type": "buy"</p><p>  },</p><p>  {</p><p>    "trade\_id": 21101,</p><p>    "price": "115271.58095761736",</p><p>    "base\_volume": "0.00000868",</p><p>    "target\_volume": "1",</p><p>    "trade\_timestamp": 1754546289060,</p><p>    "type": "sell"</p><p>  }</p><p>]</p> |

/trade/historical\_trades response descriptions:

<table><thead><tr><th width="180">Name</th><th width="180">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>trade_id</td><td>integer</td><td>A unique ID associated with the trade for the currency pair transaction</td></tr><tr><td>price</td><td>decimal</td><td>Transaction price of base asset in target currency.</td></tr><tr><td>base_volume</td><td>decimal</td><td>Transaction amount in base pair volume.</td></tr><tr><td>target_volume</td><td>decimal</td><td>Transaction amount in target pair volume.</td></tr><tr><td>trade_timestamp</td><td>timestamp</td><td>Unix timestamp in milliseconds for when the transaction occurred.</td></tr><tr><td>type</td><td>string</td><td><p>Used to determine the type of the transaction that was completed.</p><p>Buy – Identifies an ask that was removed from the order book.</p><p>Sell – Identifies a bid that was removed from the order book.</p></td></tr></tbody></table>

### RUJI Token Supply

The /ruji/\* endpoints are used to return data on the RUJI token supply.

<table><thead><tr><th width="60">No.</th><th width="220">Endpoint</th><th>Description</th></tr></thead><tbody><tr><td>1.</td><td>/ruji/holders</td><td>Top 100 wallets/holders of the RUJI token.</td></tr><tr><td>2.</td><td>/ruji/total_supply</td><td>Total RUJI supply.</td></tr><tr><td>3.</td><td>/ruji/circulating_supply</td><td>Current RUJI circulating supply. Calculated as total supply minus currently vesting supply.</td></tr></tbody></table>

Example query: <https://api.rujira.network/api/ruji/holders>
