Set question logic
Hide a question when conditions are met, or always.
PUT https://cotlet.dev/api/v1/fillout/forms/{form_id}/questions/{question_id}/logic
Sets the Logic of one question: hide_when conditions on earlier answers or URL parameters, or hide_always for a field that only carries a pre-filled value. It replaces the conditions the question had. Conditions that depend on integration data are not set by this tool. The change reaches respondents only after publish_form, and it is undone by the editor's edit history, so it runs without asking first.
Parameters
| Name | Type | Description |
|---|---|---|
| form_id string required | string | Form ID from list_forms. |
| question_id string required | string | Question ID from get_form. |
| hide_when array | array | Conditions as in the editor's Add condition. Each item: source (answer or url_parameter), question_id or name, operator (as the condition editor offers it for that field), value. |
| hide_always boolean | boolean | Always hide the question. Default: false. |
Request
curl -X PUT https://cotlet.dev/api/v1/fillout/forms/rK8mTn4vYb1C/questions/q_org_description/logic \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"hide_when":[{"source":"answer","question_id":"q_company_type","operator":"is not","value":"Non-profit"}]}' result = client.call("fillout", "set_question_logic", {"form_id":"rK8mTn4vYb1C","question_id":"q_org_description","hide_when":[{"source":"answer","question_id":"q_company_type","operator":"is not","value":"Non-profit"}]}) const result = await cotlet.call('fillout', 'set_question_logic', {"form_id":"rK8mTn4vYb1C","question_id":"q_org_description","hide_when":[{"source":"answer","question_id":"q_company_type","operator":"is not","value":"Non-profit"}]}); cotlet call fillout set_question_logic --data '{"form_id":"rK8mTn4vYb1C","question_id":"q_org_description","hide_when":[{"source":"answer","question_id":"q_company_type","operator":"is not","value":"Non-profit"}]}' Example response
{
"form_id": "rK8mTn4vYb1C",
"question_id": "q_org_description",
"hide_always": false,
"hide_when": [
{
"source": "answer",
"question_id": "q_company_type",
"operator": "is not",
"value": "Non-profit"
}
]
}