Skip to content

Read scores and analytics

Get a survey's results for a date range, the counts behind one question, NPS and satisfaction scores, and responses over time.

The analytics endpoints count every response in a date range and return the numbers, so you don’t have to page through responses and add them up. Use them to put a survey’s NPS on your own dashboard, or to report which channel customers say they came from.

Before you start

  • You need an API key with the responses:read scope. See Authentication and scopes.
  • You need the survey’s id or public_id (from GET /surveys), and for one question its public_id (from GET /surveys/{survey_id}, or from the survey’s analytics below).
You want Call
Everything about one survey, question by question GET /surveys/{survey_id}/analytics
How many chose each answer of one choice question GET /analytics/answer-counts
NPS, an average score or a satisfaction share for one question GET /analytics/scores
How many responses came in per day, week or month GET /analytics/timeseries

Choose the date range

All four take the same range parameters:

Parameter Meaning
range 24h, 7d, 30d, 90d, 12m (the last 12 months) or all. The default is 30d.
from First day, YYYY-MM-DD, UTC, included.
to Last day, YYYY-MM-DD, UTC, included. Defaults to today.

When you give from or to, range is ignored. The analytics endpoints count whole UTC days, while GET /responses counts range back from the current time, so the two can differ at the edges of a range.

Read a survey’s results

curl -G https://app.userloop.io/api/v1/surveys/1710884429805x361876466030084100/analytics \
  -H "Authorization: Bearer ulk_live_…" \
  --data-urlencode "range=30d"

You get an overview, a trend and one entry per published question. Here is a shortened answer with an NPS question and a choice question:

{
  "survey": { "id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j", "public_id": "1710884429805x361876466030084100", "title": "Post-purchase survey" },
  "range": { "from": "2026-10-13", "to": "2026-11-11", "label": "Last 30 days", "previous": { "from": "2026-09-13", "to": "2026-10-12" } },
  "overview": {
    "responses": { "value": 1874, "previous": 1652 },
    "respondents": { "value": 412, "previous": 380 },
    "views": null,
    "response_rate": null,
    "nps": { "value": 41.3, "previous": 37.9 }
  },
  "trend": { "unit": "day", "points": [["2026-10-13", 12], ["2026-10-14", 15]] },
  "questions": [
    {
      "number": "1",
      "question_id": "1710884436289x589566297607766000",
      "text": "How likely are you to recommend us to a friend?",
      "type": "number_score",
      "respondents": 400,
      "nps": 41.3,
      "average": 8.2,
      "promoters": { "count": 228, "share": 0.57, "revenue": { "amount": 14820.5, "currency": "GBP" }, "aov": { "amount": 65.0, "currency": "GBP" } },
      "passives": { "count": 109, "share": 0.27, "revenue": { "amount": 6431.0, "currency": "GBP" }, "aov": { "amount": 59.0, "currency": "GBP" } },
      "detractors": { "count": 63, "share": 0.16, "revenue": { "amount": 3528.0, "currency": "GBP" }, "aov": { "amount": 56.0, "currency": "GBP" } },
      "distribution": [
        { "score": 0, "count": 4, "share": 0.01 },
        { "score": 10, "count": 150, "share": 0.38 }
      ]
    },
    {
      "number": "2",
      "question_id": "1710884441102x447120985331204100",
      "text": "How did you hear about us?",
      "type": "single_select",
      "respondents": 395,
      "answers": [
        { "answer_id": "1710884441108x118605297512448000", "text": "Instagram", "count": 171, "share": 0.43, "revenue": { "amount": 11286.0, "currency": "GBP" }, "aov": { "amount": 66.0, "currency": "GBP" } },
        { "answer_id": "1710884441113x772019348812288000", "text": "A friend", "count": 120, "share": 0.3, "revenue": { "amount": 7320.0, "currency": "GBP" }, "aov": { "amount": 61.0, "currency": "GBP" } }
      ],
      "unmatched_answers": 0
    }
  ],
  "unpublished_questions_not_shown": 0,
  "has_order_data": true,
  "notes": [],
  "filtered": null
}
  • overview gives each figure with previous, the same figure for the period of the same length just before. A figure UserLoop doesn’t know is null: views and response_rate are null when the survey’s views aren’t counted.
  • overview.responses counts answer rows, including each selected multi select option; overview.respondents counts people. response_rate divides respondents by views.
  • trend.points are [date, responses] pairs, by unit (day, week or month). They count answers to every question, including each selected multi select option.
  • What a question has depends on its type: answers for choice questions (with share from 0 to 1 of the question’s respondents, and the revenue and aov of the orders attached), nps and the three segments for NPS questions, average, min, max and distribution for number scores, written_answers and latest for written questions. A follow-up question sits under the answer that shows it, in follow_up.
  • Without filters, written questions also carry themes, the top themes found in what customers wrote. GET /surveys/{survey_id}/themes lists them all.
  • include_archived=true adds published questions that have since been archived.

Count only some responses

The survey analytics, answer counts and scores endpoints also take the filters of GET /responses (channel, answer, score, written_only, video_only, landing_page_contains, order_min, order_max, any_discount, discount_code, product and the utm_ parameters), without survey_id and search. The filters are described in List and search responses. For example, the survey’s results for customers who came from Instagram:

curl -G https://app.userloop.io/api/v1/surveys/1710884429805x361876466030084100/analytics \
  -H "Authorization: Bearer ulk_live_…" \
  --data-urlencode "range=90d" \
  --data-urlencode "utm_source=instagram"

With filters, views, response_rate and the previous figures are null, and filtered says what was read: count (filters applied) and rows (answers read). When filtered.sampled is true, only the newest answers were read and the numbers cover responses from filtered.covered_from on. Choose a shorter range for exact numbers.

Count the answers to one question

GET /analytics/answer-counts takes a single select, multi select or CSAT question:

curl -G https://app.userloop.io/api/v1/analytics/answer-counts \
  -H "Authorization: Bearer ulk_live_…" \
  --data-urlencode "survey_id=1710884429805x361876466030084100" \
  --data-urlencode "question_id=1710884441102x447120985331204100" \
  --data-urlencode "from=2026-10-01" \
  --data-urlencode "to=2026-10-31"
{
  "chart": "answer_counts",
  "survey": { "id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j", "public_id": "1710884429805x361876466030084100", "title": "Post-purchase survey" },
  "question": { "id": "k29b1d7m3x8q2w6r0c4v9n5t1y7h3j8f", "public_id": "1710884441102x447120985331204100", "text": "How did you hear about us?", "type": "single_select", "multiple": false },
  "range": { "from": "2026-10-01", "to": "2026-10-31", "label": "1 Oct 2026 – 31 Oct 2026", "preset": "custom" },
  "respondents": 388,
  "answers": [
    { "answer_id": "1710884441108x118605297512448000", "text": "Instagram", "count": 166, "share": 0.43, "revenue": { "amount": 10956.0, "currency": "GBP" }, "aov": { "amount": 66.0, "currency": "GBP" } },
    { "answer_id": "1710884441113x772019348812288000", "text": "A friend", "count": 118, "share": 0.3, "revenue": { "amount": 7198.0, "currency": "GBP" }, "aov": { "amount": 61.0, "currency": "GBP" } },
    { "answer_id": "1710884441120x330981726540416000", "text": "Other", "count": 21, "share": 0.05, "revenue": null, "aov": null, "is_other": true }
  ],
  "unmatched_answers": 3,
  "has_order_data": true,
  "notes": null,
  "filtered": null
}

share is the share of the question’s respondents, from 0 to 1, so on a multi select the shares can add up to more than 1. revenue and aov are null when no order is attached. unmatched_answers counts answers given that match none of the question’s current answers, for example an answer you have since deleted.

Read NPS and satisfaction scores

GET /analytics/scores takes an NPS, number score or CSAT question, with the same parameters:

curl -G https://app.userloop.io/api/v1/analytics/scores \
  -H "Authorization: Bearer ulk_live_…" \
  --data-urlencode "survey_id=1710884429805x361876466030084100" \
  --data-urlencode "question_id=1710884436289x589566297607766000" \
  --data-urlencode "range=90d"

The answer’s kind says which of three shapes it is. For an NPS question:

{
  "chart": "score_metrics",
  "kind": "nps",
  "survey": { "id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j", "public_id": "1710884429805x361876466030084100", "title": "Post-purchase survey" },
  "question": { "id": "k41p8c2v6n0x4m9q3w7r1t5y8h2j6d0b", "public_id": "1710884436289x589566297607766000", "text": "How likely are you to recommend us to a friend?", "type": "number_score" },
  "range": { "from": "2026-08-14", "to": "2026-11-11", "label": "Last 90 days", "preset": "90d" },
  "respondents": 1180,
  "score": 39.5,
  "average": 8.1,
  "segments": {
    "promoters": { "count": 649, "share": 0.55, "revenue": { "amount": 42185.0, "currency": "GBP" }, "aov": { "amount": 65.0, "currency": "GBP" } },
    "passives": { "count": 345, "share": 0.29, "revenue": { "amount": 20355.0, "currency": "GBP" }, "aov": { "amount": 59.0, "currency": "GBP" } },
    "detractors": { "count": 186, "share": 0.16, "revenue": { "amount": 10416.0, "currency": "GBP" }, "aov": { "amount": 56.0, "currency": "GBP" } }
  },
  "distribution": [
    { "score": 0, "count": 11, "share": 0.01 },
    { "score": 9, "count": 214, "share": 0.18 },
    { "score": 10, "count": 435, "share": 0.37 }
  ],
  "filtered": null
}
kind Fields besides respondents and distribution
nps score: the NPS, from -100 to 100 (promoters’ share minus detractors’ share). average. segments: promoters (9 to 10), passives (7 to 8) and detractors (0 to 6), each with count, share, revenue and aov.
scale (a number score) average, min and max of the scale, and labels.left and labels.right, the words at its ends.
csat satisfied_share: the share who chose one of the two best answers, from 0 to 1. average: the mean answer position, where 1 is the first answer.

score, average and satisfied_share are null when nobody answered in the range. To compare two periods, call it once for each range.

Count responses over time

GET /analytics/timeseries counts responses per day, week or month, with empty buckets filled with 0. Leave out survey_id to count every survey; add question_id (with survey_id) to count only answers to that question, including each selected multi select option.

curl -G https://app.userloop.io/api/v1/analytics/timeseries \
  -H "Authorization: Bearer ulk_live_…" \
  --data-urlencode "survey_id=1710884429805x361876466030084100" \
  --data-urlencode "range=12m" \
  --data-urlencode "granularity=month"
{
  "chart": "response_timeseries",
  "survey": { "id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j", "public_id": "1710884429805x361876466030084100", "title": "Post-purchase survey" },
  "question": null,
  "range": { "from": "2025-11-12", "to": "2026-11-11", "label": "Last 12 months", "preset": "12m" },
  "granularity": "month",
  "total": 4630,
  "points": [
    { "date": "2025-11-01", "count": 301 },
    { "date": "2025-12-01", "count": 455 }
  ],
  "truncated": false,
  "complete_from": null
}
  • granularity is day, week or month. Left out, it is day for ranges up to 62 days, week up to 400 days and month beyond.
  • Each point’s date is the first day of its bucket.
  • truncated: true means more than 20,000 answers matched, and counts before complete_from are too low. Choose a shorter range.
  • Each answer row counts once, including each selected multi select option. Three answers in one submission count as three responses. It takes no filters. For a filtered survey over time, read trend from the survey’s analytics with filters.

Check it worked

Each call returns 200. Compare respondents for the same survey and range with the survey’s Analyze stage in the dashboard: they count the same people. Compare overview.responses with Responses for the answer count.

What can go wrong

You see What to do
400 invalid_request whose detail says the question is of another type Use answer counts for single select, multi select and CSAT questions, and scores for NPS, number score and CSAT questions.
400 invalid_request with errors naming a parameter The analytics endpoints don’t take search, email, limit or cursor, and only the time series takes granularity.
404 not_found The survey, or the question in that survey, isn’t in this organisation. Check the IDs with GET /surveys/{survey_id}.
filtered.sampled: true or truncated: true The numbers don’t cover the whole range. Choose a shorter one.

Type to search…

↑↓ navigate↵ selectEsc close