@clicsdev/sdk
v0.0.24
Published
TypeScript SDK for the Clics analytics API
Downloads
692
Maintainers
Readme
@clicsdev/sdk
TypeScript SDK for the Clics analytics API.
Summary
Clics privacy-first web analytics platform: Server-side REST API for Clics privacy-friendly web analytics: manage projects, goals, funnels, sessions, and query stats.
Table of Contents
SDK Installation
The SDK can be installed with either npm, pnpm, bun or yarn package managers.
NPM
npm add @clicsdev/sdkPNPM
pnpm add @clicsdev/sdkBun
bun add @clicsdev/sdkYarn
yarn add @clicsdev/sdk[!NOTE] This package is published as an ES Module (ESM) only. For applications using CommonJS, use
await import("@clicsdev/sdk")to import and use this package.
Requirements
This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
- Web Fetch API
- Web Streams API and in particular
ReadableStream - Async iterables using
Symbol.asyncIterator
Runtime environments that are explicitly supported are:
- Evergreen browsers which include: Chrome, Safari, Edge, Firefox
- Node.js active and maintenance LTS releases
- Currently, this is v18 and v20
- Bun v1 and above
- Deno v1.39
- Note that Deno does not currently have native support for streaming file uploads backed by the filesystem (issue link)
Recommended TypeScript compiler options
The following tsconfig.json options are recommended for projects using this
SDK in order to get static type support for features like async iterables,
streams and fetch-related APIs (for await...of,
AbortSignal, Request, Response and
so on):
{
"compilerOptions": {
"target": "es2020", // or higher
"lib": ["es2020", "dom", "dom.iterable"]
}
}While target can be set to older ECMAScript versions, it may result in extra,
unnecessary compatibility code being generated if you are not targeting old
runtimes.
SDK Example Usage
Example
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.stats.queryStats({
projectId: "k17abc123",
domain: "example.com",
timezone: "Europe/London",
metrics: [
"visitors",
"pageviews",
"bounce_rate",
],
dateRange: "last7days",
dimensions: [
"visit:country",
],
filters: [
[
"is",
"visit:country",
[
"US",
"FR",
],
],
],
orderBy: [
[
"visitors",
"desc",
],
],
});
console.log(result);
}
run();
Authentication
To authenticate with the API the apiKey parameter must be set when initializing the SDK client instance. For example:
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.stats.queryStats({
projectId: "k17abc123",
domain: "example.com",
timezone: "Europe/London",
metrics: [
"visitors",
"pageviews",
"bounce_rate",
],
dateRange: "last7days",
dimensions: [
"visit:country",
],
filters: [
[
"is",
"visit:country",
[
"US",
"FR",
],
],
],
orderBy: [
[
"visitors",
"desc",
],
],
});
console.log(result);
}
run();
Available Resources and Operations
Funnels
Funnel analysis
listFunnels
List project conversion funnels.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.funnels.listFunnels({
projectId: "k17abc123",
cursor: "eyJwayI6InByb2pfMSJ9",
limit: 20,
});
console.log(result);
}
run();Optional: envId, cursor, limit
createFunnel
Create a multistep funnel.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.funnels.createFunnel({
projectId: "k17abc123",
body: {
name: "Checkout",
conversionWindow: {
value: 7,
unit: "days",
},
steps: [
{
name: "Cart",
filters: [
{
filterType: "page",
operator: "is",
values: [
"/cart",
],
},
],
},
{
name: "Purchase",
filters: [
{
filterType: "page",
operator: "is",
values: [
"/thanks",
],
},
],
},
],
},
});
console.log(result);
}
run();Optional: envId
getFunnel
Fetch one funnel by ID.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.funnels.getFunnel({
funnelId: "funnel_1",
});
console.log(result);
}
run();updateFunnel
Partially update an existing funnel. Unspecified fields are preserved.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.funnels.updateFunnel({
funnelId: "funnel_1",
body: {
name: "Updated checkout",
},
});
console.log(result);
}
run();Optional: name, conversionWindow, steps
deleteFunnel
Delete an existing funnel.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.funnels.deleteFunnel({
funnelId: "funnel_1",
});
console.log(result);
}
run();getFunnelStats
Return the same step counts, conversion, drop-off, and timing metrics as the Funnel dashboard.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.funnels.getFunnelStats({
funnelId: "funnel_1",
});
console.log(result);
}
run();Optional: domain, dateRange, start, end, timezone, referrerAiProvider
Goals
Conversion goals
listGoals
List project conversion goals.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.goals.listGoals({
projectId: "k17abc123",
});
console.log(result);
}
run();Optional: envId
createGoal
Create a page, event, outbound-link, or scroll-depth goal.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.goals.createGoal({
projectId: "k17abc123",
body: {
goalType: "page",
rule: {
pagePath: "/signup",
},
envId: "production",
displayName: "Signup",
},
});
console.log(result);
}
run();getGoalStats
Return goal totals, previous-period comparison, and a time series. Supports all four goal types.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.goals.getGoalStats({
goalId: "goal_1",
});
console.log(result);
}
run();Optional: domain, dateRange, start, end, timezone, referrerAiProvider
getGoal
Fetch one Goal, including its type-specific rule.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.goals.getGoal({
goalId: "goal_1",
});
console.log(result);
}
run();updateGoal
Update an existing goal.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.goals.updateGoal({
goalId: "goal_1",
body: {
rule: {
pagePath: "/thank-you",
},
},
});
console.log(result);
}
run();Optional: displayName, goalType, rule
deleteGoal
Delete an existing goal.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.goals.deleteGoal({
goalId: "goal_1",
});
console.log(result);
}
run();Projects
Project management
listProjects
List workspace projects.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.projects.listProjects({
cursor: "eyJwayI6InByb2pfMSJ9",
limit: 20,
});
console.log(result);
}
run();Optional: cursor, limit
createProject
Create a tracked website project.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.projects.createProject({
name: "Acme Marketing",
websiteUrl: "example.com",
allowLocalhost: false,
});
console.log(result);
}
run();Optional: allowLocalhost
getProject
Fetch one project by ID.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.projects.getProject({
projectId: "k17abc123",
});
console.log(result);
}
run();updateProject
Update project name or domain.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.projects.updateProject({
projectId: "k17abc123",
body: {
name: "Acme Marketing",
websiteUrl: "example.com",
allowLocalhost: true,
},
});
console.log(result);
}
run();Optional: name, websiteUrl, allowLocalhost
deleteProject
Permanently delete a project.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.projects.deleteProject({
projectId: "k17abc123",
});
console.log(result);
}
run();Sessions
Visitor session list, detail, and events
listSessions
List paginated visitor sessions. Supports the same period presets as /v1/query, optional domain scoping, and cursor pagination.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.sessions.listSessions({
projectId: "k17abc123",
domain: "example.com",
dateRange: "last7days",
start: "2026-07-01",
end: "2026-07-24",
timezone: "Europe/London",
countryOp: "is",
deviceOp: "is",
browserOp: "is",
osOp: "is",
pageEntryOp: "is",
pageExitOp: "is",
referrerOp: "is",
cursor: "eyJ2IjoxLCJza2lwIjoxMH0",
limit: 20,
});
console.log(result);
}
run();Optional: domain, dateRange, start, end, timezone, country, countryOp, device, deviceOp, browser, browserOp, os, osOp, pageEntry, pageEntryOp, pageExit, pageExitOp, referrer, referrerOp, cursor, limit
listSessionFilterValues
Return available values and their session/pageview counts in the same filtered session scope. The requested field's own filter is excluded so a client can populate its picker.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.sessions.listSessionFilterValues({
projectId: "k17abc123",
domain: "example.com",
dateRange: "last7days",
start: "2026-07-01",
end: "2026-07-24",
timezone: "Europe/London",
field: "referrer",
countryOp: "is",
deviceOp: "is",
browserOp: "is",
osOp: "is",
pageEntryOp: "is",
pageExitOp: "is",
referrerOp: "is",
limit: 50,
});
console.log(result);
}
run();Optional: domain, dateRange, start, end, timezone, country, countryOp, device, deviceOp, browser, browserOp, os, osOp, pageEntry, pageEntryOp, pageExit, pageExitOp, referrer, referrerOp, limit
getSession
Get a single visitor session with UTM metadata and visited pages.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.sessions.getSession({
projectId: "k17abc123",
sessionId: "sess_abc123",
domain: "example.com",
dateRange: "last7days",
start: "2026-07-01",
end: "2026-07-24",
timezone: "Europe/London",
});
console.log(result);
}
run();Optional: domain, dateRange, start, end, timezone
listSessionEvents
List the chronological event timeline for a session.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.sessions.listSessionEvents({
projectId: "k17abc123",
sessionId: "sess_abc123",
domain: "example.com",
dateRange: "last7days",
start: "2026-07-01",
end: "2026-07-24",
timezone: "Europe/London",
});
console.log(result);
}
run();Optional: domain, dateRange, start, end, timezone
Stats
Analytics query endpoints
queryStats
Query metrics and dimensions. For KPI queries with include.previous_period enabled, the response includes comparison with previous-period values and percentage changes.
Example Usage
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.stats.queryStats({
projectId: "k17abc123",
domain: "example.com",
timezone: "Europe/London",
metrics: [
"visitors",
"pageviews",
"bounce_rate",
],
dateRange: "last7days",
dimensions: [
"visit:country",
],
filters: [
[
"is",
"visit:country",
[
"US",
"FR",
],
],
],
orderBy: [
[
"visitors",
"desc",
],
],
});
console.log(result);
}
run();Optional: domain, timezone, dimensions, filters, orderBy, include, pagination
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.stats.queryStats({
projectId: "k17abc123",
domain: "example.com",
timezone: "Europe/London",
metrics: [
"visitors",
"pageviews",
"bounce_rate",
],
dateRange: "last7days",
dimensions: [
"visit:country",
],
filters: [
[
"is",
"visit:country",
[
"US",
"FR",
],
],
],
orderBy: [
[
"visitors",
"desc",
],
],
}, {
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});
console.log(result);
}
run();
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
import { Clics } from "@clicsdev/sdk";
const clics = new Clics({
retryConfig: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
const result = await clics.stats.queryStats({
projectId: "k17abc123",
domain: "example.com",
timezone: "Europe/London",
metrics: [
"visitors",
"pageviews",
"bounce_rate",
],
dateRange: "last7days",
dimensions: [
"visit:country",
],
filters: [
[
"is",
"visit:country",
[
"US",
"FR",
],
],
],
orderBy: [
[
"visitors",
"desc",
],
],
});
console.log(result);
}
run();
Error Handling
ClicsError is the base class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
| ------------------- | ---------- | --------------------------------------------------------------------------------------- |
| error.message | string | Error message |
| error.statusCode | number | HTTP response status code eg 404 |
| error.headers | Headers | HTTP response headers |
| error.body | string | HTTP body. Can be empty string if no body is returned. |
| error.rawResponse | Response | Raw HTTP response |
| error.data$ | | Optional. Some errors may contain structured data. See Error Classes. |
Example
import { Clics } from "@clicsdev/sdk";
import * as errors from "@clicsdev/sdk/models/errors";
const clics = new Clics({
apiKey: process.env["CLICS_API_KEY"] ?? "",
});
async function run() {
try {
const result = await clics.stats.queryStats({
projectId: "k17abc123",
domain: "example.com",
timezone: "Europe/London",
metrics: [
"visitors",
"pageviews",
"bounce_rate",
],
dateRange: "last7days",
dimensions: [
"visit:country",
],
filters: [
[
"is",
"visit:country",
[
"US",
"FR",
],
],
],
orderBy: [
[
"visitors",
"desc",
],
],
});
console.log(result);
} catch (error) {
// The base class for HTTP error responses
if (error instanceof errors.ClicsError) {
console.log(error.message);
console.log(error.statusCode);
console.log(error.body);
console.log(error.headers);
// Depending on the method different errors may be thrown
if (error instanceof errors.QueryStatsBadRequestError) {
console.log(error.data$.error); // operations.QueryStatsError
}
}
}
}
run();
Error Classes
Primary error:
ClicsError: The base class for HTTP error responses.
Network errors:
ConnectionError: HTTP client was unable to make a request to a server.RequestTimeoutError: HTTP request timed out due to an AbortSignal signal.RequestAbortedError: HTTP request was aborted by the client.InvalidRequestError: Any input used to create a request is invalid.UnexpectedClientError: Unrecognised or unexpected error.
Inherit from ClicsError:
QueryStatsBadRequestError: Invalid query. Status code400. Applicable to 1 of 22 methods.*ListProjectsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*CreateProjectBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*GetProjectBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*UpdateProjectBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*DeleteProjectBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*ListGoalsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*CreateGoalBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*GetGoalStatsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*GetGoalBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*UpdateGoalBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*DeleteGoalBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*ListFunnelsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*CreateFunnelBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*GetFunnelBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*UpdateFunnelBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*DeleteFunnelBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*GetFunnelStatsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*ListSessionsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*ListSessionFilterValuesBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*GetSessionBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*ListSessionEventsBadRequestError: Invalid request. Status code400. Applicable to 1 of 22 methods.*ListProjectsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*CreateProjectUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*GetProjectUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*UpdateProjectUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*DeleteProjectUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*ListGoalsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*CreateGoalUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*GetGoalStatsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*GetGoalUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*UpdateGoalUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*DeleteGoalUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*ListFunnelsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*CreateFunnelUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*GetFunnelUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*UpdateFunnelUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*DeleteFunnelUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*GetFunnelStatsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*ListSessionsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*ListSessionFilterValuesUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*GetSessionUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*ListSessionEventsUnauthorizedError: Missing or invalid API key. Status code401. Applicable to 1 of 22 methods.*ListProjectsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*CreateProjectForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*GetProjectForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*UpdateProjectForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*DeleteProjectForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*ListGoalsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*CreateGoalForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*GetGoalStatsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*GetGoalForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*UpdateGoalForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*DeleteGoalForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*ListFunnelsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*CreateFunnelForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*GetFunnelForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*UpdateFunnelForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*DeleteFunnelForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*GetFunnelStatsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*ListSessionsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*ListSessionFilterValuesForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*GetSessionForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*ListSessionEventsForbiddenError: Forbidden. Status code403. Applicable to 1 of 22 methods.*ListProjectsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*CreateProjectNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*GetProjectNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*UpdateProjectNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*DeleteProjectNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*ListGoalsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*CreateGoalNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*GetGoalStatsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*GetGoalNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*UpdateGoalNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*DeleteGoalNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*ListFunnelsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*CreateFunnelNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*GetFunnelNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*UpdateFunnelNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*DeleteFunnelNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*GetFunnelStatsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*ListSessionsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*ListSessionFilterValuesNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*GetSessionNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*ListSessionEventsNotFoundError: Resource not found. Status code404. Applicable to 1 of 22 methods.*ListProjectsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*CreateProjectInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*GetProjectInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*UpdateProjectInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*DeleteProjectInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*ListGoalsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*CreateGoalInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*GetGoalStatsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*GetGoalInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*UpdateGoalInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*DeleteGoalInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*ListFunnelsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*CreateFunnelInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*GetFunnelInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*UpdateFunnelInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*DeleteFunnelInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*GetFunnelStatsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*ListSessionsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*ListSessionFilterValuesInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*GetSessionInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*ListSessionEventsInternalServerError: Unexpected error. Status code500. Applicable to 1 of 22 methods.*ResponseValidationError: Type mismatch between the data returned from the server and the structure expected by the SDK. Seeerror.rawValuefor the raw value anderror.pretty()for a nicely formatted multi-line string.
* Check the method documentation to see if the error is applicable.
Debugging
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass a logger that matches console's interface as an SDK option.
[!WARNING] Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
import { Clics } from "@clicsdev/sdk";
const sdk = new Clics({ debugLogger: console });You can also enable a default debug logger by setting an environment variable CLICS_DEBUG to true.
