Skip to main content
POST
/
funnels
JavaScript
import Moonbase from '@moonbaseai/sdk';

const client = new Moonbase({
  apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});

const funnel = await client.funnels.create({
  name: 'Sales Pipeline',
  steps: [
    {
      name: 'New Lead',
      step_type: 'active',
      color: 'blue',
    },
    {
      name: 'Qualified',
      step_type: 'active',
      color: 'cyan',
    },
    {
      name: 'Won',
      step_type: 'success',
      color: 'green',
    },
    {
      name: 'Lost',
      step_type: 'failure',
      color: 'red',
    },
  ],
});

console.log(funnel.id);
{
  "id": "1CLJt2v6pHdDoet4Thyb5M",
  "type": "funnel",
  "name": "Sales Pipeline",
  "steps": [
    {
      "id": "1CLJt2v5pkpkAnvdgXfEcF",
      "type": "funnel_step",
      "step_type": "active",
      "name": "New Lead",
      "color": "blue"
    },
    {
      "id": "1CLJt2v6592N5WQzNpjpj2",
      "type": "funnel_step",
      "step_type": "active",
      "name": "Qualified",
      "color": "cyan"
    },
    {
      "id": "1CLJt2v6KXDyzDuM57pQqo",
      "type": "funnel_step",
      "step_type": "success",
      "name": "Won",
      "color": "green"
    },
    {
      "id": "1CLJt2v6ZuRbtwPhmQtzxa",
      "type": "funnel_step",
      "step_type": "failure",
      "name": "Lost",
      "color": "red"
    }
  ],
  "created_at": "2025-02-17T16:00:00.000Z",
  "updated_at": "2025-02-17T16:00:00.000Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.moonbase.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Body

application/json

The Funnel object to be created.

Parameters for creating a funnel.

name
string
required

The name of the funnel.

steps
FunnelStepParams · object[]

An ordered list of steps to create. Array order determines step order.

Response

Successful response.

A Funnel represents a series of steps used to track progression.

type
string
required

String representing the object’s type. Always funnel for this object.

Allowed value: "funnel"
id
string
required

Unique identifier for the object.

name
string
required

The name of the funnel.

steps
FunnelStep · object[]
required

An ordered list of FunnelStep objects that make up the funnel.

created_at
string<date-time>
required

Time at which the object was created, as an ISO 8601 timestamp in UTC.

updated_at
string<date-time>
required

Time at which the object was last updated, as an ISO 8601 timestamp in UTC.