---
title: "KuCoin Authorization Header JavaScript SDK Example | Siebly"
description: "KuCoin authorization header JavaScript example for the Siebly KuCoin SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Kucoin/Auth/authorizationHeader"
robots: "index,follow"
---

# KuCoin Authorization Header JavaScript SDK Example

KuCoin authorization header JavaScript example for the Siebly KuCoin SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Kucoin](/examples/Kucoin) / [Auth](/examples/Kucoin/Auth) / [authorizationHeader.ts](/examples/Kucoin/Auth/authorizationHeader)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Kucoin/Auth/authorizationHeader.ts)

[Open the KuCoin JavaScript SDK guide](/sdk/kucoin/javascript)

## authorizationHeader.ts

```typescript
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();
```
