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.
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.
TypeScript
Python
Go
Ruby
cURL
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
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
...
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
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 os
from moonbase import Moonbase
moonbase = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # default, can be omitted
)
# Auto-paginated: fetches all items across multiple pages
organizations = moonbase.collections.items.list(collection_id="organizations")
# Loop through items and access fields by their ref
for org in organizations:
print(org.values['name'].data)
Example output:OrbGrid
TechStart Inc
Global Systems
Innovate Labs
...
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
List Your Data
Fetch and display all organizations from your collection. The SDK automatically handles pagination to retrieve all details of the organizations collection.package main
import (
"context"
"fmt"
"log"
"os"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey(os.Getenv("MOONBASE_API_KEY")), // default, can be omitted
)
// Auto-paginated: fetches all items across multiple pages
organizations := client.Collections.Items.ListAutoPaging(
context.TODO(),
"organizations",
moonbase.ItemListParams{},
)
for organizations.Next() {
org := organizations.Current()
if nameField, exists := org.Values["name"]; exists {
fmt.Println(nameField.Data.OfString)
}
}
if err := organizations.Err(); err != nil {
log.Fatalf("Error fetching organizations: %v", err)
}
}
Example output:OrbGrid
TechStart Inc
Global Systems
Innovate Labs
...
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
List Your Data
Fetch and display all organizations from your collection. The SDK automatically handles pagination to retrieve all details of the organizations collection.require "moonbase"
moonbase = Moonbase::Client.new(
api_key: ENV["MOONBASE_API_KEY"], # default, can be omitted
)
organizations = moonbase.collections.items.list("organizations")
organizations.auto_paging_each do |org|
puts org.values[:name].data
end
Example output:OrbGrid
TechStart Inc
Global Systems
Innovate Labs
...
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
List Items from a Collection
Make a GET request to retrieve items from a collection:curl https://api.moonbase.ai/v0/collections/organizations/items \
-H "Authorization: Bearer $MOONBASE_API_KEY"
Note: This returns the first page of results. To fetch additional pages, use the cursor from the response. Understanding the Response
A successful response returns a JSON object with your items:{
"type": "list",
"data": [
{
"id": "1CLJt2ub4MavjpDF6NV14F",
"type": "item",
"values": {
"name": {"type": "value/text/single_line", "data": "OrbGrid"},
"updated_at": {"type": "value/datetime", "data": "2025-02-17T16:00:00.000Z"}
}
},
{
"id": "1CLJt2ub4MavjpDF6NV14G",
"type": "item",
"values": {
"name": {"type": "value/text/single_line", "data": "TechStart Inc"},
"updated_at": {"type": "value/datetime", "data": "2025-02-17T16:00:00.000Z"}
}
},
{
"id": "1CLJt2ub4MavjpDF6NV14H",
"type": "item",
"values": {
"name": {"type": "value/text/single_line", "data": "Global Systems"},
"updated_at": {"type": "value/datetime", "data": "2025-02-17T16:00:00.000Z"}
}
}
...
],
"meta": {
"cursors": {
"next": "eyJwYWdlIjoyfQ"
}
}
}
To fetch the next page, include the cursor as a query parameter:curl "https://api.moonbase.ai/v0/collections/organizations/items?after=eyJwYWdlIjoyfQ" \
-H "Authorization: Bearer $MOONBASE_API_KEY"
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