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 itemPointer of client.collections.items.list('collection_id')) {
console.log(itemPointer.id);
}require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
page = moonbase.collections.items.list("collection_id")
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.collections.items.list(
collection_id="collection_id",
)
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.Collections.Items.List(
context.TODO(),
"collection_id",
moonbase.CollectionItemListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.moonbase.ai/v0/collections/{collection_id}/items \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"id": "1CLJt2v6pHdDoet4Thyb5M",
"type": "item",
"collection": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "collection",
"ref": "test_collection_131"
}
},
{
"id": "1CLJt2v8oMEB5Nnv24cJ1Z",
"type": "item",
"collection": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "collection",
"ref": "test_collection_131"
}
}
],
"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": "404",
"title": "Not Found"
}
]
}{
"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."
}
]
}List Items
Returns a paginated list of item pointers in a collection. Use the retrieve endpoint to get full item details including field values.
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 itemPointer of client.collections.items.list('collection_id')) {
console.log(itemPointer.id);
}require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
page = moonbase.collections.items.list("collection_id")
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.collections.items.list(
collection_id="collection_id",
)
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.Collections.Items.List(
context.TODO(),
"collection_id",
moonbase.CollectionItemListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.moonbase.ai/v0/collections/{collection_id}/items \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"id": "1CLJt2v6pHdDoet4Thyb5M",
"type": "item",
"collection": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "collection",
"ref": "test_collection_131"
}
},
{
"id": "1CLJt2v8oMEB5Nnv24cJ1Z",
"type": "item",
"collection": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "collection",
"ref": "test_collection_131"
}
}
],
"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": "404",
"title": "Not Found"
}
]
}{
"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.
Path Parameters
The ID of the collection.
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.
1 <= x <= 100Sort items returned by the specified fields, specified directly by (name) or through relations (organization.name, deals.owner.email). Prefix with a hyphen/minus (-) to sort in descending order.
Response
Successful response.
A set of results using cursor-based pagination.

