Skip to main content
GET
/
collections
/
{collection_id}
/
fields
/
{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 field = await client.collections.fields.retrieve('id', { collection_id: 'collection_id' });

console.log(field);
{
  "id": "1CLJt2v1rdcqdM6vZpPpjq",
  "type": "field/choice",
  "created_at": "2025-02-17T16:00:00.000Z",
  "updated_at": "2025-02-17T16:00:00.000Z",
  "options": [
    {
      "id": "1CLJt2v17V1yuCdrUwA4PW",
      "type": "choice_field_option",
      "name": "CEO Approval"
    },
    {
      "id": "1CLJt2v1MsDbov8DBEEeWH",
      "type": "choice_field_option",
      "name": "CTO Approval"
    },
    {
      "id": "1CLJt2v1cFRDidcZsXKEd4",
      "type": "choice_field_option",
      "name": "Legal"
    }
  ],
  "name": "Buyer Criteria",
  "ref": "buyer_criteria",
  "description": "A field representing the internal approvals required before proceeding. Each selected value corresponds to a specific approval category. Possible values include:\n\"CEO Approval\" – Approval from the Chief Executive Officer\n\"CTO Approval\" – Approval from the Chief Technology Officer\n\"Legal\" – Approval or review by the Legal department\n",
  "cardinality": "many",
  "required": false,
  "unique": false,
  "readonly": false,
  "core": false
}

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Path Parameters

collection_id
string
required

The ID or ref of the Collection the field belongs to.

id
string
required

The ID or ref of the Field to retrieve.

Response

Successful response.

A field definition, which varies by type

type
string
required

The data type of the field. Always field/text/single_line for this field.

Allowed value: "field/text/single_line"
id
string
required

Unique identifier for the object.

name
string
required

The human-readable name of the field (e.g., "Company Name").

ref
string
required

A unique, stable, machine-readable identifier for the field within its collection (e.g., company_name).

cardinality
enum<string>
required

Specifies whether the field can hold a single value (one) or multiple values (many).

Available options:
one,
many
required
boolean
required

If true, this field must have a value.

unique
boolean
required

If true, values for this field must be unique across all items in the collection.

readonly
boolean
required

If true, the value of this field is system-managed and cannot be updated via the API.

core
boolean
required

If true, this is a built-in field included by default.

created_at
string<date-time>
required

Time at which the object was created, as an ISO 8601 timestamp in UTC.

updated_at
string<date-time>
required

Time at which the object was last updated, as an ISO 8601 timestamp in UTC.

description
string

An optional, longer-form description of the field's purpose.