Skip to content

Create Form Field

POST/form-fields

Create a new form field.

Attributes

AttributeTypeDescription
namestringMachine-readable field name (used as key in ticket.values). Auto-generated from the title if omitted. Immutable, cannot be changed after creation.
title *stringHuman-readable field label.
descriptionstringOptional help text for the field.
field *enumtext, textarea, radio, checkbox, select, country, rating, section, company, title. The input type of the field.
ordernumberDisplay order within the form.
settingsobject
formId *numberForm this field belongs to.
sectionIdstringParent section field ID, if nested.

Fields marked with * are required.

Request

js
import Confetti from 'confetti'

const confetti = new Confetti({ apiKey: 'your-key' })

const formField = await confetti.formFields.create({
  name: 'example',
  title: 'example',
  field: 'text',
  formId: 1,
})
sh
curl -X POST "https://api.confetti.events/form-fields" \
  -H "Content-Type: application/json" \
  -H "Authorization: apikey your-key" \
  -d '{
  "data": {
    "type": "formField",
    "attributes": {
      "name": "example",
      "title": "example",
      "field": "text"
    }
  }
}'