Workspace API

Lejki

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

5 min czytaniaOstatnia aktualizacja: 10 wrz 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 — płatnego; webinar nie jest jeszcze dostępny) i dodatkowo tworzy sekwencję e-maili z przepisu jako szkic automatyzacji. 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          }        ]      },      "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"}
{  "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",    "productId": "string",    "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        }      ]    },    "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        }      ]    },    "createdAt": 0,    "updatedAt": 0  }}
{  "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",  "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"}

Czy ten artykuł był pomocny?

Powiązane artykuły

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