API
Public API
All requests go over https protocol, The field 'contentType' in request header should be: 'application/x-www-form-urlencoded'. The root url is: https://api.bithumbsg.com/public In case of any problem, please contact our support team.
Please note that making more than 10 calls per second to the public API, or repeatedly and needlessly fetching excessive amounts of data, can result in your IP being banned. There are public methods, all of which take HTTP GET requests and return output in JSON format:
ticker
Returns the ticker for all markets. Sample output:
{
"market":
{
"BTC_ETH":
{
"last": "0.03752222",
"ask": "0.03760001",
"bid": "0.03660009",
"percentChange": "2.52",
"volume24h": "1345.12000000"
},
"BTC_ETC":
{...},
"BTC_LTC":
{...}
}
}
Call: https://api.bithumbsg.com/public/ticker
orderBook
Returns the buy/sell order for all markets, buy/sell:[price,amount,total] Sample output:
{
"BTC_ETH":
{
"buy":
[
[0.03199998,129.99,4.15999739],
[0.03129998,77.12458475,2.41399796],
[0.03,200,6]
],
"sell":
[
[0.032,170.99,12.8],
[0.041,74.98,3.07418],
[0.0415,10,0.415],
[0.08,500,40],
[0.1,1011,101.1]
]
},
"BTC_LTC":
{...}
}
Call: https://api.bithumbsg.com/public/orderbook
tradeHistory
Returns the past 20 trades for a given market Sample output:
{
"BTC_ETH":
[
[179339,"sell",0.03199998,0.01,"2017-08-14 02:22:09",0.00032],
[179338,"buy",0.032,0.01,"2017-08-14 02:21:48",0.00032],
[179337,"buy",0.032,0.01,"2017-08-14 02:21:42",0.00032],
[179336,"buy",0.032,0.01,"2017-08-14 02:21:37",0.00032]
],
"BTC_LTC":
[
...
]
}
Call: https://api.bithumbsg.com/public/tradehistory
Private API
General API Information
- The base endpoint is: https://api.bithumbsg.com/private
- All endpoints return either a JSON object or array.
- For `POST`, `PUT`, and `DELETE` endpoints, the parameters may be sent as a `query string` or in the `request body` with content type `application/x-www-form-urlencoded`. You may mix parameters between both the `query string` and `request body` if you wish to do so.
- Parameters may be sent in any order.
- If a parameter sent in both the `query string` and `request body`, the `query string` parameter will be used.
Endpoint security type
- Each endpoint has a security type that determines the how you will interact with it.
- API-keys are passed into the Rest API via the `X-BITHUMBSG-API` header.
- API-keys and secret-keys are case sensitive.
- API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes.
- By default, API-keys can access all secure routes.
- `TRADE` and `USER_DATA` endpoints are `SIGNED` endpoints.
SIGNED (TRADE and USER_DATA) Endpoint security
- `SIGNED` endpoints require an additional parameter, `X-BITHUMBSG-SECRET`, to be sent in the `Header`.
- Endpoints use `HMAC SHA256` signatures. The `HMAC SHA256 X-BITHUMBSG-SECRET` is a keyed `HMAC SHA256` operation.
- The `X-BITHUMBSG-SECRET` is not case sensitive.
SIGNED Endpoint Examples for POST /private/order/{pairs}
Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using `echo`, `openssl`, and `curl`.
917652802465165e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
Example 1: As a query string
- queryString: symbol=qtum_btc
- HMAC SHA256 signature:
- curl command:
[linux]$ echo -n "symbol=qtum_btc" | openssl dgst -sha256 -hmac "933c83b1514543a7c98e4d18ef6227db4ad8a6ad0d781136da6e7bd77312adfd9.917652802465165e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
(stdin)= 5a7a04dd34108f0885eaf4e03592caab907e1fbac1c6ce4db92689851a16491b
(HMAC SHA256)
[linux]$ curl -X GET \
'https://api.bithumbsg.com/private/balances?symbol=qtum_btc' \
-H 'X-BITHUMBSG-API: c6b185f35ea09f0168bc3374df63737e' \
-H 'X-BITHUMBSG-SECRET: 5a7a04dd34108f0885eaf4e03592caab907e1fbac1c6ce4db92689851a16491b'
Example 2: As a request body
- requestBody: type=buy&price=1.00000&amount=1.00000000
- HMAC SHA256 signature:
- curl command:
[linux]$ echo -n "type=buy&price=1.00000&amount=1.00000000" | openssl dgst -sha256 -hmac "933c83b1514543a7c98e4d18ef6227db4ad8a6ad0d781136da6e7bd77312adfd9.
917652802465165e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
(stdin)= f3c45c8858b54ee633914d45ee38171b9d97c5fd903c4965dd7af55261f9faca
(HMAC SHA256)
[linux]$ curl -X POST \
https://api.bithumbsg.com/private/order/btc-qtum \
-H 'X-BITHUMBSG-API: c6b185f35ea09f0168bc3374df63737e' \
-H 'X-BITHUMBSG-SECRET: f3c45c8858b54ee633914d45ee38171b9d97c5fd903c4965dd7af55261f9faca' \
-F type=buy \
-F price=1.00000 \
-F amount=1.00000000
Private API End point
Get current balances (USER_DATA)
GET /private/balances (HMAC SHA256)
Get current balances.
Parameters:
Response:
{
"data": {
"qtum": {
"unit": "qtum",
"trade": "230.14094719",
"withdrawal": "0.00000000",
"available": "999590.67375618"
},
"btc": {
"unit": "btc",
"trade": "0.44064877",
"withdrawal": "0.00000000",
"available": "999999.47896251"
}
}
}
Register your order (TRADE)
POST /private/order/{pairs} (HMAC SHA256)
Register your order.
Parameters:
Notes:
- Either `type` or `price` or `amount` must be sent.
Response:
{
"orderId": "58461",
"price": "1.00000",
"amount": "1.00000000",
"total": "1.00000000",
"time": 1554018564.829608,
"isTaker": false
}
Cancel order (TRADE)
POST /private/cancel/{pairs}
Cancel the registered order.
Parameters:
Notes:
- `orderId` must be sent.
Response:
{
"orderId": 58461,
"delete": true
}
Get your open orders (USER_DATA)
GET /private/openOrders (HMAC SHA256)
Get your open orders.
Parameters:
Notes:
- `symbol` must be sent.
Response:
[
{
"id": "466",
"type": "Buy",
"status": "REQ",
"price": "1744.97294",
"amount": "0.14255421",
"filledAmount": "0.00000000"
}
]
Get your completed order (USER_DATA)
GET /private/tradeHistories (HMAC SHA256)
Get your completed order.
Parameters:
Notes:
- `symbol` must be sent.
Response:
[
{
"type": "Sell",
"status": "OK",
"filledAmount": "0.57135842",
"avgPrice": "1744.97293",
"total": "997.00498193"
},
{
"type": "Sell",
"status": "OK",
"filledAmount": "0.57250228",
"avgPrice": "1744.97293",
"total": "999.00098667"
}
]
Get your balance History (USER_DATA)
GET /private/balanceHistories (HMAC SHA256)
Get your balance History.
Parameters:
Notes:
- `type` must be sent.
Response:
[
{
"id": "9",
"type": "withdrawals",
"coin": "qtum",
"amount": "6.00000000",
"is_pay": "N",
"timestamp": "2019-02-13 09:47:26.725403"
}
]