KuCoin authorization header JavaScript example for the Siebly KuCoin SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.
We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.
kucoin-api instead of hand-written signing code.Kucoin/Auth/authorizationHeader.ts.SpotClient.getBalances(), setAccessToken().import { SpotClient } from 'kucoin-api'; async function start() { /** * All REST clients support passing the access token. If available, sign will be skipped for the request and the access token will instead be used via an authorization header. * * More details: https://github.com/tiagosiebler/kucoin-api/issues/2 */ const client = new SpotClient({ apiAccessToken: 'accessTokenHere!', }); try { const result = await client.getBalances(); console.log('result ', JSON.stringify(result, null, 2)); } catch (e) { console.error('Req error: ', e); } // If you later need to set a new access token (e.g. it expired): client.setAccessToken('newAccessTokenHere');} start(); We use essential cookies and optional analytics. Read the Privacy Policy.
Essential cookies stay on. Toggle analytics if you want to share anonymous usage insights. You can revisit this anytime via Cookie Settings in the footer.