Surveys

Get the survey to show#

GET /api/sdk/surveys?key&distinctId&url returns { survey: null } or the first live in-app survey this visitor may see, with its questions.

A survey is skipped when the sample rate excludes the visitor, its answer limit is reached, or the visitor answered within the recontact window.

Mark as shown#

POST /api/sdk/surveys/{id}/seen with { key, distinctId }.

Send an answer#

POST /api/sdk/surveys/{id}/respond

curl -X POST "$HOST/api/sdk/surveys/$ID/respond" -H "content-type: application/json" \
  -d '{"key":"'$KEY'","distinctId":"visitor-1","answers":{"q1":9,"q2":"great"},"completed":true,"seconds":12}'

NPS answers are 0 to 10, ratings 1 to the scale, choices must be listed options, text up to 2000 characters. With completed: true all required questions must be answered.