connect with support.
CONTACT SUPPORT

CHAINEX API

OVERVIEW

ChainEX API offers a simple and more standardized REST API to make full use of our site functionality. The standard API responses are JSON encoded arrays and we support GET, POST and DELETE requests. Please be aware that calls to the API are rate limited to 10 requests per second, any requests exceeding this rate will be met with a HTTP 503 response.

API REFERENCE

Market
  1. Market Summary
  2. Market Stats
  3. Market Trades
  4. Market Orders
  5. Market Chart Data
Wallet
  1. Wallet Balances
  2. Wallet Deposits
  3. Wallet Deposit Address
  4. Wallet New Deposit Address
  5. Wallet Withdrawals
  6. Wallet Single Withdrawal
  7. Wallet Request Withdrawal
  8. Wallet Cancel Withdrawal
Trading
  1. Trading Orders
  2. Trading Single Order
  3. Trading Add Order
  4. Trading Cancel Order
  5. Trading Trades
  6. Trading Single Trade
Sample Code
  1. PHP

AUTHENTICATION

All requests to the Wallet and Trading methods require authentication via a public and private API key pair. An authenticated API request must contain the following three items.



ParameterDescription
keyYour public API Key.
timeCurrent unix timestamp (your requesting device MUST keep accurate time).
hashHMAC-SHA-256 hash of the full URL and request data, including the public key and timestamp.

IMPORTANT: The unix timestamp included in the API calls must be accurate to within 5 seconds, any requests received with a timestamp outside of this window will be rejected to aid in the prevention of replay attacks. You can call the following method https://api.chainex.io/timestamp to get our current server time.

Authenticated Example
GET
https://api.chainex.io/wallet/balances/?key=1239[...]55ac8&time=1396560131&hash=b5c45e[...]f5375c

The hash value is a HMAC-SHA-256 hash of the full url e.g. https://api.chainex.io/wallet/balances/?key=1239[...]55ac8&time=1396560131. The same method applies for POST requests.

Response

{
"status":"success",
"count":42,
"data":[{
"code":"LTC",
"name":"Litecoin",
"balance_available":"2.00000000",
"balance_pending_deposit":"0.00000000",
"balance_pending_withdraw":"0.00000000",
"balance_held":"6.50000000"
},
...
]
}

API RESPONSE

The response from the API is standard with a status field that shows if the request was successful or not. Based on this, there will be a data field that holds the data as an array if successful, a count field if fetching more than one item and/or a message field that holds the success/error message.



Example successful response:

{
"status":"success",
"count":42,
"data":[{...}]
}

Example error response:

{
"status":"error",
"message":"The coin code does not exist."
}

MARKET METHODS

All markets methods are public and do not require authentication.

Market Summary

GET
https://api.chainex.io/market/summary/

Provides an overview of all our markets. Data refreshes every minute.

GET
https://api.chainex.io/market/summary/{EXCHANGE}

Provides an overview of only BTC or LTC markets. Data refreshes every minute.
Example: https://api.chainex.io/market/summary/BTC

Response

{
"status":"success",
"count":42,
"data":[{
"code":"LTC",
"exchange":"BTC",
"last_price":"0.04600001",
"yesterday_price":"0.04300000",
"change":"+6.98",
"24hhigh":"0.04980000",
"24hlow":"0.04000050",
"24hvol":"21.737"
"top_bid":"0.04590000"
"top_ask":"0.04600005"
},
...
]
}

NOTE: Yesterday price refers to what the price was midnight UTC.

Market Stats

GET
https://api.chainex.io/market/stats/{COIN}/{EXCHANGE}

Provides the statistics for a single market. Data refreshes every minute.
Example: https://api.chainex.io/market/stats/LTC/BTC

Response

{
"status":"success",
"data":{
"code":"LTC",
"exchange":"BTC",
"last_price":"0.04600001",
"yesterday_price":"0.04300000",
"change":"+6.98",
"24hhigh":"0.04980000",
"24hlow":"0.04000050",
"24hvol":"21.737"
"top_bid":"0.04590000"
"top_ask":"0.04600005"
}
}

NOTE: Yesterday price refers to what the price was midnight UTC.

Market Trades

GET
https://api.chainex.io/market/trades/{COIN}/{EXCHANGE}

Fetches the last 100 trades for a given market.
Example: https://api.chainex.io/market/trades/LTC/BTC

GET
https://api.chainex.io/market/trades/{COIN}/{EXCHANGE}/{LIMIT}

Fetches the specified number of trades for a given market, maximum limit is 200.
Example: https://api.chainex.io/market/trades/LTC/BTC/150

Response

{
"status":"success",
"count":100,
"data":[{
"type":"SELL",
"price":"0.00000023",
"amount":"412128.80177019",
"total":"0.09478962",
"time":"1394498289.2727"
},
...
]
}

NOTE: Time is specified as a unix timestamp with microseconds.

Market Orders

Single Type

GET
https://api.chainex.io/market/orders/{COIN}/{EXCHANGE}/{TYPE}

Fetches the 50 best priced orders of a given type for a given market, where {TYPE} can be either BUY or SELL.
Example: https://api.chainex.io/market/orders/LTC/BTC/BUY

GET
https://api.chainex.io/market/orders/{COIN}/{EXCHANGE}/{TYPE}/{LIMIT}

Fetches the specified number of best priced orders of a given type for a given market, where {TYPE} can be either BUY or SELL, maximum limit is 200.
Example: https://api.chainex.io/market/orders/LTC/BTC/BUY/150

Response

{
"status":"success",
"count":23,
"data":[{
"price":"0.00000023",
"amount":"22446985.14519785",
"total":"5.16280655"
},
...
]
}

Combined

GET
https://api.chainex.io/market/orders/{COIN}/{EXCHANGE}/ALL

Fetches the 50 best priced buy and sell orders together for a given market.
Example: https://api.chainex.io/market/orders/LTC/BTC/ALL

GET
https://api.chainex.io/market/orders/{COIN}/{EXCHANGE}/ALL/{LIMIT}

Fetches the specified number of best priced buy and sell orders together for a given market, maximum limit is 200 for each type.
Example: https://api.chainex.io/market/orders/LTC/BTC/ALL/150

Response

{
"status":"success",
"data":[{
"type":"buy",
"count":23,
"orders":[{
"price":"0.00000023",
"amount":"22446985.14519785",
"total":"5.16280655"
},
...
]},{
"type":"sell",
"count":150,
"orders":[{
"price":"0.00000024",
"amount":"1000000.00000000",
"total":"0.24000000"
},
...
]}
}]
}
Market Chart Data
GET
https://api.chainex.io/market/chartdata/{COIN}/{EXCHANGE}/{PERIOD}

Fetches the chart data that we use for our candlestick graphs for a market for a given time period. The period is an optional parameter and can be either '6hh' (6 hours), '1DD' (24 hours), '3DD' (3 days), '7DD' (1 week) or 'MAX'. If no period is defined, it will default to 6 hours.
Example: https://api.chainex.io/market/chartdata/LTC/BTC/1DD

Response

{
"status":"success",
"count":144,
"data":[{
"date":"2017-02-09 14:20",
"open":"0.00000006",
"close":"0.00000006",
"high":"0.00000006",
"low":"0.00000003",
"exchange_volume":"0.00002145",
"coin_volume":"608.50000000"
},
...
]
}

WALLET METHODS

All wallet methods require authentication.

Wallet Balances
GET
https://api.chainex.io/wallet/balances/

Fetches all the balances in your account, split down into available balance, pending deposits, pending withdrawals and held for orders.

GET
https://api.chainex.io/wallet/balances/{COIN}

Fetches the balance for a specific coin, split down into available balance, pending deposits, pending withdrawals and held for orders.
Example: https://api.chainex.io/wallet/balances/BTC

Response

{
"status":"success",
"count":42,
"data":[{
"code":"LTC",
"name":"Litecoin",
"balance_available":"2.00000000",
"balance_pending_deposit":"0.00000000",
"balance_pending_withdraw":"0.00000000",
"balance_held":"6.50000000"
},
...
]
}
Wallet Deposits
GET
https://api.chainex.io/wallet/deposits/

Fetches the deposits made in to your account, including pending and confirmed deposits, ordered by most recent first and limited to 25 results.

GET
https://api.chainex.io/wallet/deposits/{COIN}

Fetches the deposits made in to your account for a specific coin, including pending and confirmed deposits, ordered by most recent first and limited to 25 results.
Example: https://api.chainex.io/wallet/deposits/BTC

GET
https://api.chainex.io/wallet/deposits/{COIN}/{START}/{LIMIT}

By default, the method will fetch 25 results. Use the start and limit parameters to fetch more results. Use ALL for the coin if you want to fetch more results for all coins. The maximum limit is 200 entries.
Example: https://api.chainex.io/wallet/deposits/ALL/25/50 fetches the 26th to 75th items.

Response

{
"status":"success",
"count":25,
"data":[{
"code":"ETH",
"address":"0x81d792DF9966daFf0dcE2c7fB98680801eB0f971",
"coin_network": null,
"network_name": "Ethereum Goerli",
"amount": "1.00000000",
"time": "1739274681",
"email_confirm": "0",
"time_formatted": "2025-02-11 11:51:21",
"status": "UNCONFIRMED",
"reason": "Please confirm the withdrawal by email."
},
...
]
}
Wallet Deposit Address
GET
https://api.chainex.io/wallet/depositaddress/{COIN}

Fetches the deposit address for the specified coin.

Response

{
"status":"success",
"data":"1234567890AbCdEfGhIjKlMnOpQrStUvWxYz"
}
Wallet New Deposit Address
GET
https://api.chainex.io/wallet/newdepositaddress/{COIN}

Fetches a new deposit address for the specified coin.

Response

{
"status":"success",
"data":"1234567890AbCdEfGhIjKlMnOpQrStUvWxYz"
}
Wallet Withdrawals
GET
https://api.chainex.io/wallet/withdrawals/

Fetches the withdrawals made from your account, including pending and completed withdrawals, ordered by most recent first and limited to 25 results.

GET
https://api.chainex.io/wallet/withdrawals/{COIN}

Fetches the withdrawals made from your account for a specific coin, including pending and completed withdrawals, ordered by most recent first and limited to 25 results.
Example: https://api.chainex.io/wallet/withdrawals/BTC

GET
https://api.chainex.io/wallet/withdrawals/{COIN}/{START}/{LIMIT}

By default, the method will fetch 25 results. Use the start and limit parameters to fetch more results. Use ALL for the coin if you want to fetch more results for all coins. The maximum limit is 200 entries.
Example: https://api.chainex.io/wallet/withdrawals/ALL/25/50 fetches the 26th to 75th items.

Response

{
"status":"success",
"count":25,
"data":[{
"code":"ETH",
"address":"0x81d792DF9966daFf0dcE2c7fB98680801eB0f971",
"coin_network": null,
"network_name": "Ethereum Goerli",
"amount": "1.00000000",
"time": "1739274681",
"email_confirm": "0",
"time_formatted": "2025-02-11 11:51:21",
"status": "UNCONFIRMED",
"reason": "Please confirm the withdrawal by email."
},
...
]
}
Wallet Single Withdrawal
GET
https://api.chainex.io/wallet/withdrawal/{ID}

Fetches the details of a single withdrawal identified by the withdrawal ID.

Response

{
"status":"success",
"count":25,
"data":[{
"code":"ETH",
"address":"0x81d792DF9966daFf0dcE2c7fB98680801eB0f971",
"coin_network": null,
"network_name": "Ethereum Goerli",
"amount": "1.00000000",
"time": "1739274681",
"email_confirm": "0",
"time_formatted": "2025-02-11 11:51:21",
"status": "UNCONFIRMED",
"reason": "Please confirm the withdrawal by email."
},
...
]
}
Wallet Request Withdrawal
POST
https://api.chainex.io/wallet/withdraw/{COIN}

Submits a withdrawal request, requires email confirmation to process.

Parameters

NameTypeRequiredDescription
addressStringYesThe address you wish to withdraw to.
amountDecimalYesThe amount you wish to withdraw, up to 8 decimals. Remember that a withdrawal fee will be applied to this amount.
beneficiaryStringYesThe full name of the person or entity receiving the funds. Required if using a new address or an address that does not have an existing beneficiary.
destinationStringYesThe name of the platform or wallet where the funds will be sent (e.g., "OKX", "Binance"). If the destination is a personal wallet, use "private" — it will be internally recorded as "Self Custody Wallet". Required if using a new address or an address that does not have an existing destination.
payment_idStringNoAn optional Payment ID to include with your withdrawal. This is only used for coins based on the CryptoNote protocol such as Monero.

Response

{
"status":"success",
"message":"Your withdrawal request has now been added, please confirm by email and we will then process it.",
"data":{
"code":"BTC",
"address":"1234567890AbCdEfGhIjKlMnOpQrStUvWxYz",
"amount":"0.06600000",
"fee":"0.00020000",
"txid":"2c6f31555b5309293f0f83a38703ef7fa74c163155642d3fe53c9cc488bf35eg",
"time":"1393776944",
"pending":"0",
"time_formatted":"2017-03-20 19:50:39"
"status":"UNCONFIRMED",
"reason":"Please confirm the withdrawal by email."
}
}
Wallet Cancel Withdrawal
DELETE
https://api.chainex.io/wallet/withdraw/{ID}

Cancels a withdrawal request identified by the withdrawal ID, can only cancel unconfirmed and unsuccessful withdrawals.

Response

{
"status":"success",
"message":"The pending withdrawal has successfully been cancelled and the balance made available again."
}

TRADING METHODS

All trading methods require authentication.

Trading Orders
GET
https://api.chainex.io/trading/orders/

Fetches the current open orders in your account, ordered by most recent first and limited to 25 results.

GET
https://api.chainex.io/trading/orders/{COIN}

Fetches the current open orders in your account for a specified coin, ordered by most recent first and limited to 25 results.
Example: https://api.chainex.io/trading/orders/BTC

GET
https://api.chainex.io/trading/orders/{COIN}/{START}/{LIMIT}

By default, the method will fetch 25 results. Use the start and limit parameters to fetch more results. Use ALL for the coin if you want to fetch more results for all coins/markets. The maximum limit is 200 entries.
Example: https://api.chainex.io/trading/orders/ALL/25/50 fetches the 26th to 75th items.

Response

{
"status":"success",
"count":25,
"data":[{
"order_id":"YFHG-12345678",
"market":"LTC\/BTC",
"type":"BUY",
"price":"0.00000015",
"amount":"500.00000000",
"total":"0.00007500",
"fee":"0.00000011",
"net_total":"0.00007511",
"time":"1393776944.1234",
"time_formatted":"2017-03-20 19:50:39"
},
...
]
}
Trading Single Order
GET
https://api.chainex.io/trading/order/{ID}

Fetches the order identified by the order ID.

Response

{
"status":"success",
"data":{
"order_id":"YFHG-12345678",
"market":"LTC\/BTC",
"type":"BUY",
"price":"0.00000015",
"amount":"500.00000000",
"total":"0.00007500",
"fee":"0.00000011",
"net_total":"0.00007511",
"time":"1393776944.1234",
"time_formatted":"2017-03-20 19:50:39"
}
}
Trading Add Order
POST
https://api.chainex.io/trading/order/

Submits a new order to market.

Parameters

NameTypeRequiredDescription
coinStringYesThe first half of the market, e.g. if want to add order to LTC/BTC, enter LTC.
exchangeStringYesThe second half of the market, e.g. if want to add order to LTC/BTC, enter BTC.
priceDecimalYesThe price of the order, up to 8 decimals.
amountDecimalYesThe amount of coins you wish to purchase or sell, up to 8 decimals.
typeIntegerYesIf the order is a BUY (0) or a SELL (1).
post_onlybooleanNoAn order will only be placed if it does not match against an existing order in the order book, i.e. it will only be placed as a Maker Order

Response

{
"status":"success",
"message":"The order has successfully gone to market.",
"data":{
"order_id":"YFHG-12345678",
"market":"LTC/BTC",
"type":"BUY",
"price":"0.00000015",
"amount":"500.00000000",
"total":"0.00007500",
"fee":"0.00000011",
"net_total":"0.00007511",
"time":"1393776944.1234",
"time_formatted":"2017-03-20 19:50:39"
}
}
Trading Cancel Order
DELETE
https://api.chainex.io/trading/order/{ID}

Cancels an open order identified by the order ID. Warning: order cancellations are processed FIFO (First In First Out) alongside new orders, so it may be matched before the cancellation can be processed.

Response

{
"status":"success",
"message":"The pending withdrawal has successfully been cancelled and the balance made available again."
}
Trading Trades
GET
https://api.chainex.io/trading/trades/

Fetches the trades made in your account, ordered by most recent first and limited to 25 results.

GET
https://api.chainex.io/trading/trades/{COIN}

Fetches the trades made in your account for a specific coin, including BTC and LTC markets where applicable, ordered by most recent first and limited to 25 results.
Example: https://api.chainex.io/trading/trades/BTC

GET
https://api.chainex.io/trading/trades/{COIN}/{START}/{LIMIT}

By default, the method will fetch 25 results. Use the start and limit parameters to fetch more results. Use ALL for the coin if you want to fetch more results for all coins/markets. The maximum limit is 200 entries.
Example: https://api.chainex.io/trading/trades/ALL/25/50 fetches the 26th to 75th items.

Response

{
"status":"success",
"count":25,
"data":[{
"trade_id":"YFHG-12345678",
"market":"LTC\/BTC",
"type":"BUY",
"time":"1393776944.1234",
"price":"0.00000015",
"amount":"500.00000000",
"total":"0.00007500",
"fee":"0.00000011",
"net_total":"0.00007511",
"order_id":"ONYC-12345678",
"time_formatted":"2017-03-20 19:50:39"
},
...
]
}
Trading Single Trade
GET
https://api.chainex.io/trading/trade/{ID}

Fetches the trade identified by the trade ID.

Response

{
"status":"success",
"data":[{
"trade_id":"YFHG-12345678",
"market":"LTC\/BTC",
"type":"BUY",
"time":"1393776944.1234",
"price":"0.00000015",
"amount":"500.00000000",
"total":"0.00007500",
"fee":"0.00000011",
"net_total":"0.00007511",
"order_id":"ONYC-12345678",
"time_formatted":"2017-03-20 19:50:39"
}
}

SAMPLE CODE

You are free to use and modify all of the below API sample code.

PHP
<?php

  // Get balances
  $response = _doAPICall('wallet/balances');

  // Test a withdraw
  //$response = _doAPICall('wallet/withdraw/BTC', array('address' => "123456789", 'amount' => '10'), 'POST');

  // Delete an order
  //$response = _doAPICall('trading/order/KMTA-12345678', array(), 'DELETE');

  // Interfaces with the ChainEX API via cURL. Function handles, GET, POST & DELETE
  //
  // @param   string  $apiCall  The API function that we want to use
  // @param   array   $data     The data for the API function parameters
  // @param   string  $method   If we're using GET, POST or DELETE, uses GET by default
  // @return  array

  function _doAPICall($apiCall, $data = array(), $method = 'GET')
  {

    // Setup public & private keys
    $apiPublicKey = "123931eeb6baadd53cbdbc755ac81cfd";
    $apiPrivateKey = "6546d5e0692d7d5dfd84c1a25ea9d7";

    // Setup URL
    $apiUrl = "https://api.chainex.io/";

    // Set time to variable so it's definitely constant
    $time = time();

    // Start cURL
    $c = curl_init();
    curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);

    // Check what type of API call we are making
    if ($method == 'GET') {

      // Start building the URL
      $apiCall = $apiUrl . $apiCall . "?time=" . $time . "&key=" . $apiPublicKey;

      // Add the array of data to the URL
      if (count($data)) {
        $apiCall .= "&".http_build_query($data);
      }

      // Hash the data
      $hash = hash_hmac("sha256", $apiCall, $apiPrivateKey);

      // Append the hash
      $apiCall .= "&hash=" . $hash;

      // Setup the remainder of the cURL request
      curl_setopt($c, CURLOPT_URL, $apiCall);

    } else if ($method == 'DELETE') {

      // DELETE requests use POSTFIELDS, so add the time and hash
      $data['time'] = $time;
      $data['key'] = $apiPublicKey;

      // Hash the data
      $data['hash'] = hash_hmac("sha256", $apiUrl . $apiCall . "?" . http_build_query($data), $apiPrivateKey);

      // Setup the remainder of the cURL request
      curl_setopt($c, CURLOPT_URL, $apiUrl . $apiCall);
      curl_setopt($c, CURLOPT_POSTFIELDS, http_build_query($data));
      curl_setopt($c, CURLOPT_HTTPHEADER, array('X-HTTP-Method-Override: ' . $method));

    } else {

      // It's a POST request, so add in some additional data
      $data['time'] = $time;
      $data['key'] = $apiPublicKey;

      // Hash the data
      $data['hash'] = hash_hmac("sha256", $apiUrl . $apiCall . "?" . http_build_query($data), $apiPrivateKey);

      // Setup the remainder of the cURL request
      curl_setopt($c, CURLOPT_URL, $apiUrl . $apiCall);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, http_build_query($data));

    }

    // Execute the API call and return the response
    $result = curl_exec($c);
    curl_close($c);

    // Return the results of the API call
    return json_decode($result);

  }

?>