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}/rulesRequired scope:read:forms
POST
/api/v1/forms/{id}/rulesCreate 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
| Name | Type | Description |
|---|---|---|
| source_question_id | uuid | The question whose answer triggers this rule |
| operator | string | equals | not_equals | contains | greater_than | less_than | is_empty | is_not_empty |
| value | any | The value to compare against (omit for is_empty/is_not_empty) |
| action | show | hide | What to do with the target |
| target_question_id | uuid | Target question (provide this or target_section_id) |
| target_section_id | uuid | Target section (provide this or target_question_id) |
Example: hide a question unless "Other" is selected
curl -X POST https://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"
}'