Skip to main content
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);
}
{
  "type": "list",
  "data": [
    {
      "id": "1CLJt2v3LvpZ5e34jasMSV",
      "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": "1CLJt2v2MQ25Sn5dxQYzyP",
      "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": "1CLJt2v271pTY4bHG7UQrc",
      "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": "1CLJt2v17V1yuCdrUwA4PW",
      "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": {}
  }
}

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Query Parameters

before
string

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.

after
string

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.

limit
integer
default:20

Maximum number of items to return per page. Must be between 1 and 100. Defaults to 20 if not specified.

Required range: 1 <= x <= 100
include[]
enum<string>[]

Specifies 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.

type
string
required
Allowed value: "list"
data
ProgramTemplate · object[]
required

An array of ProgramTemplate items.

meta
object
required

Metadata about the pagination, including the cursors pointing to the previous and next pages.