Workspace API

Lejki

Endpointy „Lejki” Zanfia Workspace API — ze schematami i przykładami kodu.

6 min czytaniaOstatnia aktualizacja: 19 lis 2026

Lejki marketingowe: nazwane łańcuchy kroków, które odwołują się do istniejących koszyków, stron i automatyzacji. Lejek nigdy nie jest ich właścicielem, więc usunięcie lejka ich nie kasuje. Tworzenie odbywa się z przepisu nad istniejącymi zasobami produktu (lead_magnet / tripwire wymagają darmowego koszyka, sell_product / low_ticket płatnego, webinar dowolnego produktu: trzy puste kroki stron, które potem generujesz z datą wydarzenia) i dodatkowo tworzy sekwencję e-maili z przepisu jako szkic automatyzacji. from-template tworzy lejek i od razu generuje jego strony. Statusy draft / live / archived są w pełni odwracalne przez PATCH. Wszystkie endpointy wymagają nagłówka Authorization: Bearer — zobacz Uwierzytelnianie.

Lista lejków

GET/funnels

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/funnels"
{  "funnels": [    {      "id": "string",      "name": "string",      "recipe": "lead_magnet",      "status": "draft",      "steps": [        {          "stepId": "string",          "type": "lead-magnet",          "name": "string",          "ref": {            "pageId": "string",            "checkoutId": "string",            "formId": "string",            "otoOfferId": "string"          },          "slug": "string",          "status": "ready"        }      ],      "workflowIds": [        "string"      ],      "productIds": [        "string"      ],      "challenge": {        "startAt": 0,        "timezone": "string",        "days": 0,        "courseProductId": "string",        "courseId": "string",        "registrationCheckoutId": "string",        "pitchProductId": "string",        "pitchCheckoutId": "string",        "cartClosesAt": 0,        "deadlineApplied": true,        "missions": [          {            "day": 0,            "moduleId": "string",            "lessonId": "string",            "unlockAt": 0          }        ],        "campaigns": [          {            "campaignId": "string",            "kind": "kickoff",            "day": 0,            "sendAt": 0          }        ]      },      "statsFrom": 0,      "createdAt": 0,      "updatedAt": 0    }  ]}
{  "error": "string",  "message": "string"}

Utwórz lejek z przepisu

POST/funnels

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Create a funnel from a recipe — resolves the product's existing artifacts (free/paid checkouts, OTO chain) into the step list and generates the recipe's email sequence as a DRAFT workflow. See FunnelDocument.

Response Body

application/json

application/json

curl -X POST "https://example.com/funnels" \  -H "Content-Type: application/json" \  -d '{    "recipe": "lead_magnet",    "productId": "string",    "lang": "en"  }'
{  "funnelId": "string",  "note": "string"}
{  "error": "string",  "message": "string"}

Lista szablonów lejków

GET/funnel-templates

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/funnel-templates"
{  "templates": [    {      "id": "squeeze",      "recipe": "lead_magnet",      "name": "string",      "namePl": "string",      "description": "string",      "descriptionPl": "string",      "requirement": "free_checkout",      "available": true,      "steps": [        {          "type": "lead-magnet",          "name": "string",          "namePl": "string"        }      ]    }  ]}
{  "error": "string",  "message": "string"}

Utwórz lejek z istniejących stron

POST/funnels/from-pages

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

A funnel record over existing hosted pages (visitor order; the first is the entry).

Response Body

application/json

application/json

curl -X POST "https://example.com/funnels/from-pages" \  -H "Content-Type: application/json" \  -d '{    "pageIds": [      "string"    ]  }'
{  "funnelId": "string"}
{  "error": "string",  "message": "string"}

Utwórz lejek z szablonu

POST/funnels/from-template

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

POST /funnels/from-template — the server-side "Use funnel template" flow: creates the funnel from the template's recipe over the product's existing checkouts, drops the recipe's email sequence in as a draft workflow, and enqueues an AI page generation for every page step.

Response Body

application/json

application/json

curl -X POST "https://example.com/funnels/from-template" \  -H "Content-Type: application/json" \  -d '{    "templateId": "squeeze",    "lang": "en"  }'
{  "funnel": {    "id": "string",    "name": "string",    "recipe": "lead_magnet",    "status": "draft",    "steps": [      {        "stepId": "string",        "type": "lead-magnet",        "name": "string",        "ref": {          "pageId": "string",          "checkoutId": "string",          "formId": "string",          "otoOfferId": "string"        },        "slug": "string",        "status": "ready"      }    ],    "workflowIds": [      "string"    ],    "productIds": [      "string"    ],    "challenge": {      "startAt": 0,      "timezone": "string",      "days": 0,      "courseProductId": "string",      "courseId": "string",      "registrationCheckoutId": "string",      "pitchProductId": "string",      "pitchCheckoutId": "string",      "cartClosesAt": 0,      "deadlineApplied": true,      "missions": [        {          "day": 0,          "moduleId": "string",          "lessonId": "string",          "unlockAt": 0        }      ],      "campaigns": [        {          "campaignId": "string",          "kind": "kickoff",          "day": 0,          "sendAt": 0        }      ]    },    "statsFrom": 0,    "createdAt": 0,    "updatedAt": 0  },  "generations": [    {      "stepId": "string",      "stepName": "string",      "runId": "string"    }  ],  "skippedSteps": [    {      "stepId": "string",      "reason": "already_has_page"    }  ]}
{  "error": "string",  "message": "string"}

Pobierz lejek

GET/funnels/{funnelId}

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Path Parameters

funnelId*string

Funnel id

Response Body

application/json

application/json

curl -X GET "https://example.com/funnels/string"
{  "funnel": {    "id": "string",    "name": "string",    "recipe": "lead_magnet",    "status": "draft",    "steps": [      {        "stepId": "string",        "type": "lead-magnet",        "name": "string",        "ref": {          "pageId": "string",          "checkoutId": "string",          "formId": "string",          "otoOfferId": "string"        },        "slug": "string",        "status": "ready"      }    ],    "workflowIds": [      "string"    ],    "productIds": [      "string"    ],    "challenge": {      "startAt": 0,      "timezone": "string",      "days": 0,      "courseProductId": "string",      "courseId": "string",      "registrationCheckoutId": "string",      "pitchProductId": "string",      "pitchCheckoutId": "string",      "cartClosesAt": 0,      "deadlineApplied": true,      "missions": [        {          "day": 0,          "moduleId": "string",          "lessonId": "string",          "unlockAt": 0        }      ],      "campaigns": [        {          "campaignId": "string",          "kind": "kickoff",          "day": 0,          "sendAt": 0        }      ]    },    "statsFrom": 0,    "createdAt": 0,    "updatedAt": 0  },  "event": {    "pageId": "string",    "mode": "live",    "startAt": "string",    "timezone": "string",    "durationMinutes": 0,    "joinUrl": "string",    "replayUrl": "string",    "liveRoomId": "string",    "rungs": [      {        "kind": "day_before",        "broadcastId": "string",        "sendAt": "string",        "status": "draft"      }    ]  }}
{  "error": "string",  "message": "string"}

Edytuj lejek

PATCH/funnels/{funnelId}

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Path Parameters

funnelId*string

Funnel id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Partial funnel update — rename, status transition, step re-wiring.

Response Body

application/json

application/json

curl -X PATCH "https://example.com/funnels/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "updated": true}
{  "error": "string",  "message": "string"}

Usuń lejek

DELETE/funnels/{funnelId}

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Path Parameters

funnelId*string

Funnel id

Response Body

application/json

application/json

curl -X DELETE "https://example.com/funnels/string"
{  "deleted": true}
{  "error": "string",  "message": "string"}

Statystyki lejka

GET/funnels/{funnelId}/stats

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Path Parameters

funnelId*string

Funnel id

Response Body

application/json

application/json

curl -X GET "https://example.com/funnels/string/stats"
{  "funnelId": "string",  "since": "string",  "statsFrom": "string",  "steps": [    {      "stepId": "string",      "views": 0,      "entries": 0,      "signups": 0,      "sessions": 0,      "completed": 0,      "otoViewed": 0,      "otoAccepted": 0    }  ],  "totals": {    "entryViews": 0,    "signups": 0,    "purchases": 0  },  "challenge": {    "participants": 0,    "missions": [      {        "day": 0,        "lessonId": "string",        "completed": 0      }    ]  }}
{  "error": "string",  "message": "string"}

Wygeneruj stronę dla kroku lejka

POST/funnels/{funnelId}/generate-step-page

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Path Parameters

funnelId*string

Funnel id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Generate a hosted page for one page-type funnel step (opt-in / sales / thank-you) via the unified page-generation pipeline, grounded in the funnel's product + the step's checkout, then wire the step to the draft (ref.pageId + slug). One step per call — generation takes minutes.

Response Body

application/json

application/json

curl -X POST "https://example.com/funnels/string/generate-step-page" \  -H "Content-Type: application/json" \  -d '{    "stepId": "string",    "lang": "en"  }'
{  "runId": "string",  "publicAccessToken": "string"}
{  "error": "string",  "message": "string"}

Dodaj stronę z ofertą jednorazową po zapisie

Ten endpoint wymaga dwóch scope'ów, products:write i pages:write, bo tworzy stronę i zmienia stronę zapisu. Klucz ze scope'ami, który ma tylko products:write, dostaje 403 insufficient-scope; klucze utworzone, zanim pojawiły się scope'y, działają jak dotąd.

POST/funnels/{funnelId}/offer-page

Authorization

bearerAuth
AuthorizationBearer <token>

API key from Dashboard → Integrations → API, MCP and CLI.

In: header

Path Parameters

funnelId*string

Funnel id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

POST /funnels/:funnelId/offer-page: a designed one-time-offer page right after a signup step (the panel's „Oferta” step, the assistant's add-funnel-offer-page, the Workspace API / MCP / CLI). The page is built from the Glass tripwire template in the signup page's colors, its offer block wired to the koszyk (accept, pays on the page) and the next step (decline, 30-minute timer); created as a DRAFT the creator edits and publishes. No AI, no credits.

Response Body

application/json

application/json

curl -X POST "https://example.com/funnels/string/offer-page" \  -H "Content-Type: application/json" \  -d '{    "checkoutId": "string",    "layout": "digital"  }'
{  "pageId": "string",  "slug": "string",  "stepId": "string",  "title": "string",  "afterStepId": "string"}
{  "error": "string",  "message": "string"}

Czy ten artykuł był pomocny?

Powiązane artykuły

Coś się nie zgadza? Napisz do nas na support@zanfia.com.