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": "1CLJt2v17V1yuCdrUwA4PW",
  "type": "form",
  "name": "Contact Us",
  "pages_enabled": false,
  "pages_url": "https://moonbase.page/1CLJt2v17V1yuCdrUwA4PW",
  "collection": {
    "id": "1CLJt2v1MsDbov8DBEEeWH",
    "type": "collection",
    "name": "Form: Contact Us",
    "ref": "form_1cljt2v17v1yucdruwa4pw",
    "core": false,
    "fields": [
      {
        "id": "1CLJt2v4aqpedDUrD4GJ2N",
        "type": "field/geo",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Country",
        "ref": "country",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v5pkpkAnvdgXfEcF",
        "type": "field/datetime",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Created At",
        "ref": "created_at",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": true,
        "core": true
      },
      {
        "id": "1CLJt2v5KzRWMMwvHwW4Nh",
        "type": "field/choice",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "options": [
          {
            "id": "smart-tv",
            "type": "choice_field_option",
            "name": "Smart TV"
          },
          {
            "id": "tablet",
            "type": "choice_field_option",
            "name": "Tablet"
          },
          {
            "id": "mobile",
            "type": "choice_field_option",
            "name": "Mobile"
          },
          {
            "id": "desktop",
            "type": "choice_field_option",
            "name": "Desktop"
          }
        ],
        "name": "Device Type",
        "ref": "device_type",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v1rdcqdM6vZpPpjq",
        "type": "field/email",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Email",
        "ref": "email",
        "cardinality": "one",
        "required": true,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v1cFRDidcZsXKEd4",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Name",
        "ref": "name",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v2bnDhMVZzehdb6A",
        "type": "field/relation",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "relation_type": "two_way",
        "allowed_collections": [
          {
            "id": "1CLJt2uco2zG6pdjxS37sg",
            "type": "collection",
            "ref": "organizations"
          }
        ],
        "name": "Organization",
        "ref": "organization",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v271pTY4bHG7UQrc",
        "type": "field/relation",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "relation_type": "two_way",
        "allowed_collections": [
          {
            "id": "1CLJt2ubZ7zAZFBxUxeBHo",
            "type": "collection",
            "ref": "people"
          }
        ],
        "name": "Person",
        "ref": "person",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v4qE2GXvyCuMLt99",
        "type": "field/geo",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Region",
        "ref": "region",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v55cDtSeTZbeRUFv",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Time Zone",
        "ref": "time_zone",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v6592N5WQzNpjpj2",
        "type": "field/datetime",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "Updated At",
        "ref": "updated_at",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": true,
        "core": true
      },
      {
        "id": "1CLJt2v4LTd2iVzVWmBhub",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "User Agent",
        "ref": "user_agent",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v3bK2AzMXRRswwZG",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "UTM Campaign",
        "ref": "utm_campaign",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v465RQonW8pU77np",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "UTM Content",
        "ref": "utm_content",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v3LvpZ5e34jasMSV",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "UTM Medium",
        "ref": "utm_medium",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v36YcwAvYi3HnmKi",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "UTM Source",
        "ref": "utm_source",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      },
      {
        "id": "1CLJt2v3qhDnu51n8B2Xg3",
        "type": "field/text/single_line",
        "created_at": "2025-02-17T16:00:00.000Z",
        "updated_at": "2025-02-17T16:00:00.000Z",
        "name": "UTM Term",
        "ref": "utm_term",
        "cardinality": "one",
        "required": false,
        "unique": false,
        "readonly": false,
        "core": true
      }
    ],
    "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"
}

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

true if the form is available at a public URL.

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<uri>

An optional URL to redirect users to after a successful submission.

pages_url
string<uri>

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