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 item = await client.collections.items.retrieve('id', { collection_id: 'collection_id' });
console.log(item.id);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
item = moonbase.collections.items.retrieve("id", collection_id: "collection_id")
puts(item)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
item = client.collections.items.retrieve(
id="id",
collection_id="collection_id",
)
print(item.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"),
)
item, err := client.Collections.Items.Get(
context.TODO(),
"id",
moonbase.CollectionItemGetParams{
CollectionID: "collection_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", item.ID)
}
curl --request GET \
--url https://api.moonbase.ai/v0/collections/{collection_id}/items/{id} \
--header 'Authorization: Bearer <token>'{
"id": "1CLJt2vEzvEeoG1qPRazvx",
"type": "item",
"collection": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "collection",
"ref": "test_collection_143"
},
"values": {
"name": {
"type": "value/text/single_line",
"data": "Aperture Science"
},
"decision_maker": {
"type": "value/relation",
"data": {
"id": "1CLJt2vCmUS5cpcd8mshsy",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
}
},
"created_at": {
"type": "value/datetime",
"data": "2025-02-17T16:00:00.000Z"
},
"updated_at": {
"type": "value/datetime",
"data": "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": "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."
}
]
}Items
Retrieve an Item
Retrieves the details of an existing item.
GET
/
collections
/
{collection_id}
/
items
/
{id}
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 item = await client.collections.items.retrieve('id', { collection_id: 'collection_id' });
console.log(item.id);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
item = moonbase.collections.items.retrieve("id", collection_id: "collection_id")
puts(item)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
item = client.collections.items.retrieve(
id="id",
collection_id="collection_id",
)
print(item.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"),
)
item, err := client.Collections.Items.Get(
context.TODO(),
"id",
moonbase.CollectionItemGetParams{
CollectionID: "collection_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", item.ID)
}
curl --request GET \
--url https://api.moonbase.ai/v0/collections/{collection_id}/items/{id} \
--header 'Authorization: Bearer <token>'{
"id": "1CLJt2vEzvEeoG1qPRazvx",
"type": "item",
"collection": {
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "collection",
"ref": "test_collection_143"
},
"values": {
"name": {
"type": "value/text/single_line",
"data": "Aperture Science"
},
"decision_maker": {
"type": "value/relation",
"data": {
"id": "1CLJt2vCmUS5cpcd8mshsy",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
}
},
"created_at": {
"type": "value/datetime",
"data": "2025-02-17T16:00:00.000Z"
},
"updated_at": {
"type": "value/datetime",
"data": "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": "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.
Response
Successful response.
An Item represents a single record or row within a Collection. It holds a set of values corresponding to the Collection's fields.
String representing the object’s type. Always item for this object.
Allowed value:
"item"Unique identifier for the object.
A lightweight reference to a Collection, containing the minimal information needed to identify it.
Show child attributes
Show child attributes
A hash where keys are the ref of a Field and values are the data stored for that field.
Show child attributes
Show child attributes
⌘I

