GET /surveys/

Load survey questions for display to a panelist. Returns only the fields needed for voting - sensitive metadata is excluded.

Request

GET /public/survey/

Headers

HeaderRequiredDescription
AuthorizationYesCompound token from Tenant API

Response

{
  "title": "Customer Satisfaction Survey",
  "questions": [
    {
      "questionId": "1",
      "questionText": "How satisfied are you with our service?",
      "questionType": "likert",
      "scaleLabels": {
        "min": "Very Dissatisfied",
        "max": "Very Satisfied"
      },
      "answerOptions": [
        { "optionId": "1", "label": "1" },
        { "optionId": "2", "label": "2" },
        { "optionId": "3", "label": "3" },
        { "optionId": "4", "label": "4" },
        { "optionId": "5", "label": "5" }
      ]
    },
    {
      "questionId": "2",
      "questionText": "Which features do you use?",
      "questionType": "multiple",
      "answerOptions": [
        { "optionId": "1", "optionText": "Dashboard" },
        { "optionId": "2", "optionText": "Reports" },
        { "optionId": "3", "optionText": "API" }
      ]
    }
  ]
}

Response Fields

FieldTypeDescription
titlestringSurvey title
questionsarrayList of question objects, sorted by display order

Question Object

FieldTypeDescription
questionIdstringUnique question identifier (use in vote submission)
questionTextstringThe question text to display
questionTypestringQuestion type: likert, kano, single, multiple
scaleLabelsobject(Optional) Scale endpoint labels for likert questions
answerOptionsarrayAvailable answer options

Answer Option Object

FieldTypeDescription
optionIdstringUnique option identifier (use in vote submission)
labelstring(Optional) Display label for scale positioning
optionTextstring(Optional) Full option text to display

Likert scale display: For likert questions, label determines where the option appears on the scale. This may differ from optionId for reverse-scored questions. For example, an option with optionId: "1" and label: "7" should be displayed at position 7 on the scale (the positive end), even though votes are recorded as “1”.

For Kano questions, answer options use a grouped structure:

FieldTypeDescription
labelstringGroup label (e.g., “If present”, “If absent”)
optionsarrayNested options with optionId and optionText

Examples

JavaScript

const loadSurvey = async (publicKey) => {
  const response = await fetch('https://api.votito.com/public/survey/', {
    headers: { 'Authorization': publicKey }
  });

  if (!response.ok) {
    throw new Error(`Failed to load survey: ${response.status}`);
  }

  const survey = await response.json();

  return survey;
};

// Usage
const survey = await loadSurvey(publicKey);
survey.questions.forEach(q => {
  console.log(`${q.questionText}`);
  q.answerOptions.forEach(opt => {
    console.log(`  - ${opt.optionText || opt.label}`);
  });
});

React Example

const SurveyForm = ({ publicKey }) => {
  const [survey, setSurvey] = useState(null);

  useEffect(() => {
    fetch('https://api.votito.com/public/survey/', {
      headers: { 'Authorization': publicKey }
    })
      .then(r => r.json())
      .then(setSurvey);
  }, [publicKey]);

  if (!survey) return <div>Loading...</div>;

  return (
    <form>
      <h1>{survey.title}</h1>
      {survey.questions.map(q => (
        <Question key={q.questionId} question={q} />
      ))}
    </form>
  );
};

Error Responses

401 Unauthorized

Invalid or missing authorization token.

403 Forbidden

Survey is closed or panelist has exceeded response limit.