Survey Question Logic
Configure display options and skip logic for survey questions using the Survey Question API. These settings correspond to options on the Logic tab in the question builder.
Endpoints
Logic settings are configured via the standard survey question methods. Use the appropriate endpoint depending on whether you are reading, creating, or updating a question.
v5/survey/{survey_id}/surveyquestion/{question_id}
v5/survey/{survey_id}/surveypage/{page_id}/surveyquestion
v5/survey/{survey_id}/surveyquestion/{question_id}
Requires authentication
Display Options
The following parameters control how a question is displayed or hidden.
child attributes
save_logic_data parameter to enable.hide_after_response parameter to enable. To disable, pass an empty string.true, false.true, false.true, false.true, false.true, false.Skip Logic
show_rules parameter is documented here for reference and for use once support becomes available. To read existing skip logic on a question, use the GET endpoint — the full show_rules object is returned in the response. Skip logic should be configured through the Alchemer web interface in the meantime.
Skip logic (display conditions) is set using the show_rules parameter. All values should be passed as strings.
show_rules object, which you can use as a reference.Note: The question details response also includes a
show_rules id and same_page_skus. These do not need to be supplied when setting show_rules via the API.
child attributes
child attributes
"3" (SGLogicAtom_TYPE_QUESTION). See the Condition Types table below for all available values.type is "3" (Question), this is the question's numeric ID passed as a string."20" for ANSWERED). Valid operators vary by question type — see the Operators by Question Type reference below.child attributes
"17" (SGLogicAtom_TYPE_QUESTION_OPTIONS) for questions with predefined answer options (e.g. radio buttons, checkboxes). Use "2" (SGLogicAtom_TYPE_VALUE) for free-text questions (e.g. textbox, essay). For text-based questions, always use "2" regardless of operator, including ANSWERED and NOTANSWERED."" for operators that don't require a specific value (e.g. ANSWERED, NOTANSWERED). For option-based conditions, pass an array of identifiers formatted as {question_id}-{option_id} (e.g. show_rules[atom2][value][]=2-10003). For text-based conditions, pass the string value to match.Condition Types (show_rules[atom][type])
The show_rules[atom][type] value identifies what entity the condition is based on.
| Type ID | Constant |
|---|---|
3 | SGLogicAtom_TYPE_QUESTION |
6 | SGLogicAtom_TYPE_CURRENTDATE |
21 | SGLogicAtom_TYPE_MOBILE |
5 | SGLogicAtom_TYPE_IP |
8 | SGLogicAtom_TYPE_COUNTRY |
9 | SGLogicAtom_TYPE_REGION |
19 | SGLogicAtom_TYPE_POSTAL |
10 | SGLogicAtom_TYPE_CITY |
4 | SGLogicAtom_TYPE_URLVAR |
36 | SGLogicAtom_TYPE_SSOVAR |
13 | SGLogicAtom_TYPE_INVITEFIELD |
Operators by Question Type
Valid operators and the required show_rules[atom2][type] vary by question type. Use the tables below to identify the correct values for your condition.
Single-Select Questions
Applies to: Radio Buttons, Radio Button Grid, Net Promoter Score, Rating (Likert Scale), Image (Select One), Dropdown Menu List, Grouping (Closed Card Sort), Quick Sort, Semantic Differential, User Data
show_rules[atom2][type]: 17 — SGLogicAtom_TYPE_QUESTION_OPTIONS
| Operator ID | Constant |
|---|---|
12 | SGLogicUnit_LOGIC_IN_LIST |
5 | SGLogicUnit_LOGIC_NOTEQUAL |
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
Multi-Select Questions
Applies to: Checkboxes, Image (Multi-Select), Checkbox Grid, Conjoint (Choice-Based)
show_rules[atom2][type]: 17 — SGLogicAtom_TYPE_QUESTION_OPTIONS
| Operator ID | Constant |
|---|---|
4 | SGLogicUnit_LOGIC_EQUAL |
22 | SGLogicUnit_LOGIC_NOT_EXACTLYEQUAL |
12 | SGLogicUnit_LOGIC_IN_LIST |
5 | SGLogicUnit_LOGIC_NOTEQUAL |
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
Text-Based Questions
Applies to: Textbox, Essay / Long Answer
show_rules[atom2][type]: 2 — SGLogicAtom_TYPE_VALUE (use for all operators, including ANSWERED and NOTANSWERED)
| Operator ID | Constant |
|---|---|
4 | SGLogicUnit_LOGIC_EQUAL |
22 | SGLogicUnit_LOGIC_NOT_EXACTLYEQUAL |
6 | SGLogicUnit_LOGIC_GT |
7 | SGLogicUnit_LOGIC_GTE |
8 | SGLogicUnit_LOGIC_LTE |
9 | SGLogicUnit_LOGIC_LT |
23 | SGLogicUnit_LOGIC_GTE_DATE |
24 | SGLogicUnit_LOGIC_LTE_DATE |
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
10 | SGLogicUnit_LOGIC_CONTAINSTR |
14 | SGLogicUnit_LOGIC_REGEX |
15 | SGLogicUnit_LOGIC_NOTREGEX |
28 | SGLogicUnit_LOGIC_SENTIMENT_POS |
30 | SGLogicUnit_LOGIC_SENTIMENT_NEU |
29 | SGLogicUnit_LOGIC_SENTIMENT_NEG |
31 | SGLogicUnit_LOGIC_SENTIMENT_GT |
32 | SGLogicUnit_LOGIC_SENTIMENT_LT |
Email, Date, Number, Percent
show_rules[atom2][type]: 2 — SGLogicAtom_TYPE_VALUE
| Operator ID | Constant |
|---|---|
4 | SGLogicUnit_LOGIC_EQUAL |
22 | SGLogicUnit_LOGIC_NOT_EXACTLYEQUAL |
6 | SGLogicUnit_LOGIC_GT |
7 | SGLogicUnit_LOGIC_GTE |
8 | SGLogicUnit_LOGIC_LTE |
9 | SGLogicUnit_LOGIC_LT |
23 | SGLogicUnit_LOGIC_GTE_DATE |
24 | SGLogicUnit_LOGIC_LTE_DATE |
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
10 | SGLogicUnit_LOGIC_CONTAINSTR |
14 | SGLogicUnit_LOGIC_REGEX |
15 | SGLogicUnit_LOGIC_NOTREGEX |
Slider
show_rules[atom2][type]: 17 — SGLogicAtom_TYPE_QUESTION_OPTIONS
| Operator ID | Constant |
|---|---|
4 | SGLogicUnit_LOGIC_EQUAL |
22 | SGLogicUnit_LOGIC_NOT_EXACTLYEQUAL |
12 | SGLogicUnit_LOGIC_IN_LIST |
5 | SGLogicUnit_LOGIC_NOTEQUAL |
6 | SGLogicUnit_LOGIC_GT |
7 | SGLogicUnit_LOGIC_GTE |
8 | SGLogicUnit_LOGIC_LTE |
9 | SGLogicUnit_LOGIC_LT |
23 | SGLogicUnit_LOGIC_GTE_DATE |
24 | SGLogicUnit_LOGIC_LTE_DATE |
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
10 | SGLogicUnit_LOGIC_CONTAINSTR |
14 | SGLogicUnit_LOGIC_REGEX |
15 | SGLogicUnit_LOGIC_NOTREGEX |
Star Rating Grid
show_rules[atom2][type]: 2 — SGLogicAtom_TYPE_VALUE
| Operator ID | Constant |
|---|---|
4 | SGLogicUnit_LOGIC_EQUAL |
22 | SGLogicUnit_LOGIC_NOT_EXACTLYEQUAL |
12 | SGLogicUnit_LOGIC_IN_LIST |
5 | SGLogicUnit_LOGIC_NOTEQUAL |
23 | SGLogicUnit_LOGIC_GTE_DATE |
24 | SGLogicUnit_LOGIC_LTE_DATE |
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
Image Heatmap, Text Highlighter, Cascading Dropdown
show_rules[atom2][type]: 2 — SGLogicAtom_TYPE_VALUE
| Operator ID | Constant |
|---|---|
20 | SGLogicUnit_LOGIC_ANSWERED |
21 | SGLogicUnit_LOGIC_NOTANSWERED |
Examples
curl -X POST "https://api.alchemer.com/v5/survey/123456/surveyquestion/5?api_token=YOUR_API_TOKEN&api_token_secret=YOUR_API_TOKEN_SECRET&properties[hidden]=true"
curl -X GET "https://api.alchemer.com/v5/survey/123456/surveyquestion/3?api_token=YOUR_API_TOKEN&api_token_secret=YOUR_API_TOKEN_SECRET"
"show_rules": {
"atom": {
"type": "3",
"value": "2",
"case_sensitive": true
},
"operator": "20",
"atom2": {
"type": "2",
"value": "",
"case_sensitive": false
},
"id": "69dd604f87828",
"same_page_skus": []
}