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

Get a conversion funnel with the Clics TypeScript SDK

Copy page

Get a funnel

Fetch a funnel by ID with the Clics TypeScript SDK, including steps, filters, and conversion window.

Fetches a single funnel by ID, including its full step and filter configuration.

Use this before updating a funnel, to export definitions, or to inspect the conversion window and step filters in automation scripts.

Parameters

Field Required Description
funnelId Yes Funnel ID (from createFunnel or listFunnels)

Signature

clics.funnels.getFunnel(request, options?)

Example

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

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

const result = await clics.funnels.getFunnel({
  funnelId: "funnel_xxx",
});

console.log(result.name, result.steps);

What it returns

The response is a Funnel object with id, projectId, envId, name, conversionWindow, steps, and createdAt. Each step has a name and one or more filters:

{
  id: "funnel_xxx",
  name: "Trial activation",
  conversionWindow: { value: 7, unit: "days" },
  steps: [
    { name: "Pricing", filters: [{ filterType: "page", operator: "is", values: ["/pricing"] }] },
    { name: "Purchase", filters: [{ filterType: "event", operator: "is", values: ["purchase"] }] },
  ]
}

Pass this exact configuration to updateFunnel only after intentionally editing it: supplying steps replaces the entire existing list.

Field Type Description
id string Stable funnel ID
projectId string Parent project ID
envId "production" | "development" Funnel environment
name string Dashboard label
conversionWindow { value, unit } Allowed completion period after step 1
steps Array<{ name, filters }> Complete ordered funnel definition
createdAt number Creation timestamp

Errors

The method rejects with 401 for an invalid API key, 403 when the workspace cannot access the funnel, and 404 when the funnel does not exist.

API reference

See Get a funnel for request and response schemas, status codes, and error types.

Was this page helpful?