curl -X POST https://api.getversive.com/api/v1/question-logic \
-H "Authorization: Bearer $VERSIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"study_id": "9b2f7c1e-4a4b-4f6e-9a1d-1c2d3e4f5a6b",
"question_id": "q-123",
"operation": "<",
"comparison_value": "3",
"comparison_value_type": "int",
"action_type": "screen_out"
}'
Question logic
Create question logic
Add a branching rule to a question
POST
/
question-logic
curl -X POST https://api.getversive.com/api/v1/question-logic \
-H "Authorization: Bearer $VERSIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"study_id": "9b2f7c1e-4a4b-4f6e-9a1d-1c2d3e4f5a6b",
"question_id": "q-123",
"operation": "<",
"comparison_value": "3",
"comparison_value_type": "int",
"action_type": "screen_out"
}'
Creates a logic rule. Rules on a question are evaluated top to bottom; the first match wins. Returns
201.
string
required
The study.
string
required
The question the rule attaches to (must belong to the study).
string
required
==, <, <=, >, >=, COUNT_LT, INCLUDES, ALWAYS, or SMART_CONDITION. (INCLUDE_RESPONSE_IN_NEXT_QUESTION is accepted for backwards compatibility but is legacy — use question mentions instead.)string
required
string, int, or smart_condition.string
required
next_question_id, move_to_question_group, end_interview, redirect_url, or screen_out.string
The comparison value — or, for
SMART_CONDITION, the natural-language condition (e.g. “the participant mentions pricing”).string
Required for
next_question_id actions; must be a question in the same study. Cannot be the rule’s own question, or a question inside a randomized group (directly or nested) — target the group with move_to_question_group instead.string
Required for
move_to_question_group actions; the interview enters at the group’s first question (respecting per-participant randomization). Question groups must be enabled for the study. Must be a group in the same study that contains at least one question. Cannot be the question’s own group or an ancestor of it, or a group nested inside a randomized group.string
Required for
redirect_url actions.boolean
default:"false"
Set for
end_interview actions.string
default:"English"
The language this rule applies to.
Response
The created logic rule — same shape as List question logic.curl -X POST https://api.getversive.com/api/v1/question-logic \
-H "Authorization: Bearer $VERSIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"study_id": "9b2f7c1e-4a4b-4f6e-9a1d-1c2d3e4f5a6b",
"question_id": "q-123",
"operation": "<",
"comparison_value": "3",
"comparison_value_type": "int",
"action_type": "screen_out"
}'