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

write

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

Parameters: set_question_logic
NameTypeDescription
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
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"}]}'
Python
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"}]})
Node.js
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"}]});
CLI
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

JSON

{
  "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"
    }
  ]
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.