NAV Navbar
php java nodejs python
  • Introduction
  • Authentication
  • Signing a Message
  • Time
  • Timestamps
  • Sequence Numbers
  • Time request
  • Accounts
  • Payment methods
  • Orders
  • Products
  • Withdrawals
  • Deposit
  • Introduction

    Welcome to the Abucoins API! You can use our API to access Abucoins API endpoints, which can get information about product, orders and fees.

    If you have any questions, please do not hesitate to contact our experts at [email protected]

    Rest api endpoint url

    https://api.abucoins.com

    Rate limits

    300 requests per 1 minute per IP and Account. When a rate limit is exceeded, a status of 429 will be returned.

    Authentication

    Generating an API Key

    Example class

    <?php
    class Api
    {
        const API_URL = 'https://api.abucoins.com';
    
        protected $accesskey;
        protected $secret;
        protected $passphrase;
        protected $timestamp;
    
        public function __construct($settings)
        {
            $this->secret = $settings['secret'];
            $this->accesskey = $settings['access_key'];
            $this->passphrase = $settings['passphrase'];
            $this->timestamp = time();
        }
    
        public function jsonRequest($method, $path, $datas)
        {
            $this->timestamp = time();
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
            curl_setopt($ch, CURLOPT_URL, static::API_URL . "$path");
            if ($method == 'POST') {
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($datas));
            }
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'AC-ACCESS-KEY: ' . $this->accesskey,
                'AC-ACCESS-TIMESTAMP: ' . $this->timestamp,
                'AC-ACCESS-PASSPHRASE: ' . $this->passphrase,
                'AC-ACCESS-SIGN: ' . $this->signature($path, $datas, $this->timestamp, $method),
            ));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $server_output = curl_exec($ch);
            curl_close($ch);
            return json_decode($server_output);
        }
    
        public function signature($request_path = '', $body = '', $timestamp = false, $method = 'GET')
        {
            $body = is_array($body) ? json_encode($body) : $body;
            $timestamp = $timestamp ? $timestamp : time();
            $what = $timestamp . $method . $request_path . $body;
            return base64_encode(hash_hmac("sha256", $what, base64_decode($this->secret), true));
        }
    
    }
    
    $configAbucoins = [
        'secret' => 'M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj',
        'access_key' => '10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39',
        'passphrase' => '34y42c2bfce'
    ];
    
    $abucoinsApi = new AbucoinsApi($configAbucoins);
    $list = $abucoinsApi->jsonRequest('GET', '/orders', null);
    
    public class Api {
    
        private final String URL = "https://api.abucoins.com";
        private final String accessKey = "10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39";
        private final String secret = "M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj";
        private final String passphrase = "34y42c2bfce";
        private final String USER_AGENT = "Mozilla/5.0";
    
        public static void main(String[] args) throws Exception {
            Api http = new Api();
            http.sendRequest("GET","/orders","");
        }
    
        private String sendRequest(String method,String path, String body) throws Exception {
            String localUrl;
            if (method.equals("GET"))
                localUrl = URL+path+body;
            else
                localUrl = URL+path;
    
            String timestamp = String.valueOf(System.currentTimeMillis()/1000);
            String sign = createSign(timestamp,method,path,body);
    
            URL url = new URL(localUrl);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod(method);
            con.setRequestProperty("User-Agent", USER_AGENT);
            con.setRequestProperty("AC-ACCESS-KEY", accessKey);
            con.setRequestProperty("AC-ACCESS-SIGN", sign);
            con.setRequestProperty("AC-ACCESS-PASSPHRASE", passphrase);
            con.setRequestProperty("AC-ACCESS-TIMESTAMP", timestamp);
    
            if (method.equals("POST")){
                con.setRequestProperty("Content-type", "application/json");
                con.setDoOutput(true);
                OutputStream os = con.getOutputStream();
                os.write(body.getBytes("UTF-8"));
                os.close();
            }
            int responseCode = con.getResponseCode();
    
            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
    
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
            return response.toString();
        }
    
        private String createSign(String timestamp, String method, String path, String queryParameters) throws NoSuchAlgorithmException, InvalidKeyException{
            String queryArgs = timestamp + method + path + queryParameters;
            Mac shaMac = Mac.getInstance("HmacSHA256");
            SecretKeySpec keySpec = new SecretKeySpec(Base64.decodeBase64(secret), "HmacSHA256");
            shaMac.init(keySpec);
            final byte[] macData = shaMac.doFinal(queryArgs.getBytes());
            return Base64.encodeBase64String(macData);
        }
    }
    
    const rp = require('request-promise');
    const crypto = require('crypto');
    
    const TIMEOUT = 5000;
    
    class Abucoins {
        constructor() {
            this.endpoint = 'https://api.abucoins.com';
            this.credentials = {
                key: '10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39',
                secret: 'M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj',
                passphrase: '34y42c2bfce',
            }
        }
    
        _jsonRequest(options) {
            options.timeout = TIMEOUT;
            options.json = true;
    
            return rp(options);
        }
    
        _getHeaders(sign, timestamp) {
            return {
                'AC-ACCESS-KEY': this.credentials.key,
                'AC-ACCESS-SIGN': sign,
                'AC-ACCESS-TIMESTAMP': timestamp,
                'AC-ACCESS-PASSPHRASE': this.credentials.passphrase,
            };
        }
    
        signAndRequest(method, path, body = {}) {
            const timestamp = Math.floor(new Date() / 1000);
            let options = {
                uri: `${this.endpoint}${path}`,
                method: method,
                body: body,
            };
            let string = timestamp + method + path;
            if (Object.keys(body).length > 0) {
                string += JSON.stringify(body);
            }
            const sign = crypto.createHmac('sha256', Buffer.from(this.credentials.secret, 'base64'))
                .update(string)
                .digest('base64');
            options.headers = this._getHeaders(sign, timestamp);
    
            return this._jsonRequest(options);
        }
    }
    
    let abucoins = new Abucoins();
    let orders = abucoins.signAndRequest('GET', `/orders`);
    
    orders.then((list) => {
        // console.log(list);
    });
    
    # Requires python-requests. Install with pip: pip install requests
    
    import json, hmac, hashlib, time, requests, base64
    from requests.auth import AuthBase
    
    class AbuCoins(AuthBase):
        def __init__(self, api_key, secret_key, passphrase):
            self.api_key = api_key
            self.secret_key = secret_key
            self.passphrase = passphrase
    
        def __call__(self, request):
            timestamp = str(int(time.time())) # eg. 1512516837
            # timestamp = eg. 1512516837
            # request.method = eg. POST
            # request.path_url = eg. /orders
            message = timestamp + request.method + request.path_url
            if request.body: # if present
                message = message + request.body.decode() # decode raw bytes
    
            hmac_key = base64.b64decode(self.secret_key)
            signature = hmac.new(hmac_key, message.encode('utf-8'), hashlib.sha256)
            signature_base64 = base64.b64encode(signature.digest())
    
            request.headers.update({
                'AC-ACCESS-KEY': self.api_key,
                'AC-ACCESS-PASSPHRASE': self.passphrase,
                'AC-ACCESS-SIGN': signature_base64,
                'AC-ACCESS-TIMESTAMP' : timestamp,
                })
            return request
    
    
    abucoins_api = 'https://api.abucoins.com'
    abucoins_passphrase = '34y42c2bfce'
    abucoins_key = '10-30DWTDFOC17GE5IVL6ALUQBUN8Y4SF39'
    abucoins_secret = 'M1Y1N0oHZ2RSW7teVE5mbzB7xX0iP0NZS7x6LyVVUE1PsVMqV2hfNEBbUSYuWiQj'
    
    authenticator = AbuCoins(api_key = abucoins_key, secret_key = abucoins_secret, passphrase = abucoins_passphrase)
    
    response = requests.get(abucoins_api + '/orders', auth = authenticator)
    print(response.json())
    

    Abucoins expects for the API key to be included in all API requests to the server in a header that looks like the following:

    AC-ACCESS-KEY: Api key

    AC-ACCESS-SIGN: Sign of message (see Signing a Message)

    AC-ACCESS-TIMESTAMP: Current timestamp

    AC-ACCESS-PASSPHRASE

    Error codes

    Message The most popular reason
    INVALID TIMESTAMP Timestamp not provided
    Your server time is not synced
    Your timestamp is in miliseconds
    INVALID PASSPHRASE Invalid or not provided passphrase
    ACCESS DENIED Invalid or not provided api key
    PERMISSION DENIED Provided key has not permission to the method
    INVALID SIGN Message checksum is not calculated correctly or not provided

    Signing a Message

    AC-ACCESS-SIGN header is generated by creating a sha256 HMAC using the secret key(need to be base64-decoded) on the prehash string concatenation timestamp(in seconds) + method(GET/POST/DELETE) + requestPath(including query string like /producs/BTC-USD/book?level=2) + body and base64-encode the output. The timestamp value is the same as the AC-ACCESS-TIMESTAMP header.

    $string = $timestamp . $method . $request_path . $body;
    $sign = base64_encode(hash_hmac("sha256", $string, base64_decode($secret), true));
    

    Sign a Message test cases

    You can test your sign message function using parameters provided below

    GET/DELETE:

    INPUT: TIMESTAMP: (string)"1517497622" METHOD: (string)"GET" BODY: (string)"" URL: (string)"/accounts" SECRET: (string)"YOUR_SECRET_KEY"

    OUTPUT: SIGN: (string)"D+DOWeDPcK8xHrgWGXzUzY78rZGuChqKGZ8oCTjynxU="

    POST:

    INPUT: TIMESTAMP: (string)"1517497475" METHOD: (string)"POST" BODY: (string)'{"currency":"PLN","method":"sepa_pln"}' URL: (string)"/deposits/make" SECRET: (string)"YOUR_SECRET_KEY"

    OUTPUT: SIGN: (string)"JeVOQjfp7d7zBzOL7VPwO6s7Ook7yFf7Sqv6FFS2f88="

    Time

    The AC-ACCESS-TIMESTAMP header must be number of seconds since Unix Epoch in UTC. Only decimal values are allowed.

    Your timestamp must be maximum 30 seconds before or 30 seconds after api time. Otherwise your request will be rejected.

    Timestamps

    2014-11-06T10:34:47Z
    

    All timestamps from API are returned in ISO 8601.

    Sequence Numbers

    Most feed messages contain a sequence number. Sequence numbers are increasing integer values for each product with every new message being exactly 1 sequence number than the one before it.

    Time request

    Example response

    {
      "iso":"2017-10-10T11:16:50Z",
      "epoch":1507634210
    }
    

    Return current server time.

    HTTP Request

    GET /time

    Accounts

    List Accounts

    Example response

    [
        {
            "id": "3-BTC",
            "currency": "BTC",
            "balance": 13.38603805,
            "balance_btc": 13.38603805,
            "available": 13.38589212,
            "available_btc": 13.38589212,
            "hold": 0.00014593,
            "profile_id": 3
        },
        {
            "id": "3-ETH",
            "currency": "ETH",
            "balance": 133.48685448,
            "balance_btc": 9.38012126,
            "available": 133.48685448,
            "available_btc": 9.38012126,
            "hold": 0,
            "profile_id": 3
        }
    ]
    

    Get a list of trading accounts.

    HTTP Request

    GET /accounts

    Accounts fields

    Field Description
    id account id
    currency the currency of the account
    balance the founds in the account
    balance_btc the founds in the account (estimated in BTC)
    available funds available to withdraw or trade
    available_btc funds available to withdraw or trade (estimated in BTC)
    hold funds on hold (not available for use)
    profile_id profile id

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission

    Get an Account

    Example response

    {
      "id":"1-PLN",
      "currency":"PLN",
      "balance":"103465.35499050",
      "available":"103465.35499050",
      "hold":"0.00000000",
      "profile_id":"1"
    }
    

    Information for a single account. Use this endpoint when you know the account_id.

    HTTP Request

    GET /accounts/<account-id>

    Field Description
    id account id
    currency the currency of the account
    balance the founds in the account
    available founds available to withdraw or trade
    hold funds on hold (not available for use)
    profile_id profile id

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Wrong account id invalid id of the account

    Payment methods

    List Payment Methods

    Example response

    [
        {
            "id": "bitcoin",
            "type": "bitcoin",
            "name": "Bitcoin",
            "currency": "BTC",
            "allow_buy": true,
            "allow_sell": true,
            "allow_deposit": true,
            "allow_withdraw": true,
            "limits": {
                "buy": 10000,
                "sell": 10000,
                "deposit": 9223372036854775807,
                "withdraw": 1
            }
        },
        {
            "id": "sepa_pln",
            "type": "sepa_pln",
            "name": "PLN",
            "currency": "PLN",
            "allow_buy": true,
            "allow_sell": true,
            "allow_deposit": true,
            "allow_withdraw": true,
            "limits": {
                "buy": 10000,
                "sell": 10000,
                "deposit": 9223372036854775807,
                "withdraw": 9223372036854775807
            }
        }
    ]    
    

    Get a list of your payment methods.

    HTTP Request

    GET /payment-methods

    Response fields

    Field Description
    id identifier of the method
    type type of the method
    name: name of the method
    currency currency symbol
    allow_buy allowed buy flag
    allow_sell allowed sell flag
    allow_deposit allowed deposit flag
    allow_withdraw allowed withdraw flag
    limits global limits

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "payment" permission

    Orders

    List Orders

    Example response

    [
        {
            "id": "7786713",
            "price": "0.05367433",
            "size": "0.10451686",
            "product_id": "ZEC-BTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "post_only": false,
            "created_at": "2017-09-03T03:33:17Z",
            "filled_size": "0.00000000",
            "status": "closed",
            "settled": false
        },
        {
            "id": "7786713",
            "price": "0.05367433",
            "size": "0.10451686",
            "product_id": "ZEC-BTC",
            "side": "buy",
            "type": "limit",
            "time_in_force": "GTC",
            "post_only": false,
            "created_at": "2017-09-03T03:33:17Z",
            "filled_size": "0.00000000",
            "status": "closed",
            "settled": false
        }
    ]
    

    List your current orders.

    HTTP Request

    GET /orders

    QUERY PARAMETERS

    Field Default Description
    status [open, done] Limit list of orders to these statuses
    product_id ex. ETH-BTC Get orders for the specified market

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request
    Wrong status You provided status param which is not "open" or "done"

    Get an Order

    Example response

    {
        "id": "7786714",
        "price": "0.05363803",
        "size": "0.91353089",
        "product_id": "ZEC-BTC",
        "side": "buy",
        "type": "limit",
        "time_in_force": "GTC",
        "post_only": false,
        "created_at": "2017-09-03T03:33:17Z",
        "filled_size": "0.00000000",
        "status": "closed",
        "settled": false
    }
    

    Get a single order by order id.

    HTTP Request

    GET /orders/<order-id>

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Order not found you provided wrong order id or order id which is not connected with your account

    Create an Order

    Create new order

    HTTP Request

    POST /orders

    Example request

    JSONObject body = new JSONObject();
    body.put("cancel_after", "min");        
    body.put("price", "0.035582569");        
    body.put("product_id", "ZEC-BTC");        
    body.put("side", "buy");     
    body.put( "size", "17.3124");
    body.put("time_in_force", "GTT");
    body.put("type", "limit");
    http.sendRequest("POST","/orders",body);
    
    let order = {
      "cancel_after" => "min",
      "price" => "0.035582569",
      "product_id" => "ZEC-BTC",
      "side" => "buy",
      "size" => "17.3124",
      "time_in_force" => "GTT",
      "type" => "limit"
    }
    
    let response = abucoins.signAndRequest('POST', `/orders`, order);
    
    $order = {
      "cancel_after" => "min",
      "price" => "0.035582569",
      "product_id" => "ZEC-BTC",
      "side" => "buy",
      "size" => "17.3124",
      "time_in_force" => "GTT",
      "type" => "limit"
    }
    
    $result = $abucoinsApi->jsonRequest('POST', '/orders', $order);
    print_r($result);
    
    order = {
      "cancel_after" : "min",
      "price" : "0.035582569",
      "product_id" : "ZEC-BTC",
      "side" : "buy",
      "size" : "17.3124",
      "time_in_force" : "GTT",
      "type" : "limit"
    }
    
    response = requests.post(abucoins_api + '/orders', json = order, auth = authenticator)
    print(response.json())
    

    Example response

    {
      "product_id":"ZEC-BTC",
      "used":"17.3124",
      "size":"17.3124",
      "price":"0.035582569",
      "id":"4217215",
      "side":"buy",
      "type":"limit",
      "time_in_force":"GTT",
      "post_only":false,
      "created_at":"2017-11-15T12:41:58Z",
      "filled_size":"17.3124",
      "fill_fees":"0",
      "executed_value":"0.61601967",
      "status":"done",
      "settled":true,
      "hidden":false
    }
    

    Order fields

    Base parameters

    Field Default Description
    type limit [optional] limit or market
    side buy or sell
    product_id Product id (ex. ZEC-BTC)
    stp default stp is off [optional] Self-trade prevention flag (co)
    hidden false [optional]* Hide your offer

    * A hidden order is an order which does not appear in the order book. If you place a hidden order, you will always pay the taker fee. If you place a limit order that hits a hidden order, you will always pay the maker fee.

    Limit order parameters

    Field Default Description
    price price per one asset
    size amount of assets to buy or sell
    time_in_force GTC [optional] GTC, GTT, IOC or FOK
    cancel_after [optional]* min, hour, day
    post_only [optional]** create order only if maker - true, false

    * Requires only with GTT
    ** Invalid when time_in_force is IOC or FOK

    Market order parameters

    Field Default Description
    size [optional]* Desired amount in BTC
    funds [optional]* Desired amount of quote currency to use

    * One of size or funds is required.

    Funds will limit how much of your quote currency account balance is used and size will limit the asset amount transacted.

    Response fields

    Field Type Description
    product_id string Product id ex. BTC-USD
    used string [deprecated] executed value of amount
    size string Order size
    price string Order price
    id string Offer id
    side string Offer side (buy or sell)
    type string Offer type (limit, market)
    time_in_force string Offer time in force param (GTC, GTT, IOC, FOK)
    post_only bool Post only param (true or false)
    created_at string Order time
    filled_size string Realized amount
    fill_fees string Charged fees
    executed_value string Sum of all executed values (amount * price)
    status string Order status (pending, open, done, rejected)
    reject_reason string [optional] Reason of order reject
    settled bool True if order is fully executed
    hidden bool True if your order is hide on the orderbook
    stp string Self trading prevention flag ('' or 'co')

    Time in force

    Time in force policies provide guarantees about the lifetime of an order.

    GTC (Good Till Canceled) orders remain open on the book until canceled(default).
    GTT (Good Till Time) orders remain open on the book until canceled or the allotted cancel_after is depleted on the matching engine. GTT orders are guaranteed to cancel before any other order is processed after the cancel_after timestamp which is returned by the API. A day is considered 24 hours.
    IOC Immediate or cancel orders instantly cancel the remaining size of the limit order instead of opening it on the book.
    FOK Fill or kill orders are rejected if the entire size cannot be matched.

    Self-trade prevention

    Self-trading is default set to off. To change the self-trade behavior, specify the stp flag.

    Flag Description
    default Orders from single user are possible to match
    'co' Cancel oldest - cancel older order

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission
    Wrong type order has wrong type. Allowed: limit, market
    Wrong price format price should be decimal value provided as text
    Wrong size format size should be decimal value provided as text
    Wrong funds format funds should be decimal value provided as text
    Wrong side side is not provided or not allowed
    Invalid post_only param post_only param is not true or false or order type is not limit
    Invalid time_in_force param time_in_force param is not valid or order type is not limit
    Invalid stp param stp param is provided but different like 'co'
    Wrong market market doesn't exist or is suspended
    Wrong operation side param is not valid or cancel_after provided but order type is not 'limit'
    Wrong format of cancel_after parameter cancel_after provided but not valid
    Invalid time_in_force or cancel_after param time_in_force provided but cancel_after is not provided or invalid
    Wrong funds precision funds has incorrect precision. See: quote_increment field in /products endpoint
    Wrong price precision price has incorrect precision. See: quote_increment field in /products endpoint
    Total price is too small(min: XXX) Order size (price*amount) is too small
    Amount is too small(min: XXX) Order amount is too small
    Insufficient funds You has not enought funds to make an order
    Technical error Temporary system pause

    Delete an single order

    Example response

    ["12344534"]
    

    Delete a single order by order id.

    HTTP Request

    DELETE /orders/<order-id>

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission

    Delete all orders

    Example response

    ["12344534","12344536"]
    

    Delete all orders

    HTTP Request

    DELETE /orders

    QUERY PARAMETERS

    Field Default Description
    product_id ex. ZEC-BTC Optional parameter with product id

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission

    List Fills

    Example response

    [
      {
        "trade_id":"785705",
        "product_id":"BTC-PLN",
        "price":"14734.55000000",
        "size":"100.00000000",
        "order_id":"4196245",
        "created_at":"2017-09-28T13:08:43Z",
        "liquidity":"T",
        "fee": "1231.22344285",
        "side":"sell"
      },
      {
        "trade_id":"785704",
        "product_id":"BTC-PLN",
        "price":"14734.55000000",
        "size":"0.01000000",
        "order_id":"4196245",
        "created_at":"2017-09-28T13:08:43Z",
        "liquidity":"T",
        "fee": "0.01742231",
        "side":"sell"
      }
    ]
    

    Get a list of recent fills.

    HTTP Request

    GET /fills

    Response fields

    Field Description
    trade_id identifier of the last trade
    product_id product identifier
    price trade price
    size: trade size
    order_id identifier of order
    created_at time in UTC
    liquidity indicates if the fill was the result of a liquidity provider (maker) or liquidity taker. M indicates Maker and T indicates Taker
    fee indicates the fees charged for this individual fill
    side user side(buy or sell)

    Pagination

    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    before and after cursors are available via response headers ac-before and ac-after. Your requests should use these cursor values when making requests for pages after the initial request.

    To get older information you would request pages after the initial page. To get information newer, you would request pages before the first page.

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Products

    List Products

    Example response

    [
        {
            "id": "ETH-BTC",
            "base_currency": "ETH",
            "quote_currency": "BTC",
            "base_min_size": "0.0010",
            "base_max_size": "100000.00000000",
            "quote_increment": "0.00000001",
            "display_name": "ETH/BTC"
        },
        {
            "id": "LTC-BTC",
            "base_currency": "LTC",
            "quote_currency": "BTC",
            "base_min_size": "0.0010",
            "base_max_size": "100000.00000000",
            "quote_increment": "0.00000001",
            "display_name": "LTC/BTC"
        },
        {
            "id": "ETC-BTC",
            "base_currency": "ETC",
            "quote_currency": "BTC",
            "base_min_size": "0.0010",
            "base_max_size": "100000.00000000",
            "quote_increment": "0.00000001",
            "display_name": "ETC/BTC"
        }
    ]
    

    Get a list of available currency pairs for trading.

    The base_min_size and base_max_size fields define the min and max order size. The quote_increment field specifies the min order price as well as the price increment. The order price must be a multiple of this increment (i.e. if the increment is 0.01, order prices of 0.001 or 0.021 would be rejected).

    HTTP Request

    GET /products

    Response fields:

    Field Description
    id identifier of market
    base_currency which currency is buying/selling
    quote_currency price currency of base_currency
    base_min_size minimum order size
    base_max_size maximum order size
    quote_increment the order price must be a multiple of this increment

    Product

    Example response

    {
      "id": "ETH-BTC",
      "base_currency": "ETH",
      "quote_currency": "BTC",
      "base_min_size": "0.0010",
      "base_max_size": "100000.00000000",
      "quote_increment": "0.00000001",
      "display_name": "ETH/BTC"
    }
    

    Get a specific market product.

    HTTP Request

    GET /products/<product-id>

    product-id is market pair like BTC-USD, ETH-BTC etc.

    Response fields:

    Field Description
    id identifier of market
    base_currency which currency is buying/selling
    quote_currency price currency of base_currency
    base_min_size minimum order size
    base_max_size maximum order size
    quote_increment the order price must be a multiple of this increment

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Get Product Order Book

    Example response

    {
        "asks": [
          [ price, size, num-orders ],
          ["14160.13374000", "0.15994651", 1]
          ...
        ],
        "bids": [
           [ price, size, num-orders ],
           ["14140.00000000", "0.19970339", 1]
           ...
        ],
        "sequence": 1431
    }
    

    Example response for /products/BTC-PLN/book?level=2

    {
        "bids": [
            [ price, size, num-orders ],
        ],
        "asks": [
            [ price, size, num-orders ],
        ],
        "sequence": 1431
    }
    

    Return product orderbook

    HTTP Request

    GET /products/<product-id>/book

    By default, full agregated order book is returned. This is equivalent to a book depth of 0 level.

    Aggregated levels return only one size for each active price.

    Levels:

    GET /products/<product-id>/book?level=2

    Level Description
    0 fully agregated order book
    1 best ask and bid
    2 top 50 asks and bids

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Get Products Tickers

    Example response

    [
        {
            "product_id":"ETH-BTC",
            "trade_id":"1825814",
            "price":"0.11675",
            "size":"0.0856531",
            "bid":"0.11509600",
            "ask":"0.11675000",
            "volume":"48.42677187",
            "time":"2018-02-01T18:07:15Z"
        },{
            "product_id":"LTC-BTC",
            "trade_id":"1825807",
            "price":"0.0160394",
            "size":"0.06234647",
            "bid":"0.01587335",
            "ask":"0.01600233",
            "volume":"92.89176989",
            "time":"2018-02-01T18:07:15Z"
        }
    ]
    

    Snapshot information about the last trade (tick) in each product, best bid/ask and 24h volume.

    HTTP Request

    GET /products/ticker

    Response fields

    Field Description
    product_id identifier of the market
    trade_id identifier of the last trade
    price last price
    size: size of the last trade
    bid the best bid
    ask the best ask
    volume 24 hour volume
    time time in UTC

    Error codes

    Message The most popular reason
    NotFound all markets down

    Get Product Ticker

    Example response

    {
        "trade_id": "553612",
        "price": "14160.85",
        "size": "0.00053",
        "bid": "14140.00000000",
        "ask": "14181.70000000",
        "volume": "1.09596639",
        "time": "2017-09-21T10:26:58Z"
    }
    

    Snapshot information about the last trade (tick), best bid/ask and 24h volume.

    HTTP Request

    GET /products/<product-id>/ticker

    Response fields

    Field Description
    trade_id identifier of the last trade
    price last price
    size: size of the last trade
    bid the best bid
    ask the best ask
    volume 24 hour volume
    time time in UTC

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Get Trades

    Example response

    [
        {
            "time": "2017-09-21T12:33:03Z",
            "trade_id": "553794",
            "price": "14167.99328000",
            "size": "0.00035000",
            "side": "buy"
        },
        {
            "time": "2017-09-21T12:32:34Z",
            "trade_id": "553780",
            "price": "14163.96328000",
            "size": "0.00050000",
            "side": "buy"
        }
    ]    
    

    List the latest 100 trades for a product.

    Response fields:

    Field Description
    time time in UTC
    trade_id identifier of the last trade
    price last price
    size: size of the last trade
    side maker order side(sell or buy)

    HTTP Request

    GET /products/<product-id>/trades

    Pagination

    100 BTC-USD trades older than trade id: 1742024

    GET /products/BTC-USD/trades?limit=100&after=1742024
    

    100 BTC-USD trades newer than trade id: 1742024

    GET /products/BTC-USD/trades?limit=100&before=1742024
    
    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    before and after cursors are available via response headers ac-before and ac-after. Your requests should use these cursor values when making requests for pages after the initial request.

    To get older information you would request pages after the initial page. To get information newer, you would request pages before the first page.

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Get Historic Rates

    Example response

    [
        [ time, low, high, open, close, volume ],
        [
            "1505984400",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "0.001"
        ],
        [
            "1505984460",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "0.00052"
        ],
        [
            "1505984520",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "14209.92500000",
            "0.00068"
        ]
    ]
    

    List the latest trades for a product.

    HTTP Request

    GET /products/<product-id>/candles?granularity=[granularity]&start=[UTC time of start]&end=[UTC time of end]

    QUERY PARAMETERS

    Param Description
    start Start time in ISO 8601 ex: 2018-01-22T09:44:59.000Z
    end End time in ISO 8601 ex: 2018-01-23T09:44:59.000Z
    granularity Desired timeslice in seconds

    Minimum start time is 30 days before current time.

    RESPONSE FIELDS

    Each bucket is an array of the following information:

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists
    Invalid granularity granularity param is not number or less than 0

    Global stats

    Example response

    [
      {
        "product_id":"BTC-PLN",
        "last":"14734.55000000",
        "open":"14734.55000000",
        "high":"0.00000000",
        "low":"0.00000000",
        "volume":"1.00000000",
        "volume_BTC":"1.00000000",
        "volume_USD":"4086.69",
        "volume_7d":"0.00000000",
        "volume_30d":"149.45718835",
        "change":"0.00"
      },
      {
        "product_id":"BTC-USD",
        "last":"4086.69000000",
        "open":"4086.69000000",
        "high":"0.00000000",
        "low":"0.00000000",
        "volume":"1.00000000",
        "volume_BTC":"1.00000000",
        "volume_USD":"4086.69",
        "volume_7d":"0.00000000",
        "volume_30d":"53.95784974",
        "change":"0.00"
      }
    ]
    

    List of the all products with stats.

    HTTP Request

    GET /products/stats

    Error codes

    Message The most popular reason
    NotFound provided market doesn't exists

    Product stats

    Example response

    {
      "last":"14734.55000000",
      "open":"14734.55000000",
      "high":"0.00000000",
      "low":"0.00000000",
      "volume":"1.00000000"
    }
    

    Product stats

    HTTP Request

    GET /products/<product-id>/stats

    Withdrawals

    Crypto withdrawals

    HTTP Request

    POST /withdrawals/crypto

    Make withdraw

    Example request

    {
        "amount": 10.00,
        "currency": "BTC",
        "method": "bitcoin",
        "address": "0x5ad5769cd04681FeD900BCE3DDc877B50E83d469"
    }
    

    Example response

    {
        "status": 0,
        "message": "Your transaction is pending. Please confirm it via email.",
        "payoutId": "65",
        "balance": [
            {
                "type": "PLN",
                "balance": "2999990.00000000",
                "locked": "0.00000000"
            },
            {
                "type": "BTC",
                "balance": "13.38589212",
                "locked": "0.00014593"
            }
        ]
    }
    

    HTTP Request

    POST /withdrawals/make

    QUERY PARAMETERS

    Base parameters:

    Field Description
    amount The amount to withdraw
    currency The type of currency
    method Payment method (see Payment methods)

    Crypto parameters:

    Field Description
    address A crypto address of the recipient
    tag Tag/PaymentId/Memo of the recipient

    FIAT parameters:

    Field Description
    accountNumber Account number/IBAN
    firstName Recipient first name
    lastName Recipient last name
    companyName Recipient company name

    Response fields

    Field Description
    status 0 if request is correct, other values if is incorrect
    message response message
    payoutId: id of payout
    balance balance on each account after request

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "payment" permission
    Invalid withdraw method invalid method param
    We can't process your withdraw because your Limits are too low(XXXBTC/day). Please increase your verification level! User limits are to low
    Withdrawals locked to YYYY-MM-DD due to password change. Your account is locked due to password change
    Invalid withdraw address. Withdrawal address is not valid
    You can't use this address. Withdrawal address is other user account
    Invalid withdraw tag. Tag is invalid
    Minimum withdraw amount is XXX Amount to withdraw is too low
    Technical error Temporary system pause

    Withdrawals history

    Gets an information about withdrawals history

    Example request

    HTTP Request

    GET /withdrawals/history

    QUERY PARAMETERS

    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    Response fields

    Field Description
    withdraw_id Withdraw transaction ID
    currency Withdraw currency
    date: Date of withdraw
    amount Withdraw amount
    fee Withdraw fee
    status Withdraw status
    url blockchain explorer url (null if not available)

    Deposit statuses

    Field Description
    awaiting-email-confirmation Withdraw is waiting for email confirmation
    pending Withdraw is pending
    complete Withdraw is completed

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request

    Deposit

    Crypto deposit

    HTTP Request

    POST /deposits/crypto

    Make deposit

    Gets an information about deposit address

    Example request

    JSONObject body = new JSONObject();
    body.put("currency", "XEM");        
    body.put("method", "nem");
    http.sendRequest("POST","/deposits/make",body);
    
    <?php
    $deposit = {
      "currency" => "XEM",
      "method" => "nem"
    }
    
    $result = $abucoinsApi->jsonRequest('POST', '/deposits/make', $deposit);
    print_r($result);
    
    deposit = {
      "currency" : "XEM",
      "method" : "nem"
    }
    
    response = requests.post(abucoins_api + '/deposits/make', json = deposit, auth = authenticator)
    print(response.json())
    
    let deposit = {
      "currency" : "XEM",
      "method" : "nem"
    }
    
    let response = abucoins.signAndRequest('POST', `/deposits/make`, deposit);
    

    Example response

    {
        "address": "NCYFDRHBAHYRWMZFRDAOXQ2KUGLD5AHHFC2J",
        "tag": "54b5fc2ae75afd20fd1514f8b5f6389dfb3f0"
    }
    

    HTTP Request

    POST /deposits/make

    QUERY PARAMETERS

    Field Description
    currency The type of currency
    method Payment method

    Response fields

    Field Description
    addres Cryptocurency address
    tag Cryptocurency tag
    accountNumber: Bank account number
    swift Bank SWIFT
    name Bank transfer recipient name
    address Bank transfer recipient address
    title Bank transfer title/details

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "trade" permission
    Invalid deposit method invalid deposit param

    Deposit history

    Gets an information about deposit history

    Example request

    HTTP Request

    GET /deposits/history

    QUERY PARAMETERS

    Parameter Default Description
    before Request page before (newer) this pagination id.
    after Request page after (older) this pagination id.
    limit 100 Number of results per request. Maximum 1000. (default 100)

    Response fields

    Field Description
    deposit_id Deposit transaction ID
    currency Deposit currency
    date: Date of deposit
    amount Deposit amount
    fee Deposit fee
    status Deposit status
    url blockchain explorer url (null if not available)

    Deposit statuses

    Field Description
    awaiting-email-confirmation Deposit wait for email confirmation
    pending Deposit is pending
    complete Deposit is completed

    Error codes

    Message The most popular reason
    PERMISSION DENIED Your API KEY has not "view" permission
    Invalid value for pagination limit limit parameter should be between 1 and 1000
    Invalid before param before parameter should be integer and higher than 0
    Invalid after param after parameter should be integer and higher than 0
    Only one param before or after available You provide before and after params in single request