Skip to main content
Moonbase’s REST API enables programmatic access to your core Moonbase data, including people, organizations, deals, tasks, and more.

Quick Start

Let’s make your first API request to list items from your Moonbase collections.
1

Prerequisites

You’ll need an API key from your organization settings in Moonbase. Once you have it, set it as an environment variable:
export MOONBASE_API_KEY=your_api_key_here
2

List Your Data

Fetch and display all organizations from your collection. The SDK automatically handles pagination to retrieve all details of the organizations collection.
import Moonbase from "@moonbaseai/sdk";

// Initialize the Moonbase client
const moonbase = new Moonbase({
  apiKey: process.env.MOONBASE_API_KEY, // default, can be omitted
});

// This returns an AsyncIterator<Item>
const organizations = moonbase.collections.items.list("organizations");

// Loop through the items and print the "name" value
for await (const org of organizations) {
  console.log(org.values.name.data);
}
Example output:
OrbGrid
TechStart Inc
Global Systems
Innovate Labs
...

Core Concepts

Continue exploring the Moonbase API with these resources:
  • SDKs: Official Moonbase clients for TypeScript, Python, Go, and Ruby
  • Pagination: Navigate large datasets efficiently with cursor-based pagination
  • Rate Limiting: Understand throughput limits and implement proper backoff strategies
  • Error Handling: Learn about error shapes and build resilient retry logic
  • Webhooks: Subscribe to real-time events for changes in your Moonbase data