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. AcceptsminLength,maxLength, andpattern. - •
email— Email input with built-in format validation. - •
textarea— Multi-line text area. Supportsrowsfor visible height. - •
select— Dropdown with anoptionsarray of{ "label", "value" }pairs. - •
checkbox— Boolean toggle or group of checkboxes whenoptionsis provided. - •
radio— Radio button group. Requires anoptionsarray. - •
file(Pro) — File upload field. Configureaccept,maxSize, andmultiple.
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.