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);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
funnel = moonbase.funnels.create(name: "Sales Pipeline")
puts(funnel)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
funnel = 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",
}],
)
print(funnel.id)package main
import (
"context"
"fmt"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey("My API Key"),
)
funnel, err := client.Funnels.New(context.TODO(), moonbase.FunnelNewParams{
Name: "Sales Pipeline",
Steps: []moonbase.FunnelNewParamsStep{{
Name: "New Lead",
StepType: "active",
Color: "blue",
}, {
Name: "Qualified",
StepType: "active",
Color: "cyan",
}, {
Name: "Won",
StepType: "success",
Color: "green",
}, {
Name: "Lost",
StepType: "failure",
Color: "red",
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", funnel.ID)
}
curl --request POST \
--url https://api.moonbase.ai/v0/funnels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"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"
}
]
}
'{
"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"
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "400",
"title": "Bad Request",
"detail": "The request could not be understood due to malformed syntax or invalid parameters."
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or missing API key or JWT. You should provide your Moonbase API Key or JWT in the authorization header, in the format: \"Authorization: Bearer MOONBASE_API_KEY\""
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "403",
"title": "Forbidden"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "422",
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"pointer": "/name"
}
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "429",
"title": "Too Many Requests"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "500",
"title": "Internal Server Error"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "503",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable, please try again later."
}
]
}Funnels
Create a Funnel
Creates a new funnel.
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);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
funnel = moonbase.funnels.create(name: "Sales Pipeline")
puts(funnel)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
funnel = 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",
}],
)
print(funnel.id)package main
import (
"context"
"fmt"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey("My API Key"),
)
funnel, err := client.Funnels.New(context.TODO(), moonbase.FunnelNewParams{
Name: "Sales Pipeline",
Steps: []moonbase.FunnelNewParamsStep{{
Name: "New Lead",
StepType: "active",
Color: "blue",
}, {
Name: "Qualified",
StepType: "active",
Color: "cyan",
}, {
Name: "Won",
StepType: "success",
Color: "green",
}, {
Name: "Lost",
StepType: "failure",
Color: "red",
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", funnel.ID)
}
curl --request POST \
--url https://api.moonbase.ai/v0/funnels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"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"
}
]
}
'{
"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"
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "400",
"title": "Bad Request",
"detail": "The request could not be understood due to malformed syntax or invalid parameters."
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or missing API key or JWT. You should provide your Moonbase API Key or JWT in the authorization header, in the format: \"Authorization: Bearer MOONBASE_API_KEY\""
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "403",
"title": "Forbidden"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "422",
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"pointer": "/name"
}
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "429",
"title": "Too Many Requests"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "500",
"title": "Internal Server Error"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "503",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable, please try again later."
}
]
}Authorizations
Your Moonbase API key.
Body
application/json
The Funnel object to be created.
Response
Successful response.
A Funnel represents a series of steps used to track progression.
String representing the object’s type. Always funnel for this object.
Allowed value:
"funnel"Unique identifier for the object.
The name of the funnel.
An ordered list of FunnelStep objects that make up the funnel.
Show child attributes
Show child attributes
Time at which the object was created, as an ISO 8601 timestamp in UTC.
Time at which the object was last updated, as an ISO 8601 timestamp in UTC.
⌘I

