Skip to main content
GET
/
collections
/
{collection_id}
/
items
JavaScript
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);
}
{
  "type": "list",
  "data": [
    {
      "id": "1CLJt2v6pHdDoet4Thyb5M",
      "type": "item",
      "collection": {
        "id": "1CLJt2v5aNd8G5SGzEaeVU",
        "type": "collection",
        "ref": "test_collection_106"
      }
    },
    {
      "id": "1CLJt2v8oMEB5Nnv24cJ1Z",
      "type": "item",
      "collection": {
        "id": "1CLJt2v5aNd8G5SGzEaeVU",
        "type": "collection",
        "ref": "test_collection_106"
      }
    }
  ],
  "meta": {
    "cursors": {}
  }
}

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.

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Path Parameters

collection_id
string
required

The ID of the collection.

Query Parameters

before
string

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.

after
string

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.

limit
integer
default:20

Maximum number of items to return per page. Must be between 1 and 100. Defaults to 20 if not specified.

Required range: 1 <= x <= 100
sort[]
string[]

Sort items by the specified field ids or keys. Prefix a field with a hyphen/minus (-) to sort in descending order by that field.

Response

Successful response.

A set of results using cursor-based pagination.

type
string
required
Allowed value: "list"
data
ItemPointer · object[]
required

An array of ItemPointer items.

meta
object
required

Metadata about the pagination, including the cursors pointing to the previous and next pages.