Docs·Funnels

POST/api/v1/spree/funnel

Create a funnel

Creates a funnel and returns it. A funnel is an ordered path of 2 to 8 goals that already exist in the audience, so create the goals first with POST /goal. Read how visitors move through it with GET /analytics/funnels/{funnelId} on this page. Like a goal, a funnel is worked out from your events when it is read, so it covers past visits straight away.

Needs the Editor or Admin role in the workspace that owns the audience. A Viewer gets 403.

Errors: 400 with the reason (a step that is not a goal in this audience, a goal used twice, too few or too many steps, a bad window), 409 when the audience already has a funnel with that name, and 410 when the audience does not exist or you are not in its workspace. One person's keys can have at most 10 requests running at once; more answer 429.

Keys: an account key. Getting started explains both kinds.

Parameters

PropInTypeNotes
contactListIdquerystringThe audience to add the funnel to, a UUID. Your role comes from the workspace that owns it.

Request body

PropTypeNotes
namestringRequired. 1 to 200 characters after trimming, and unique within the audience (compared exactly).
goalIdsstring[]Required. The steps in order: 2 to 8 ids of goals in this audience, each used once.
strictOrder?booleanOptional, false by default, which is the app's In order: the steps count in this order, and other pages in between are fine. true is Exact order: no later step may come early.
windowSeconds?numberOptional. How long a visitor has from the first step to finish every step: a whole number of seconds from 1 to 31,622,400 (366 days). Defaults to 604,800 (7 days).

Response

PropTypeNotes
updatedAtstringWhen it last changed, ISO 8601.
createdAtstringWhen it was created, ISO 8601.
goalIdsstring[]The step goals, in order.
windowSecondsnumberThe window in seconds, 604,800 when you sent none.
strictOrderbooleanWhether the steps must come in exact order.
namestringThe name as saved, trimmed.
contactListIdstringThe audience the funnel belongs to.
idstringThe funnel id, for GET /analytics/funnels/{funnelId}.

Request

curl -X POST 'https://app.spreelytics.com/api/v1/spree/funnel?contactListId=…' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{ … }'
const res = await fetch('https://app.spreelytics.com/api/v1/spree/funnel', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ /* see Request body above */ }),
});
const data = await res.json();
import requests

res = requests.post(
    "https://app.spreelytics.com/api/v1/spree/funnel",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={},  # see Request body above
)
data = res.json()

Response

{
  "updatedAt": "string",
  "createdAt": "string",
  "goalIds": [
    "string"
  ],
  "windowSeconds": 0,
  "strictOrder": true,
  "name": "string",
  "contactListId": "string",
  "id": "string"
}

See your own numbers today.

Free up to 100k events a month · no credit card

Contact

Tell us what you need.

A real person reads these. We usually reply within one working day.

Or email us directly at contact@spreelytics.com.