API

  • API允许您执行交换操作并接收有关帐户的信息。
  • 要使用API,您需要创建一个API密钥。您可以在 {cabinet} 中点击“设置”,然后点击“Api设置”创建API密钥。
  • 在您创建API密钥后,您将获得API密钥和密钥。有关用于身份验证的API密钥信息。
  • 所有请求都发送到以下URL:https://userapi.cryptonex.org/api。
  • 方法名称和所有方法参数都通过JSON-RPC参数中的POST方法发送。
  • 每一个请求都需要验证。
  • 通过发送以下JSON-RPC 2.0参数来执行身份验证:
公钥公钥需要进行用户配置文件设置(例如:258ae265-642323ae6-8e22-c6a11fe26f3fsdsdw4b)。
生成的签名签名 - 通过密钥方法SHA-256签名的POST数据"user.account_list " + " 1 " + "aQcLC343dsfg9hgbOLGeredfsdfIry"(API方法+随机数+密钥),密钥也必须在用户配置文件设置中进行。
所需的增量值数字参数会随着每个请求而增加随机数。

Curl命令示例

curl -H "Content-Type: application/json" -X POST -d '{"jsonrpc":"2.0", "method": "user.account_list", "params":{"key":"941-fb77-4153-a057-0fgh83c3a454c", "sign": "4e96bc40b2gfhvbn65771ac493cbbed4b4aa2c5ec6006c32ae8385e48e3c", "nonce": 1}, "id":2}' https://userapi.cryptonex.org/api

帐户列表

方法名称user.account_list
参数
举例
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "user.account_list",
    "params": {
        "key":"330f1dd6-af88-4335-bb8f-0a7b9f6afaa7",
        "sign": "Code",
        "nonce": 1
    }
}
响应
{
    "id": 2,
    "jsonrpc": "2.0",
    "result": {
        "accounts": [
            {
                "balance": "0",
                "currency": "btc",
                "hash": "14x2insrz24PirkRA73TFwvNRYTKqbwxEQ",
                "type": "crypto"
            },
            {
                "balance": "0",
                "currency": "eth",
                "hash": "0x79ff9548653c3a1777c4121f65c678e72629ef9e",
                "type": "crypto"
            }
        ]
    }
}

提现资金

方法名称account.withdraw
参数
  • from_hash — 将执行传输的哈希帐户(在网站上创建)
  • to_hash — 将进行转账的帐户哈希(在线创建)或加密钱包
  • amount — 所列货币的金额
  • auth_2fa_code — 代码两步验证(如已启用)
举例
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "account.withdraw",
    "params": {
        "key":"330f1dd6-af88-4335-bb8f-0a7b9f6afaa7",
        "sign": "Code",
        "nonce": 1,
        "amount": "5",
        "from_hash": "Gh7tmu4234fsdfnweLLdisb8xMaxGyWCv7ui",
        "to_hash": "GgDEpsfEWrsdfse343MkdmcKv5C4axYR87"
    }
}
响应
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "id": 7,
        "user_id": 2,
        "balance": "76.53154234",
        "confirm_type": "email",
        "currency": "cnx",
        "hash": "Gh7tmu4234fsdfnweLLdisb8xMaxGyWCv7ui"
    }
}

交易清单

方法名称transaction.list
参数
  • max_count — 请求交易的最大数量
举例
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "transaction.list",
    "params": {
        "key": "330f1dd6-af88-4335-bb8f-0a7b9f6afaa7",
        "sign": "Code",
        "nonce": 1,
        "max_count": 10
    }
}
响应
{
    "id": 5,
    "jsonrpc": "2.0",
    "result": {
        "summary": {
            "first_stamp": "2017-08-31 22:46:31.15804",
            "last_stamp": "2018-01-30 12:15:23.026104",
            "total": 180
        },
        "transactions":
        [
            {
                "block_hash": "",
                "from_amount": "5",
                "from_commission": "0",
                "from_currency": "cnx",
                "from_hash": "Gh7tmu43836W5nweLLdisb8xMaxGyWCvLr",
                "id": 1918,
                "post_stamp": "2018-01-30 12:15:23.026104",
                "rate": "0",
                "status": "moderate",
                "to_amount": "5",
                "to_currency": "cnx",
                "to_hash": "GgDEpsfEWrN8xiQDezMkdmcKv5C4axYRGk",
                "tx_id": "",
                "type": "withdrawal",
                "update_stamp": "2018-01-30 12:15:23.026104"
            }
        ]
    }
}

费率列表

方法名称currency_pair.get_rate_list
参数
举例
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "currency_pair.get_rate_list",
    "params": {
        "key": "330f1dd6-af88-4335-bb8f-0a7b9f6afaa7",
        "sign": "Code",
        "nonce": 1
    }
}
响应
{
    "id": 2,
    "jsonrpc": "2.0",
    "result": {
        "rates":
        [
            {
                "alias": "CNX/BTC",
                "ask": "0.0007866",
                "base_currency": "cnx",
                "base_type": "crypto",
                "bid": "0.00072375",
                "convert_type": "cross",
                "rel_currency_id": "btc",
                "rel_type": "crypto",
                "update_stamp": "2018-01-30 12:50:02.794084",
                "value_last_24h": "18536.65481165"
            }
        ]
    }
}

货币转换

方法名称currency.convert
参数
  • amount — 所列货币的金额
  • from_currency — 我们想要兑换的货币
  • to_currency — 将收到的货币
举例
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "currency.convert",
    "params": {
        "key": "330f1dd6-af88-4335-bb8f-0a7b9f6afaa7",
        "sign": "Code",
        "nonce": 1,
        "amount": "1",
        "from_currency": "cnx",
        "to_currency": "btc"
    }
}
响应
{
    "id": 2,
    "jsonrpc": "2.0",
    "result": {
        "status": "ok"
    }
}

用户信息

方法名称user.info
参数
举例
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "user.info",
    "params": {
        "key":"330f1dd6-af88-4335-bb8f-0a7b9f6afaa7",
        "sign": "Code",
        "nonce": 1
    }
}
响应
{
    "id": 2,
    "jsonrpc": "2.0",
    "result": {
        "id": 2,
        "login": "[email protected]",
        "auth_2fa": false,
        "deposit_auto_convert": false,
        "eth_cnx_bonus": "0.0",
        "post_stamp": "2017-08-29 20:29:27.844215"
    }
}