Schema

This document describes the statickit.json schema. Here are the available top-level keys:

KeyTypeDescription
formsObjectAn object defining the forms for your site

Forms

An Object defining forms for your site.

KeyTypeDescription
name *StringThe name of the form
actionsArrayAn Array of actions to perform after submission
fieldsObjectOptional metadata about form fields
allowExtraFieldsBooleanWhether to accept fields not defined under fields. Default: true

Usage Example

{
  "forms": {
    "contact": {
      "name": "Contact Form"
    }
  }
}

Actions

An Array of actions to perform after the form is submitted.

{
   "forms": {
    "contact": {
      "name": "Contact Form",
      "actions": [
        {
          "type": "email",
          "to": "[email protected]"
        },
        {
          "type": "webhook",
          "url": "http://example.com/hook"
        }
      ]
    }
  }
}

Email Notification

Sends a notification email.

KeyTypeDescription
to *StringThe email address of the recipient

Usage Example

{
  "forms": {
    "contact": {
      "name": "Contact Form",
      "actions": [
        {
          "type": "email",
          "to": "[email protected]"
        }
      ]
    }
  }
}

Webhook

Sends a webhook (HTTP POST) to a given url.

KeyTypeDescription
url *StringThe endpoint to send the POST request

Usage Example

{
  "forms": {
    "contact": {
      "name": "Contact Form",
      "actions": [
        {
          "type": "webhook",
          "url": "http://example.com/hook"
        }
      ]
    }
  }
}

Fields

An Object containing optional field metadata.

Note: By default, StaticKit will accept any fields you pass in from the client-side. However, defining your fields here allows you to add validations (such as marking a field as required) and give them human-friendly names.

Field objects can contain the following properties:

KeyTypeDescription
typeStringThe field type (text, email)
prettyNameStringThe human-friendly name of the field
requiredBooleanSpecifies whether the field is required

Usage Example

{
  "forms": {
    "contact": {
      "name": "Contact Form",
      "fields": {
        "email": {
          "type": "email",
          "prettyName": "Email address",
          "required": true
        }
      }
    }
  }
}