Introduction
Welcome to Coinzo trader and developer documentation.
APIs are separated into two categories: Private and Public. Private APIs require authentication and provide access to placing orders and other account information. Public APIs provide market data.
API
The REST API has endpoints for account and order management as well as public market data.
Rest API Endpoint URL
https://api.coinzo.com
Requests
All requests and responses are application/json content type and follow typical HTTP response status codes for success and failure.
Pagination
Coinzo uses pagination for all REST requests which return arrays.
Parameters
Parameter | Default | Description |
---|---|---|
page | 1 | Requested page |
limit | 100 | Rows per page |
Errors
Status Code | Reason |
---|---|
401 | Unauthorized – Invalid API Key |
403 | Forbidden - You do not have access to the requested resource |
404 | Not Found |
422 | Unprocessable Entity - One or more fields couldn't pass request validation |
429 | Too Many Requests - You're sending too many requests! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
Rate Limits
When a rate limit is exceeded, a status of 429 Too Many Requests will be returned.
PUBLIC ENDPOINTS
We throttle public endpoints by IP: 3 requests per second.
PRIVATE ENDPOINTS
We throttle private endpoints by user ID: 5 requests per second.
Private
Private endpoints are available for trading and withdrawal. Every private request must be signed using the described authentication scheme.
Authentication
Creating a Request
All private REST requests must contain the following headers:
- X-CNZ-APIKEY The api key as a string.
- X-CNZ-PAYLOAD The base64-encoded request body.
- X-CNZ-SIGNATURE The base64-encoded signature (see Signing a Message).
Signing A Message
const request = require('request')
const crypto = require('crypto')
const API_KEY = 'YOUR API KEY'
const API_SECRET = 'YOUR API SECRET'
function doRequest(endpoint, body, callback) {
let payload = new Buffer(JSON.stringify(body)).toString('base64')
let signature = crypto
.createHmac('sha384', API_SECRET)
.update(payload)
.digest('base64')
const options = {
url: endpoint,
headers: {
'Content-Type': 'application/json',
'X-CNZ-APIKEY': API_KEY,
'X-CNZ-PAYLOAD': payload,
'X-CNZ-SIGNATURE': signature
}
}
return request.post(options, callback)
}
doRequest(
'https://api.coinzo.com/order/new',
{
nonce: Date.now(),
pair: 'BTC-TRY',
type: 'LIMIT',
side: 'BUY',
limitPrice: '30000',
amount: '1'
},
function(error, response, body) {
// Do something clever!!
}
)
package main
import (
"crypto/hmac"
"crypto/sha512"
"encoding/base64"
"net/http"
"encoding/json"
"io/ioutil"
"log"
"time"
)
const APIKEY = "YOUR API KEY"
const APISECRET = "YOUR API SECRET"
func DoRequest(endpoint string, body map[string]interface{}) (int, []byte, error) {
jsonEncode, err := json.Marshal(body)
if err != nil {
return 0, nil, err
}
payload := base64.StdEncoding.EncodeToString(jsonEncode)
request, _ := http.NewRequest(
"POST",
endpoint,
nil,
)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("X-CNZ-APIKEY", APIKEY)
request.Header.Set("X-CNZ-PAYLOAD", payload)
request.Header.Set("X-CNZ-SIGNATURE", signRequest(payload))
response, err := http.DefaultClient.Do(request)
if err != nil {
return 0, nil, err
}
defer response.Body.Close()
responseBody, _ := ioutil.ReadAll(response.Body)
return response.StatusCode, responseBody, nil
}
func signRequest(payload string) string {
sig := hmac.New(sha512.New384, []byte(APISECRET))
sig.Write([]byte(payload))
return base64.StdEncoding.EncodeToString(sig.Sum(nil))
}
func main() {
log.Println(
DoRequest(
"https://api.coinzo.com/order/new",
map[string]interface{}{
"nonce": time.Now().Unix(),
"pair": "BTC-TRY",
"type": "LIMIT",
"side": "BUY",
"limitPrice": "30000",
"amount": "1",
},
),
)
}
<?php
class Coinzo
{
private $key;
private $secret;
public function __construct($key, $secret)
{
$this->key = $key;
$this->secret = $secret;
}
public function doRequest($endpoint, $body)
{
$payload = base64_encode(json_encode($body));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"X-CNZ-APIKEY: {$this->key}",
"X-CNZ-PAYLOAD: {$payload}",
"X-CNZ-SIGNATURE: {$this->sign($payload)}",
]);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
private function sign($payload)
{
return base64_encode(hash_hmac("sha384", $payload, $this->secret, true));
}
}
$cnz = new Coinzo("YOUR API KEY", "YOUR API SECRET");
var_dump($cnz->doRequest("https://api.coinzo.com/order/new", [
"nonce" => time(),
"pair" => "BTC-TRY",
"type" => "LIMIT",
"side" => "BUY",
"limitPrice" => "30000",
"amount" => "1",
]));
The authentication procedure is as follows:
For successful authentication you need to send a nonce with incremental numeric value for each request.
The payload is the parameters object, first JSON encoded, and then encoded into base64
The signature is the base64 digest of an HMAC-SHA384 hash where the message is your payload, and the secret key is your API secret.
Info
Usage
{
"fee": {
"maker": 0.0015,
"taker": 0.003
},
"usage": {
"daily_liquidity": 0,
"daily_liquidity_limit": 100000,
"monthly_liquidity": 0,
"monthly_liquidity_limit": 1000000
},
"volume": {
"total": 0,
"updated_at": 1529669170
}
}
Get account fee, liquidity usage and volume info
HTTP Request
GET /usage
Balances
[
{
"asset": "TRY",
"total": 99329.6995,
"available": 99329.6995
},
{
"asset": "BTC",
"total": 99.9832,
"available": 99.9832
}
]
Get account balances
HTTP Request
GET /balances
Orders
Place a New Order
{
"id": "358887488509116421"
}
Submit a new order
HTTP Request
POST /order/new
Param | Description |
---|---|
pair | A valid pair |
type | Type of order (LIMIT, MARKET, STOP OR STOP LIMIT) |
side | BUY or SELL |
limitPrice | Price of per coin that you buy or sell |
stopPrice | [Optinal] Stop price for stop and stop limit orders |
amount | Amount of coin to buy or sell |
Get Order Status
{
"id": "358887488509116421",
"pair": "BTC-TRY",
"side": "SELL",
"type": "LIMIT",
"limit_price": 30000,
"stop_price": 0,
"original_amount": 1,
"executed_amount": 0,
"remaining_amount": 1,
"active": true,
"cancelled": false,
"updated_at": 1529669170
}
Get status of order
HTTP Request
GET /order
Param | Description |
---|---|
id | The ID of order to get status |
Cancel an Order
Cancel a previously placed order
HTTP Request
DELETE /order
Param | Description |
---|---|
id | The ID of the order to delete |
Cancel All Orders
Cancel all open orders
HTTP Request
DELETE /orders
List Orders
[
{
"id": "359420493762035717",
"pair": "BTC-TRY",
"side": "SELL",
"type": "LIMIT",
"limit_price": 31000,
"stop_price": 0,
"original_amount": 1,
"executed_amount": 0,
"remaining_amount": 1,
"active": true,
"cancelled": false,
"updated_at": 1529669170
},
{
"id": "359420489131851781",
"pair": "BTC-TRY",
"side": "SELL",
"type": "LIMIT",
"limit_price": 30000,
"stop_price": 0,
"original_amount": 1,
"executed_amount": 0,
"remaining_amount": 1,
"active": true,
"cancelled": false,
"updated_at": 1529669170
}
]
List your current open orders. Only open or un-settled orders are returned. As soon as an order is no longer open and settled, it will no longer appear in the default request.
HTTP Request
GET /orders
Fills
List Fills
[
{
"id": "359425123038658565",
"order_id": "359425122996846597",
"coin": "BTC",
"fiat": "TRY",
"side": "SELL",
"price": 30000,
"amount": 0.1,
"taker": true,
"fee": 9,
"created_at": 1529758242
}
]
Get a list of recent fills.
HTTP Request
GET /fills
Deposits
Show Deposit Address
{
"asset": "XRP",
"address": "rDQGVYCKC3StBmJV6my9uL1Dn9q7TzEGqS",
"tag": "226920833"
}
Show deposit address for asset
HTTP Request
GET /deposit/address
Param | Description |
---|---|
asset | A valid asset |
List Deposits
[
{
"id": "352425023038652565",
"tx_id": "95DD0893F9B2F0CBFEACDAF11672BAFC5BE1F097F450CD51F0420B44D81BF3C1",
"asset": "XRP",
"address": "rDQGVYCKC3StBmJV6my9uL1Dn9q7TzEGqS:964641378",
"amount": 19,
"confirmations": 1,
"completed": true,
"created_at": 1529758242
}
]
List your deposit history
HTTP Request
GET /deposit/list
Withdrawals
New Withdraw
{
"id": "356435012048652741",
"asset": "ETH",
"amount": 3
}
Withdraws funds to a crypto address.
HTTP Request
POST /withdraw
Param | Description |
---|---|
asset | A valid asset |
address | A crypto address of the recipient |
amount | The amount to withdraw |
tag | [Optional] Destination tag for XRP withdraws |
memo | [Optional] Memo for EOS withdraws |
List Withdraws
[
{
"id": "321425023135652252",
"tx_id": "95DD0893F9B2F0CBFEACDAF11672BAFC5BE1F097F450CD51F0420B44D81BF3C1",
"asset": "XRP",
"address": "rDQGVYCKC3StBmJV6my9uL1Dn9q7TzEGqS:964641378",
"amount": 19,
"status": 1,
"created_at": 1529758242
}
]
List your withdraw history
HTTP Request
GET /withdraw/list
Status | Description |
---|---|
1 | Sent confirmation email |
2 | Pending |
3 | In process |
4 | Completed |
5 | Cancelled |
Public
Public API is an unauthenticated set of endpoints for retrieving market data. These endpoints provide snapshots of market data.
Ticker
{
"pair": "BTC-TRY",
"low": 27778,
"high": 28482,
"last": 28167,
"volume": 5.164363,
"daily_change": 29,
"daily_change_percentage": 0.10
}
Snapshot information about the last trade (tick), 24h low, high price and volume.
HTTP Request
GET /ticker
Param | Description |
---|---|
pair | A valid pair |
Order Book
{
"asks": [
{
"price": 28206,
"amount": 0.007583,
"count": 1
},
{
"price": 28221,
"amount": 0.003363,
"count": 1
},
{
"price": 28224,
"amount": 0.00609,
"count": 1
}
],
"bids": [
{
"price": 28196,
"amount": 0.001693,
"count": 1
},
{
"price": 28178,
"amount": 0.004494,
"count": 1
},
{
"price": 28176,
"amount": 0.003847,
"count": 1
}
],
"total": {
"bid": 282.760832,
"ask": 0.017036
}
}
Get a list of open orders for a pair
HTTP Request
GET /order-book
Param | Description |
---|---|
pair | A valid pair |
Trades
[
{
"price": 28196,
"amount": 0.001693,
"side": "SELL",
"created_at": 1530189928
},
{
"price": 28220,
"amount": 0.00049,
"side": "SELL",
"created_at": 1530189061
},
{
"price": 28205,
"amount": 0.000545,
"side": "BUY",
"created_at": 1530188983
},
{
"price": 28204,
"amount": 0.001193,
"side": "BUY",
"created_at": 1530188983
}
]
List the latest trades for a pair
HTTP Request
GET /trades
Param | Description |
---|---|
pair | A valid pair |