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 response = await client.search({ query: 'query' });
console.log(response.data);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
response = moonbase.search(query: "query")
puts(response)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
response = client.search(
query="query",
)
print(response.data)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"),
)
response, err := client.Search(context.TODO(), moonbase.SearchParams{
Query: "query",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
curl --request POST \
--url https://api.moonbase.ai/v0/search \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"type": "search_result",
"data": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
},
"values": {
"name": {
"type": "value/text/single_line",
"data": "Albert Einstein"
},
"email": [
{
"type": "value/email",
"data": "person-199@example-199.com"
}
]
}
}
},
{
"type": "search_result",
"data": {
"id": "1CLJt2vA3GEGcxEhVY1EbS",
"type": "file",
"name": "Albert's Report",
"filename": "test.txt",
"size": 3,
"download_url": "https://api.moonbase.ai/asset_redirects/1CLJt2vAY2dWSPDQt8AQpz?token=eyJfcmFpbHMiOnsiZGF0YSI6eyJpZCI6IjFDTEp0MnZBWTJkV1NQRFF0OEFRcHoiLCJibG9iX2lkIjoiMUNMSnQydkFIZVJ0WGZqNEJxNXBpRCIsImNyZWF0ZWRfYXQiOiIyMDI1LTAyLTE3VDE2OjAwOjAwLjAwMFoiLCJuYW1lIjoiZmlsZSIsInJlY29yZF9pZCI6IjFDTEp0MnZBM0dFR2N4RWhWWTFFYlMiLCJyZWNvcmRfdHlwZSI6IkxpYnJhcnlBc3NldCJ9LCJleHAiOiIyMDI1LTAyLTE3VDE3OjAwOjAwLjAwMFoiLCJwdXIiOiJyZWRpcmVjdCJ9fQ--a28630b2b8f96fb7473e36c0f73cc8495b49e72b",
"associations": [],
"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": "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."
}
]
}Search
Search Items
Returns items and files that match the search query.
POST
/
search
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 response = await client.search({ query: 'query' });
console.log(response.data);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
response = moonbase.search(query: "query")
puts(response)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
response = client.search(
query="query",
)
print(response.data)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"),
)
response, err := client.Search(context.TODO(), moonbase.SearchParams{
Query: "query",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
curl --request POST \
--url https://api.moonbase.ai/v0/search \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"type": "search_result",
"data": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
},
"values": {
"name": {
"type": "value/text/single_line",
"data": "Albert Einstein"
},
"email": [
{
"type": "value/email",
"data": "person-199@example-199.com"
}
]
}
}
},
{
"type": "search_result",
"data": {
"id": "1CLJt2vA3GEGcxEhVY1EbS",
"type": "file",
"name": "Albert's Report",
"filename": "test.txt",
"size": 3,
"download_url": "https://api.moonbase.ai/asset_redirects/1CLJt2vAY2dWSPDQt8AQpz?token=eyJfcmFpbHMiOnsiZGF0YSI6eyJpZCI6IjFDTEp0MnZBWTJkV1NQRFF0OEFRcHoiLCJibG9iX2lkIjoiMUNMSnQydkFIZVJ0WGZqNEJxNXBpRCIsImNyZWF0ZWRfYXQiOiIyMDI1LTAyLTE3VDE2OjAwOjAwLjAwMFoiLCJuYW1lIjoiZmlsZSIsInJlY29yZF9pZCI6IjFDTEp0MnZBM0dFR2N4RWhWWTFFYlMiLCJyZWNvcmRfdHlwZSI6IkxpYnJhcnlBc3NldCJ9LCJleHAiOiIyMDI1LTAyLTE3VDE3OjAwOjAwLjAwMFoiLCJwdXIiOiJyZWRpcmVjdCJ9fQ--a28630b2b8f96fb7473e36c0f73cc8495b49e72b",
"associations": [],
"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": "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
The search text to match against items and files.
⌘I

