Skip to content
Clics privacy-friendly cookieless web analytics documentation
Esc
navigateopen⌘Jpreview

Authenticate the Clics TypeScript SDK with an API key

Copy page

Authentication

Authenticate the Clics TypeScript SDK with an API key from Settings → API Keys in your workspace.

The SDK requires a paid-plan API key. Open the Dashboard, then create a key under Settings → API keys and pass it when constructing the client:

import { Clics } from "@clicsdev/sdk";

const clics = new Clics({
  apiKey: process.env.CLICS_API_KEY!,
});

The SDK sends the key as a Bearer token:

Authorization: Bearer <your-api-key>

Store the key in your platform’s encrypted environment-variable store. If it is exposed, revoke it in Dashboard and create a replacement before deploying again.

For browser tracking, use the public project ID with @clicsdev/tracker instead.

Was this page helpful?