Skip to main content
Formalingo

Conditional Logic

Show or hide questions based on answers with rules.

Conditional Logic

Rules show or hide questions/sections based on answers to other questions.

GET/api/v1/forms/{id}/rules
Required scope:read:forms
POST/api/v1/forms/{id}/rules

Create a rule

Required scope:write:forms
PUT/api/v1/forms/{id}/rules/{rid}

Update a rule

Required scope:write:forms
DELETE/api/v1/forms/{id}/rules/{rid}

Delete a rule

Required scope:write:forms

Create a rule

Request Body
NameTypeDescription
source_question_iduuidThe question whose answer triggers this rule
operatorstringequals | not_equals | contains | greater_than | less_than | is_empty | is_not_empty
valueanyThe value to compare against (omit for is_empty/is_not_empty)
actionshow | hideWhat to do with the target
target_question_iduuidTarget question (provide this or target_section_id)
target_section_iduuidTarget section (provide this or target_question_id)

Example: hide a question unless "Other" is selected

curl -X POST https://app.formalingo.com/api/v1/forms/FORM_ID/rules \
-H "Authorization: Bearer af_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
  "source_question_id": "SOURCE_QUESTION_UUID",
  "operator": "equals",
  "value": "Other",
  "action": "show",
  "target_question_id": "TARGET_QUESTION_UUID"
}'

On this page