Create form
Create a new form with a name and its questions, not yet published.
POST https://cotlet.dev/api/v1/fillout/forms
Creates a form with one question per entry, in the order given, and returns its ID and the questions with their types. A question without a type becomes ShortAnswer; options are for Dropdown, MultipleChoice and Checkboxes. The form is not published, so no respondent can reach it before publish_form. This call reaches no one and is undone by deleting the form in the dashboard, so it runs without asking first.
Parameters
| Name | Type | Description |
|---|---|---|
| name string required | string | Form name. |
| questions array required | array | Questions in order. Each item: label (required), type (Address, AudioRecording, Calcom, Calendly, Captcha, Checkbox, Checkboxes, ColorPicker, CurrencyInput, DatePicker, DateRange, DateTimePicker, Dropdown, EmailInput, FileUpload, ImagePicker, LocationCoordinates, LongAnswer, Matrix, MultiSelect, MultipleChoice, NumberInput, OpinionScale, Password, Payment, PhoneNumber, Ranking, RecordPicker, ShortAnswer, Signature, Slider, StarRating, Subform, SubmissionPicker, Switch, Table, TimePicker or URLInput. Default: ShortAnswer) and options (array of strings, for choice types). |
Request
curl -X POST https://cotlet.dev/api/v1/fillout/forms \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Webinar registration","questions":[{"label":"Full name","type":"ShortAnswer"},{"label":"Work email","type":"EmailInput"},{"label":"Company size","type":"Dropdown","options":["1-10","11-50","51+"]},{"label":"What do you want to learn?","type":"LongAnswer"}]}' result = client.call("fillout", "create_form", {"name":"Webinar registration","questions":[{"label":"Full name","type":"ShortAnswer"},{"label":"Work email","type":"EmailInput"},{"label":"Company size","type":"Dropdown","options":["1-10","11-50","51+"]},{"label":"What do you want to learn?","type":"LongAnswer"}]}) const result = await cotlet.call('fillout', 'create_form', {"name":"Webinar registration","questions":[{"label":"Full name","type":"ShortAnswer"},{"label":"Work email","type":"EmailInput"},{"label":"Company size","type":"Dropdown","options":["1-10","11-50","51+"]},{"label":"What do you want to learn?","type":"LongAnswer"}]}); cotlet call fillout create_form --data '{"name":"Webinar registration","questions":[{"label":"Full name","type":"ShortAnswer"},{"label":"Work email","type":"EmailInput"},{"label":"Company size","type":"Dropdown","options":["1-10","11-50","51+"]},{"label":"What do you want to learn?","type":"LongAnswer"}]}' Example response
{
"form_id": "fpj3Kd9xQw2L",
"name": "Webinar registration",
"published": false,
"questions": [
{
"id": "q_full_name",
"name": "Full name",
"type": "ShortAnswer"
},
{
"id": "q_work_email",
"name": "Work email",
"type": "EmailInput"
},
{
"id": "q_company_size",
"name": "Company size",
"type": "Dropdown"
},
{
"id": "q_learn",
"name": "What do you want to learn?",
"type": "LongAnswer"
}
]
}