🎉 Limited-time Pro launch offer — Get 30% off today
Kreebi FormsKreebi Forms

JSON Definitions

For developers who prefer code over drag-and-drop, Kreebi Forms supports defining forms entirely through JSON. This is ideal for version-controlled configurations, programmatic form generation, and CI/CD workflows.

Schema Overview

A form definition is a single JSON object with a top-level title, settings block, and a fields array. Each entry in fields describes one form control.

{
  "title": "Contact Us",
  "settings": {
    "submitLabel": "Send Message",
    "successMessage": "Thanks! We'll be in touch.",
    "notification": {
      "to": "hello@example.com",
      "subject": "New contact form submission"
    }
  },
  "fields": [
    {
      "type": "text",
      "name": "full_name",
      "label": "Full Name",
      "placeholder": "Jane Doe",
      "required": true
    },
    {
      "type": "email",
      "name": "email",
      "label": "Email Address",
      "placeholder": "jane@example.com",
      "required": true
    },
    {
      "type": "textarea",
      "name": "message",
      "label": "Message",
      "placeholder": "How can we help?",
      "rows": 5,
      "required": true
    }
  ]
}

Supported Field Types

The following field types are available out of the box:

  • •text — Single-line text input. Accepts minLength, maxLength, and pattern.
  • •email — Email input with built-in format validation.
  • •textarea — Multi-line text area. Supports rows for visible height.
  • •select — Dropdown with an options array of { "label", "value" } pairs.
  • •checkbox — Boolean toggle or group of checkboxes when options is provided.
  • •radio — Radio button group. Requires an options array.
  • •file (Pro) — File upload field. Configure accept, maxSize, and multiple.

Field Object Structure

Every field object shares a set of common properties:

{
  "type": "text",           // Required — field type
  "name": "field_name",     // Required — unique identifier
  "label": "Field Label",   // Display label
  "placeholder": "...",     // Placeholder text
  "required": true,         // Validation flag
  "defaultValue": "",       // Pre-filled value
  "width": "full",          // "full" | "half"
  "conditionalLogic": {     // Pro: show/hide rules
    "action": "show",
    "rules": [
      { "field": "other_field", "operator": "equals", "value": "yes" }
    ]
  }
}

Importing via REST API

You can create or update forms programmatically by POSTing JSON to the Kreebi Forms REST endpoint:

POST /wp-json/kreebi/v1/forms
Content-Type: application/json
Authorization: Bearer YOUR_APP_PASSWORD

{
  "title": "Feedback Form",
  "fields": [ ... ]
}

The API returns the new form ID and shortcode on success. See the REST API reference for full endpoint documentation.