Skip to main content
GET
/
forms
/
{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 form = await client.forms.retrieve('id');

console.log(form.id);
{
  "id": "1CLJt2v5aNd8G5SGzEaeVU",
  "type": "form",
  "name": "Contact Us",
  "pages_enabled": false,
  "business_email_required": false,
  "pages_url": "https://moonbase.page/1CLJt2v5aNd8G5SGzEaeVU",
  "collection": {
    "id": "1CLJt2v5pkpkAnvdgXfEcF",
    "type": "collection",
    "name": "Form: Contact Us",
    "ref": "form_1cljt2v5and8g5sgzeaevu",
    "kind": "form",
    "fields": [
      {
        "id": "1CLJt2v93jRnz6HGiMgt8L",
        "type": "field/geo",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Country",
        "ref": "country",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2vAHeRtXfj4Bq5piD",
        "type": "field/datetime",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Created At",
        "ref": "created_at",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": true,
        "kind": "system"
      },
      {
        "id": "1CLJt2v9nt2eiEkLoEveUf",
        "type": "field/choice",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "options": [
          {
            "id": "smart-tv",
            "type": "choice_field_option",
            "name": "Smart TV",
            "color": "red"
          },
          {
            "id": "tablet",
            "type": "choice_field_option",
            "name": "Tablet",
            "color": "blue"
          },
          {
            "id": "mobile",
            "type": "choice_field_option",
            "name": "Mobile",
            "color": "green"
          },
          {
            "id": "desktop",
            "type": "choice_field_option",
            "name": "Desktop",
            "color": "orange"
          }
        ],
        "name": "Device Type",
        "ref": "device_type",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v6KXDyzDuM57pQqo",
        "type": "field/email",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Email",
        "ref": "email",
        "cardinality": "one",
        "required": true,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v6592N5WQzNpjpj2",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Name",
        "ref": "name",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v74fpqiNNRA14BC8",
        "type": "field/relation",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "relation_type": "two_way",
        "allowed_collections": [
          {
            "id": "1CLJt2uco2zG6pdjxS37sg",
            "type": "collection",
            "ref": "organizations"
          }
        ],
        "reverse_field_name": "Form: Contact Us",
        "reverse_fields": [
          {
            "id": "1CLJt2vBHBENAXgUy1QBBK",
            "type": "field",
            "collection": {
              "id": "1CLJt2uco2zG6pdjxS37sg",
              "type": "collection",
              "ref": "organizations"
            },
            "ref": "form_contact_us"
          }
        ],
        "name": "Organization",
        "ref": "organization",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v6ZuRbtwPhmQtzxa",
        "type": "field/relation",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "relation_type": "two_way",
        "allowed_collections": [
          {
            "id": "1CLJt2ubZ7zAZFBxUxeBHo",
            "type": "collection",
            "ref": "people"
          }
        ],
        "reverse_field_name": "Form: Contact Us",
        "reverse_fields": [
          {
            "id": "1CLJt2vAnQq8M6hmaREzwm",
            "type": "field",
            "collection": {
              "id": "1CLJt2ubZ7zAZFBxUxeBHo",
              "type": "collection",
              "ref": "people"
            },
            "ref": "form_contact_us"
          }
        ],
        "name": "Person",
        "ref": "person",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v9J7dQtomdQemUF7",
        "type": "field/geo",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Region",
        "ref": "region",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v9YVq2oXFz6wr4Mt",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Time Zone",
        "ref": "time_zone",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2vAY2dWSPDQt8AQpz",
        "type": "field/datetime",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "Updated At",
        "ref": "updated_at",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": true,
        "kind": "system"
      },
      {
        "id": "1CLJt2v8oMEB5Nnv24cJ1Z",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "User Agent",
        "ref": "user_agent",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v84CdKMEKqwBNXfE",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "UTM Campaign",
        "ref": "utm_campaign",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v8Yy2ZAfJZKmXhtn",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "UTM Content",
        "ref": "utm_content",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v7opRhSWqVEtHwYT",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "UTM Medium",
        "ref": "utm_medium",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v7ZSE5XoM8YbDMRg",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "UTM Source",
        "ref": "utm_source",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      },
      {
        "id": "1CLJt2v8JapwFwpCdUT7n1",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "default_values": [],
        "name": "UTM Term",
        "ref": "utm_term",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "kind": "system"
      }
    ],
    "created_at": "2025-02-17T16:00:00.000Z",
    "updated_at": "2025-02-17T16:00:00.000Z"
  },
  "created_at": "2025-02-17T16:00:00.000Z",
  "updated_at": "2025-02-17T16:00:00.000Z"
}

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

id
string
required

The ID of the Form to retrieve.

Response

Successful response.

A Form provides a way to create Items in a Collection, often via a public URL for external users. Each form submission creates a new item.

type
string
required

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

Allowed value: "form"
id
string
required

Unique identifier for the object.

name
string
required

The name of the form, used as the title on its public page.

pages_enabled
boolean
required

If true, a Moonbase Pages hosted page is enabled for this form, providing a standalone public URL for sharing.

business_email_required
boolean
required

true if submissions require a business email address, blocking free and disposable providers.

collection
Collection · object
required

The Collection that submissions to this form are saved to.

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.

redirect_url
string

Optional URL the user is redirected to after a successful submission. When unset, no redirect occurs. Stored as a Liquid template; rendered at submission time with form field values under submission.<key> (keyed by the field's key) plus UTM params (utm_source, utm_medium, utm_campaign, utm_term, utm_content) automatically appended. Use the uri_encode filter for URL-safe values, e.g. https://example.com/thanks?email={{ submission.email | uri_encode }}. The rendered URL must parse as a valid URL or the submission errors.

pages_url
string<uri>

The public URL for the form, if pages_enabled is true.