Skip to main content
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);
{
  "id": "1CLJt2vAHeRtXfj4Bq5piD",
  "type": "item",
  "collection": {
    "id": "1CLJt2v17V1yuCdrUwA4PW",
    "type": "collection",
    "ref": "test_collection_29"
  },
  "values": {
    "name": {
      "type": "value/text/single_line",
      "data": "Aperture Science"
    },
    "decision_maker": {
      "type": "value/relation",
      "data": {
        "id": "1CLJt2v8JapwFwpCdUT7n1",
        "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"
    }
  }
}

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Path Parameters

collection_id
string
required
id
string
required

The ID of the Item to retrieve.

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.

type
string
required

String representing the object’s type. Always item for this object.

Allowed value: "item"
id
string
required

Unique identifier for the object.

collection
CollectionPointer · object
required

A lightweight reference to a Collection, containing the minimal information needed to identify it.

values
object
required

A hash where keys are the ref of a Field and values are the data stored for that field.