---
title: "Save a funnel"
method: POST
path: "/api/{org_id}/rum/analytics/funnels"
tags: ["Product Analytics"]
---

# Save a funnel

`POST /api/{org_id}/rum/analytics/funnels`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/rum/analytics/funnels`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/rum/analytics/funnels/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `org_id` string, required

## Query parameters

- `app` string, required

## Request body

- CreateFunnel
  - `def` FunnelDef, required: A funnel as the web's `funnelParam` writes it.
    - `b` string, nullable: A built-in key dimension, or any stream column but a session-filter field, env or version.
    - `bs` integer, nullable: 1-based step an attribute `b` reads its value at; absent lets the data pick it.
    - `f` object[], nullable
    - `s` array[], required
      - object[]
    - `u` string, nullable
    - `w` string, nullable
    - `x` object[], nullable
  - `description` string, nullable
  - `name` string, required
  - `rules_hash` string, nullable: The `rulesHash` of the settings `sql` was compiled with.
  - `sql` string, required

## Response `201`

Created

- SavedFunnel: A saved funnel; `sql` is a snapshot compiled by the web at save time, never re-run here.
  - `app` string, required
  - `createdAt` integer, required
  - `createdBy` string, required
  - `currentRulesHash` string, required: The app's `rulesHash` now; a different `rulesHash` means `sql` is stale.
  - `def` FunnelDef, required: A funnel as the web's `funnelParam` writes it.
    - `b` string, nullable: A built-in key dimension, or any stream column but a session-filter field, env or version.
    - `bs` integer, nullable: 1-based step an attribute `b` reads its value at; absent lets the data pick it.
    - `f` object[], nullable
    - `s` array[], required
      - object[]
    - `u` string, nullable
    - `w` string, nullable
    - `x` object[], nullable
  - `description` string, nullable
  - `eventIds` string[], required
  - `id` string, required
  - `name` string, required
  - `rulesHash` string, nullable: Null for a funnel saved before rules existed, which counts as changed.
  - `sql` string, required
  - `updatedAt` integer, required
  - `updatedBy` string, required
  - `version` integer, required

## Other responses

- `400`: Invalid body, name, definition, sql or app
- `409`: duplicate_name, limit_reached or unknown_event
- `500`: Internal error

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
