JavaScript
import Moonbase from '@moonbaseai/sdk';
const client = new Moonbase({
apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const programTemplate of client.programTemplates.list()) {
console.log(programTemplate.id);
}require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
page = moonbase.program_templates.list
puts(page)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
page = client.program_templates.list()
page = page.data[0]
print(page.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"),
)
page, err := client.ProgramTemplates.List(context.TODO(), moonbase.ProgramTemplateListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.moonbase.ai/v0/program_templates \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"id": "1CLJt2v7opRhSWqVEtHwYT",
"type": "program_template",
"subject": "Test Subject to {{ person.name }}",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
},
{
"id": "1CLJt2v6pHdDoet4Thyb5M",
"type": "program_template",
"subject": "Join your team",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
},
{
"id": "1CLJt2v6ZuRbtwPhmQtzxa",
"type": "program_template",
"subject": "Test Subject to {{ person.name }}",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
},
{
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "program_template",
"subject": "Verify your email",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
}
],
"meta": {
"cursors": {}
}
}{
"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": "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."
}
]
}Program Templates
List Program Templates
Returns a list of your program templates.
GET
/
program_templates
JavaScript
import Moonbase from '@moonbaseai/sdk';
const client = new Moonbase({
apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const programTemplate of client.programTemplates.list()) {
console.log(programTemplate.id);
}require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
page = moonbase.program_templates.list
puts(page)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
page = client.program_templates.list()
page = page.data[0]
print(page.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"),
)
page, err := client.ProgramTemplates.List(context.TODO(), moonbase.ProgramTemplateListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.moonbase.ai/v0/program_templates \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"id": "1CLJt2v7opRhSWqVEtHwYT",
"type": "program_template",
"subject": "Test Subject to {{ person.name }}",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
},
{
"id": "1CLJt2v6pHdDoet4Thyb5M",
"type": "program_template",
"subject": "Join your team",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
},
{
"id": "1CLJt2v6ZuRbtwPhmQtzxa",
"type": "program_template",
"subject": "Test Subject to {{ person.name }}",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
},
{
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "program_template",
"subject": "Verify your email",
"body": {
"markdown": "Message content"
},
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
}
],
"meta": {
"cursors": {}
}
}{
"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": "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.
Query Parameters
When specified, returns results starting immediately before the item identified by this cursor. Use the cursor value from the response's metadata to fetch the previous page of results.
When specified, returns results starting immediately after the item identified by this cursor. Use the cursor value from the previous response's metadata to fetch the next page of results.
Maximum number of items to return per page. Must be between 1 and 100. Defaults to 20 if not specified.
Required range:
1 <= x <= 100Specifies which related objects to include in the response. Valid option is program.
Available options:
program Response
Successful response.
A set of results using cursor-based pagination.
⌘I

