Paths

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST

Create paths v2 segment to funnel

Converts a displayed journeys segment into the funnel query that reproduces its unique-actor count exactly. In open mode only a single edge converts (a two-step funnel with the inactivity gap as conversion window); in anchored mode any anchor-rooted chain converts (window W). The funnel is returned as JSON and is not executed or persisted here.

Required API key scopes

insight:read

Request parameters

  • query
  • items
    Click to open
    array

Response


Example request

POST /api/projects/:project_id/paths_v2/segment_to_funnel
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/paths_v2/segment_to_funnel/\
-d query=undefined,\
-d items="array"

Example response

Status 200 The funnel that reproduces the segment's displayed count exactly.
RESPONSE
{
"funnels_query": null
}
Status 400 The query is not a valid PathsV2Query, or the segment has no exact funnel equivalent (an other-row endpoint, a multi-hop open-mode segment, or an anchored segment that does not start at the anchor).