Skip to main content
POST
Creates a logic rule. Returns 201.
  • Branching rules (the default) change the path after question_id is answered. Rules on a question are evaluated top to bottom; the first match wins. On a matrix selection question a branching rule must use ALWAYS; to act on one row’s answer, use a display rule.
  • Display rules (logic_type: "display") show question_id only when an earlier answer matches. They test source_question_id’s answer, so the operation and value follow the source question’s type, and they take no action fields. A question with several display rules is shown when all of them pass, or when any one passes, per the question’s display_condition_match (see Update question).
For a matrix selection source, row and value must be the exact labels in the study’s default language. Translated labels don’t match. A matrix selection with isMultiSelect on can’t be a display source. The source must come before the target, outside any randomized group or Randomizer arm that could reverse that order or skip it. Rules that break these constraints are rejected with a 400 that says why.
string
required
The study.
string
required
The question the rule attaches to (must belong to the study): the answered question for a branching rule, the question to show or hide for a display rule.
string
default:"branching"
branching or display.
string
Required for display rules, not allowed on branching rules: the earlier question whose answer is tested.
string
required
==, !=, <, <=, >, >=, COUNT_LT, INCLUDES, NOT_INCLUDES, ALWAYS, or SMART_CONDITION. (INCLUDE_RESPONSE_IN_NEXT_QUESTION is accepted for backwards compatibility but is legacy — use question mentions instead.) Values are case-sensitive and must be sent exactly as listed: includes, Always, or = is rejected with a 422.
string
required
string, int, or smart_condition.
string
Required for branching rules: next_question_id, move_to_question_group, end_interview, redirect_url, or screen_out. Display rules can’t have an action (nor next_question_id, next_question_group_id, redirect_url, or end_interview).
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
The study’s default language, which is also the value used when you omit it, so you can leave it out. If you send it, use the language’s full name as stored in config.lang.default.name (e.g. English), not its code (en); case doesn’t matter. Any other value is refused with a 400: interviews apply rules in the default language, and translated interviews use translated copies of those rules, which the API doesn’t create.

Response

The created logic rule — same shape as List question logic.