KuCoin’s REST API uses a three-part credential set — an API key, an API secret, and a passphrase — to authenticate every private request. The SDK handles all signing logic automatically: for each request it constructs a pre-sign string, signs it with HMAC-SHA256 using yourDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/kucoin-api/llms.txt
Use this file to discover all available pages before exploring further.
apiSecret, and attaches the resulting signature, timestamp, and passphrase headers. You only need to pass your credentials once at client construction time.
How KuCoin Authentication Works
Every authenticated REST request must include four headers:| Header | Value |
|---|---|
KC-API-KEY | Your API key |
KC-API-SIGN | HMAC-SHA256 signature of timestamp + method + path + body |
KC-API-TIMESTAMP | Current timestamp in milliseconds |
KC-API-PASSPHRASE | Your passphrase (HMAC-SHA256 signed when apiKeyVersion is "2") |
KC-API-KEY-VERSION | "2" (recommended default) |
Your API passphrase is a value you set yourself when you created the API key on KuCoin. It is not your KuCoin account login password.
Constructor Options (RestClientOptions)
All REST clients (SpotClient, FuturesClient, BrokerClient, UnifiedAPIClient) and the WebsocketClient accept a RestClientOptions object as their first constructor argument.
Credential Options
Your KuCoin API key. Create one at kucoin.com/account/api. Omit for public-only usage.
Your API secret, used to sign the
KC-API-SIGN header via HMAC-SHA256. Never log or expose this value.The passphrase you set when creating the API key. This is not your account password. When
apiKeyVersion is "2" (the default), this value is also HMAC-SHA256 signed before sending.An alternative to key-based signing. When provided, the SDK skips HMAC signing entirely and attaches this value via an
Authorization header instead. See Using an Access Token below.The API key version shown in your KuCoin API management page. Defaults to
"2", which requires the passphrase to also be signed. Set to "1" only for legacy keys.Regional Options
The KuCoin region your account belongs to:
'global'— kucoin.com (default)'EU'— kucoin.eu — routes Spot/Margin requests toapi.kucoin.eu. Note: Futures is not available in the EU region.'AU'— kucoin.com/en-au — appends theX-SITE-TYPE: australiaheader and ensures AU-specific market data.
Directly override the base URL for all requests, bypassing
apiRegion routing entirely. Example: 'https://api.kucoin.com'. Useful for testing or custom proxy setups.Behaviour Options
When
true, the SDK throws an error if any request parameter is undefined. Useful during development to catch missing fields early.When
true, HTTP error responses are parsed and rethrown as structured exceptions rather than raw Axios errors.Enables HTTP KeepAlive for REST API requests via the underlying Axios instance.
When
keepAlive is true, controls how often TCP KeepAlive packets are sent (milliseconds). Defaults to 1000 as inherited from the Node.js HTTPS agent.Override the function used to generate the request timestamp. By default,
Date.now() is used. Useful for testing or clock-skew scenarios.Inject a custom HMAC-SHA256 signing function. The SDK defaults to the Web Crypto API, which works in both Node.js and browsers. For latency-sensitive applications in Node.js, you can inject Node’s native
createHmac for faster signing. See Faster HMAC Signing below.Basic Authentication Setup
Pass your credentials to any REST client constructor. Read them from environment variables to keep secrets out of source code:Using an Access Token
If you already have a KuCoin access token (for example, from an OAuth-style flow), you can provide it viaapiAccessToken. When this option is set, the SDK skips HMAC request signing and sends the token in an Authorization header instead.
Do not provide both
apiAccessToken and apiKey/apiSecret at the same time. When apiAccessToken is present, it takes priority and signing is skipped.Regional Configuration
UseapiRegion to route your requests to the correct KuCoin domain. This is important for users on KuCoin EU or KuCoin AU, as the API hostnames and some behaviours differ:
| Client | Region | Base URL |
|---|---|---|
SpotClient | global / AU | https://api.kucoin.com |
SpotClient | EU | https://api.kucoin.eu |
FuturesClient | global / AU | https://api-futures.kucoin.com |
BrokerClient | all | https://api-broker.kucoin.com |
UnifiedAPIClient | global / AU | https://api.kucoin.com |
Faster HMAC Signing (Node.js)
By default, the SDK uses the Web Crypto API for HMAC-SHA256 signing to maintain browser compatibility. In Node.js, the nativecrypto.createHmac method is measurably faster. For latency-sensitive trading bots, you can inject it via customSignMessageFn:
Public vs Authenticated Endpoints
The SDK determines automatically whether a request requires authentication. Public endpoints (market data, order book, tickers, klines) are called without any auth headers even when credentials are configured. Private endpoints (balances, order placement, account history) always include the full authentication header set. You do not need to manage this distinction in your code. Simply instantiate the client with credentials and call any method — the SDK routes authentication appropriately.Best Practices
Use environment variables
Always load
apiKey, apiSecret, and apiPassphrase from process.env or a secrets manager. Never commit credentials to source control.Restrict API key permissions
On KuCoin’s API management page, grant only the permissions your integration needs (e.g. read-only for data bots, trade-only for execution bots). Disable withdrawal permissions unless strictly required.
Rotate keys periodically
Regularly rotate your API keys and update your environment configuration. Immediately revoke any key you suspect has been compromised.
Use IP allowlists
KuCoin allows you to restrict API key usage to specific IP addresses. Enable this for production deployments to reduce the blast radius of a leaked key.