Skip to help content
RightMessage

Questions API reference

Manage choice and input questions, answer options, synchronization, and nested input settings.

Available on the Scale and Pro plans.

Updated

View as Markdown

Use questions to collect answers in a flow or form. Question configuration is separate from the segment group that an answer can assign.

Authentication and question operations

Paths below follow https://api.rightmessage.com/v1/{teamPid}. GET requires read or write; mutations require write. The * ability satisfies both. The shared request conventions cover bearer authentication, headers, project access, and rate limits.

Method and pathRequestSuccess
GET /questionsNo filters or pagination parameters200, {"data":[RESOURCE]}
GET /questions/{question}Resource ID from the list200, {"data":RESOURCE}
POST /questionsCreate body below201, {"data":RESOURCE}
PUT or PATCH /questions/{question}Partial body below200, {"data":RESOURCE}
DELETE /questions/{question}No body204, empty body

PUT and PATCH have the same partial-update behavior. An omitted top-level field retains its value. A collection with no resources returns {"data":[]}. Reads return the draft when one exists, otherwise the stable configuration.

Errors and draft effects

The shared error contract applies. Invalid request fields return 422 with message and field-keyed errors. Full-configuration validation can return 500 instead.

Mutations save a draft, not live changes. Publishing applies the whole project draft, including edits made elsewhere. The draft contract covers snapshots, dashboard updates, and save failures.

Question fields

Only text is required on create. All fields are optional on update.

FieldType and validationCreate default
textNonempty string, maximum 500Required
nameString, maximum 255Omitted
descriptionNullable stringOmitted
sync_toHTTP accepts a nullable string; the stored schema accepts only customField, variable, or null. This is not a provider name.null
sync_to_fieldNullable destination-field or variable-name stringnull
display_optionsObject{}
segment_group_idNullable string identifying an existing groupnull
display_typebuttons, image, list, radio, or inputbuttons
input_typeNullable string: text, textarea, number, email, phone, name, address, country, url, date, rating, or npsnull
input_settingsNullable object, detailed belownull in response
randomize_optionsBooleanfalse
optionsArray of option objects[]
other_optionObject, detailed belowDisabled, with repaired labels below

A non-input question stores input_type as null, even if supplied. It retains shared input_settings, including next-button behavior.

Answer options

Each options[] object accepts required label, a string up to 255 characters; optional string id; nullable string segment_id; optional string image_url; and optional objects or arrays conditions and scores.

New option IDs use rqo_. When segment_group_id is supplied, every nonempty option segment_id must belong to that group. Invalid references return 422 at the group or option field path.

The stored option schema requires a non-null segment_id matching seg_ followed by word characters, or the reserved $everyone value. Omitting it or sending null passes the shallow optional/nullable request rule but fails full-configuration validation. The request only checks group membership when a nonempty segment_group_id is included in that same request; it does not use the question's existing group to validate an options-only update.

conditions is a logic object with recursive and, or, or not conditions. An empty input becomes {}. Answer-based conditions use $source: "answers", questionId, operator, and an operator-specific value. Stored condition validation also checks question dependencies.

scores is an array of {"score":"score-name","amount":1} objects. score must be a nonempty string and amount numeric. The service drops malformed entries and converts numeric strings to numbers.

Supplying options replaces all options. Preserve option IDs that must remain stable. Supplying input_settings, display_options, or other_option replaces that object rather than merging its omitted children.

Answer condition operators

An answer condition is a closed object containing $source: "answers", a raq_-prefixed questionId, operator, and value only when required below. The server also validates whether the operator fits the referenced question.

OperatorValue contract
has answered, has not answered, is empty, is not empty, is a business email, is a personal email, has last name, has no last name, in the past, in the futurevalue must be absent
equalsRequired number or string
does not equal, greater than, greater than or equal to, less than, less than or equal toRequired number
contains, starts withRequired string
before, after, onRequired valid YYYY-MM-DD date string
betweenRequired array of exactly two numbers or exactly two valid YYYY-MM-DD strings
is, is not, country is, country is notRequired uppercase two-letter string
is any of, country is any ofRequired nonempty array of uppercase two-letter strings
domain is, domain is not, domain ends withRequired hostname string, maximum 253 characters, with at least one dot. Labels use letters, digits, and internal hyphens; the last label starts with a letter. No scheme, path, or port.
domain is any ofRequired nonempty array of hostnames with the same constraints
region equals, city equals, postal code starts with, first name equals, first name containsRequired string containing a non-whitespace character
within the next days, within the last daysRequired integer, 0 through 9,007,199,254,740,991

The referenced question must exist and use display_type: "input". Both presence operators work for every input type. Other operators are restricted as follows:

Input typeAdditional operators
number, rating, npsequals, does not equal, greater than, greater than or equal to, less than, less than or equal to, between
datebefore, after, on, between, in the past, in the future, within the next days, within the last days
countryis, is not, is any of
phonecountry is, country is not, country is any of
emaildomain is, domain is not, domain is any of, domain ends with, is a business email, is a personal email
addresscountry is, country is not, country is any of, region equals, city equals, postal code starts with
namefirst name equals, first name contains, has last name, has no last name
urlequals, contains, starts with, is empty, is not empty, domain is, domain ends with
text, textareaequals, contains, starts with, is empty, is not empty

Numeric questions require numeric values; text and URL comparisons require strings. Date ranges require dates. The first value in a between range must not exceed the second.

Input settings

All fields below are optional inside input_settings, unless a nested object's presence makes a child required. CamelCase is intentional.

KeysType and restrictions
placeholderString, maximum 255
validation, currency, prefix, suffix, minLabel, maxLabel, defaultCountryStrings
required, detectCountry, mobileOnly, suggestTypoFixes, identifyBooleans
nextButtonLabel, skipButtonLabelNullable strings
numberTypeplain, currency, or percentage
min, max, step, defaultValueNullable numbers. No request-level min/max relationship check.
displayfield or slider
ratingMaxInteger, 3 through 10
nameFormatfirst_last or full
dateRangeany, past, or future
dateRangeDaysInteger, 1 through 36,500
partLabelsObject of string values. Only first, last, street, city, region, postcode, and country keys.
partPlaceholdersSame allowed keys as partLabels, plus full. String values.
pinnedCountries, excludedCountriesArrays of two-letter strings matching ^[A-Za-z]{2}$
syncFieldMapObject of string values
contactActionNullable object. When present, requires type, settings, and settings.partnerName.
contactAction.typecontact, form, list, or tag
contactAction.settings.partnerNameProvider-name string
contactAction.settings.formIds, listIds, tagIdsOptional arrays of strings inside contactAction.settings
consentObject with optional disclosure and checkbox objects
consent.disclosureRequires boolean enabled and string text when supplied
consent.checkboxRequires boolean enabled and string label when supplied

contactAction, its settings, consent, and its disclosure and checkbox objects are closed in the stored schema. Undeclared keys fail configuration validation even when request validation accepts them. The overall input_settings object is open.

The API has no per-field default for omitted input settings. It returns the stored object. Runtime control defaults are not automatically expanded into this response.

Other-answer settings

other_option accepts boolean enabled, string label up to 255, string input_type, string prompt up to 500, nullable string placeholder, and nullable string sync_to_custom_field. The HTTP request does not enumerate Other input types. Repair fills omitted values with enabled: false, label: "Other", input_type: "textarea", prompt: "Please share more", and placeholder: "". An empty object disables Other and restores those labels. A null placeholder is repaired to an empty string; a null custom-field mapping remains null.

Question responses and deletion behavior

The resource contains the question fields above plus id. Optional name and description appear only when stored. Options contain id, segment_id, label, conditions, and scores; image_url appears when stored. Empty input settings return null. Question IDs use raq_.

Deleting a question can fail if answer conditions still reference it. Successful deletion removes matching question fields from forms using the question ID or its group ID. It does not remove related resources in the same way as deleting a segment group. Review remaining flow references. Active question tests can also lock changes when saving configuration.

Illustrative requests and responses

These illustrative examples use the fictional WorkForge project. The same resource schema covers every CRUD response.

HTTP
GET /v1/123456/questions HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json

GET /v1/123456/questions/raq_example1 HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json

POST /v1/123456/questions HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
Accept: application/json

{
	"text": "What does your WorkForge team need?",
	"display_type": "input",
	"input_type": "text"
}

PATCH /v1/123456/questions/raq_example1 HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
Accept: application/json

{
	"text": "What is your main WorkForge goal?"
}

DELETE /v1/123456/questions/raq_example1 HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json

The PATCH example also works with PUT. The create, item-read, and update envelopes have this shape. The list places these resource objects in its data array. An update returns the updated values. DELETE returns no JSON.

JSON
{
	"data": {
		"id": "raq_example1",
		"text": "What does your WorkForge team need?",
		"sync_to": null,
		"sync_to_field": null,
		"display_options": {},
		"segment_group_id": null,
		"display_type": "input",
		"input_type": "text",
		"input_settings": null,
		"randomize_options": false,
		"options": [],
		"other_option": {
			"enabled": false,
			"label": "Other",
			"input_type": "textarea",
			"prompt": "Please share more",
			"placeholder": ""
		}
	}
}

Still need a hand?

Tell us what you’re trying to do and where you’re getting stuck.

support@rightmessage.com