Forms
GET forms/<id> gives a live form, as visitors get it. POST forms/<id>/submit sends an answer.
A form
fieldsholdname,type,label,required,placeholder,icon,optionsandshow. The types aretext,textarea,email,tel,number,url,date,slot,select,choice,multi,checkbox,fileandhidden.from_querynames a parameter of the page address that fills the field in, such asemailfor?email=…. Ahiddenfield always has it. Withquery_lock: true, a field filled in that way cannot be changed by the visitor; without the parameter it stays open.- An
emailfield can haveemail: {require: [...], exclude: [...]}, with domains it must, or must not, be of. A subdomain counts too, somail.gmail.comis ingmail.com. The CMS checks it again when the answer comes in. - A field that is switched off in the CMS is not in
fields. stepsis[]for one screen. Otherwise it is[{title, fields, show}]. Draw one step at a time, with Next and Back.submit,noteandsuccess_htmlare given per language.
Show when
A field or step has show. It is null, or {match: "all"|"any", rules: [{field, op, value, i}]}. A rule only names a field before it.
The values of op are eq, ne, contains, starts, ends, in, filled, empty, gt, gte, lt, lte and regex. A field that does not show is never required, and it is not sent.
Sending
POST forms/<id>/submit
{"answers": {…}, "lang": "en", "page": "/contact/", "seconds": 14.2}- Check your honeypot first.
secondsis how long filling in took. - With a file field, send
multipart/form-data. Put the JSON in the partpayload, and the files asfiles[<field>][<n>]. - The answer has
status, andsuccess_htmlwith the answers filled in. It also hasmessage, from a service that the visitor waited for. - A suspect answer gets the same answer as any other. Never tell a sender that it was held.
- On an environment that is not live, an answer is kept as a test, and it is sent nowhere. It says
"test": true.
Webhooks from a form
A webhook integration posts {text, form, values, page, summary, event, delivery, files?}. It sends these headers:
X-Signature: t=<unix>,v1=<hex>. That is HMAC-SHA256 with the signing secret of the integration, over<t>.<raw body>.X-Lightbolt-Event: form.submitted.X-Lightbolt-Delivery. It stays the same when it is sent again, so skip a repeat.
Refuse a t that is older than five minutes.
Also called: form API, form submissions, form webhooks, conditional logic, file uploads.
Last changed