API reference
How to sign a call, what each kind of key may do, the limits and errors, and every endpoint with its parameters.
https://poolnex.com/api/v2Overview
A REST API over HTTPS. Send parameters as a query string on GET and as JSON on POST; every answer is JSON. Amounts are strings, to keep every digit.
/api/v2/public- Market data. No key.
/api/v2/account- Your account. Any key.
/api/v2/market- Your orders and trades. Reading: any key. Placing and cancelling: a Trade key.
Lists take page (from 1) and limit (how many per page).
Signing a call
Every call to /account and /market carries three headers. The signature proves you hold the secret without sending it.
X-Auth-Apikey- Your key ID, as shown in Profile, API keys.
X-Auth-Nonce- The time in milliseconds since 1 January 1970 (UTC). It must be within 5 seconds of our clock; GET /public/timestamp tells you ours.
X-Auth-Signature- HMAC-SHA256 of the nonce followed by the key ID, keyed with your secret, as lowercase hex.
signature = hex(HMAC_SHA256(secret, nonce + key))const crypto = require('crypto');
const KEY = 'your key ID';
const SECRET = 'your secret';
const nonce = Date.now().toString();
const signature = crypto.createHmac('sha256', SECRET).update(nonce + KEY).digest('hex');
// Node.js 18 or later (built-in fetch)
fetch('https://poolnex.com/api/v2/account/balances', {
headers: {
'X-Auth-Apikey': KEY,
'X-Auth-Nonce': nonce,
'X-Auth-Signature': signature,
},
})
.then(response => response.json())
.then(console.log);const crypto = require('crypto');
const KEY = 'your key ID';
const SECRET = 'your secret';
const nonce = Date.now().toString();
const signature = crypto.createHmac('sha256', SECRET).update(nonce + KEY).digest('hex');
fetch('https://poolnex.com/api/v2/market/orders', {
method: 'POST',
headers: {
'X-Auth-Apikey': KEY,
'X-Auth-Nonce': nonce,
'X-Auth-Signature': signature,
'Content-Type': 'application/json',
},
body: JSON.stringify({
'market': 'btcusdt',
'side': 'buy',
'ord_type': 'limit',
'volume': '0.001',
'price': '50000',
}),
})
.then(response => response.json())
.then(console.log);Each market has its own lowest and highest price, smallest amount and number of decimals: GET /public/markets lists them. A buy below the market price waits in the order book until it fills or you cancel it.
Keep the secret out of your code and out of shared files: read it from an environment variable or a secrets store.
Keys and permissions
A key can call only the endpoints listed below. Anything else is refused, including every endpoint added in the future until it is listed here.
| Kind | May call | IP list |
|---|---|---|
| Read | Every GET under /account and /market in the endpoint list | Optional |
| Trade | As Read, plus placing and cancelling orders and instant trade quotes | Required |
Up to 30 keys an account and 30 IP addresses or ranges a key (for example 203.0.113.7 or 203.0.113.0/24; IPv6 too). A range covering the whole internet is refused.
Never by key: withdrawals, withdrawal addresses, the PIN, security and profile settings, API keys, taking out or repaying loans, and business payments.
Limits
Calls are measured against an allowance of 300 points a key, which comes back at 5 points a second. A call costs 1 point unless it is listed here. Limits may apply above the allowance.
| Cost | Calls |
|---|---|
| 2 |
|
| 4 |
|
Where a limit applies, the call is refused with status 429 and a Retry-After header with the seconds to wait, also in the body. A refused call costs nothing: wait that long and carry on.
HTTP/1.1 429 Too Many Requests
Retry-After: 3
{"errors": ["authz.too_many_requests"], "retry_after": 3}Longer limits may apply to a key that keeps going well over the allowance.
Calls without a key share an allowance per IP address.
Errors
A refused call answers with an HTTP status and the reason as a code in its body:
{"errors": ["authz.api_key_read_only"]}| Status | Code | What it means |
|---|---|---|
| 422 | authz.invalid_api_key_headers | One of the three headers is missing or empty. |
| 401 | authz.nonce_not_valid_timestamp | The nonce is not a positive whole number. |
| 401 | authz.nonce_expired | The nonce is more than 5 seconds from our clock. Check yours against GET /public/timestamp. |
| 401 | authz.invalid_signature | The signature does not match. Sign the nonce followed by the key ID with the secret. |
| 401 | authz.unexistent_apikey | There is no key with this ID. |
| 401 | authz.apikey_not_active | The key is turned off. |
| 401 | authz.user_not_active | The account is not active. |
| 401 | authz.disabled_2fa | 2FA is off on the account, so its keys do not work. |
| 403 | authz.api_key_forbidden | Keys cannot call this endpoint. |
| 403 | authz.api_key_read_only | This call needs a Trade key. |
| 401 | authz.api_key_ip_not_allowed | The call came from an address that is not on the key's IP list. |
| 401 | authz.invalid_permission | The account is not allowed to make this call. |
| 429 | authz.too_many_requests | Over the allowance. Wait the seconds in Retry-After. |
Endpoints39
Every call a key can make, and market data. Open one for its full address and parameters. Paths are under the base address.