Included in Plus
REST API
A survey API for your own code.
50 operations over JSON for surveys, questions, responses, customers, analytics, reports, email sends and webhooks. One base URL, a key in one header, and errors with a code you can branch on.
Read the docsWhat is the UserLoop survey API?
The UserLoop API is a REST API at https://app.userloop.io/api/v1. Your server sends an API key as a bearer token and gets JSON back. It creates and publishes surveys, lists responses with the customer and order behind each one, returns NPS and satisfaction scores, sends survey emails from your own events and records answers collected elsewhere. It is part of the Plus plan.
- Base URL
- https://app.userloop.io/api/v1
- Auth
- Authorization: Bearer ulk_live_...
- Spec
- OpenAPI 3.1 at /openapi.json, readable with no key
- Plan
- Plus, $99 a month, with a 14-day trial
How it works
From no key to a first response in three steps
01
Create a key
In Settings, open API keys and select Create key. Name it, tick what it may do and choose when it expires. UserLoop shows the key once and stores only a hash of it.
02
Check it with GET /me
GET /me needs no scope and answers on every plan. It returns the key's scopes, its organization and the person it acts as, so it is the right first call.
03
Read or write
List surveys, page through responses, read a score or send a survey email. Every endpoint is in the OpenAPI document with the scope it needs.
Resources
Ten groups of endpoints
The 50 operations are grouped by what they work on. Each one names the scope it needs.
Surveys
List, create and update surveys. Publish, unpublish, archive and restore. Get a personal link for one recipient.
Questions
Add, update, move, archive and restore the questions of a survey.
Responses
Search submissions with the dashboard's filters, open one, record a new one and list written answers.
Customers
One item per person across every survey, and a profile with their orders and answer history.
Analytics
Answer counts, NPS and satisfaction scores, responses over time and a survey's results question by question.
Reports
Request a CSV export or a PDF report, list them and download the file when it is ready.
Sends
Email a live survey to one person, report an order or custom event, read a send's status, cancel pending sends.
Webhooks
Add, list, test and remove endpoints, roll a signing secret and fetch sample events.
Sites
List the websites of the organization and get the install snippet for one.
Account
The key itself, the organization, its plan and its usage, plus the OpenAPI document.
Four calls
The requests most integrations start with
Each sample runs as written once you set USERLOOP_API_KEY and replace the ids. The JavaScript needs Node 18 or later and no packages.
GET /responses
List responses, with the order behind each
One item per submission: a customer's answers to one survey in one sitting, newest first, with the customer, the order and the visit's UTM values attached.
The dashboard's filters. Date range, survey, channel, answer, score range, written answers only, order value, product, discount code, landing page and UTM values.
Cursor pagination. A page holds 1 to 50 submissions, 20 by default. Send next_cursor back as cursor with the same query until has_more is false.
Fields are left out, never null. A submission with no order has no order field. New channels, question types and fields can appear within v1, so ignore the ones you do not know.
# The last 30 days of submissions to one survey, newest first
curl -G https://app.userloop.io/api/v1/responses \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
--data-urlencode "survey_id=SURVEY_ID" \
--data-urlencode "range=30d" \
--data-urlencode "limit=50"const BASE = "https://app.userloop.io/api/v1";
const KEY = process.env.USERLOOP_API_KEY;
// Read every page: send next_cursor back as cursor, with the same query
async function listResponses(params) {
const items = [];
let cursor = null;
do {
const query = new URLSearchParams(params);
if (cursor) query.set("cursor", cursor);
const res = await fetch(BASE + "/responses?" + query, {
headers: { Authorization: "Bearer " + KEY },
});
const body = await res.json();
if (!res.ok) throw new Error(res.status + " " + body.code + ": " + body.detail);
items.push(...body.data);
cursor = body.has_more ? body.next_cursor : null;
} while (cursor);
return items;
}
const submissions = await listResponses({
survey_id: "SURVEY_ID",
range: "30d",
limit: "50",
});
console.log(submissions.length + " submissions");{
"data": [
{
"response_id": "3f9c1a7e5b2d48c6a0e1f7b9d3c5a8e2f4b6d8a0c2e4f6a8b0d2c4e6f8a0b2c4",
"survey": { "public_id": "Nq8XcT2w", "title": "Post-purchase survey" },
"received_at": "2026-11-09T18:04:11.000Z",
"started_at": "2026-11-09T18:03:40.000Z",
"channel": "thank_you",
"customer": { "name": "E. L.", "email": "em**@ex*****.com", "masked": true },
"order": {
"order_number": 1042,
"total": 84.2,
"currency": "USD",
"products": ["House Blend 1 kg", "Pour-over kit"]
},
"attribution": { "source": "tiktok", "medium": "social" },
"answers": [
{
"question_id": "Tm7wL2cN",
"question": "How likely are you to recommend us to a friend?",
"type": "number_score",
"score": 9
},
{
"question_id": "Xb3kP9qR",
"question": "How did you hear about us?",
"type": "single_select",
"answer": ["TikTok"],
"answer_ids": ["Qw7nL2xD"]
}
]
}
],
"has_more": true,
"next_cursor": "eyJ2IjoxLCJ0Ijoic2VhcmNoX3Jlc3BvbnNlcyIsImMiOiIxNzYyMTA2NjUxMDAwIiwicSI6Ijk4YzEifQ",
"partial": false
}GET /analytics/scores
Read an NPS or satisfaction score
One call returns the score for a question over a date range, so you do not page through responses and add them up yourself.
Three shapes. kind is nps, scale or csat. NPS runs from -100 to 100, with promoters, passives and detractors counted and the 0 to 10 distribution.
Revenue beside the score. Each NPS segment carries the revenue and average order value of the orders attached to those answers.
Filters apply. Narrow a score by channel, answer, order value, product, discount code or UTM value. To compare two periods, call it once for each range.
# NPS for one question over the last 90 days
curl -G https://app.userloop.io/api/v1/analytics/scores \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
--data-urlencode "survey_id=SURVEY_ID" \
--data-urlencode "question_id=QUESTION_ID" \
--data-urlencode "range=90d"const BASE = "https://app.userloop.io/api/v1";
const KEY = process.env.USERLOOP_API_KEY;
const query = new URLSearchParams({
survey_id: "SURVEY_ID",
question_id: "QUESTION_ID",
range: "90d",
});
const res = await fetch(BASE + "/analytics/scores?" + query, {
headers: { Authorization: "Bearer " + KEY },
});
const nps = await res.json();
if (!res.ok) throw new Error(res.status + " " + nps.code + ": " + nps.detail);
// kind is "nps", "scale" or "csat". score is null when nobody answered.
console.log(nps.kind, nps.score, nps.respondents);
console.log("Detractors:", nps.segments.detractors.count);{
"chart": "score_metrics",
"kind": "nps",
"survey": { "id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j", "public_id": "Nq8XcT2w", "title": "Post-purchase survey" },
"question": {
"id": "k41p8c2v6n0x4m9q3w7r1t5y8h2j6d0b",
"public_id": "Tm7wL2cN",
"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": "USD" }, "aov": { "amount": 65.0, "currency": "USD" } },
"passives": { "count": 345, "share": 0.29, "revenue": { "amount": 20355.0, "currency": "USD" }, "aov": { "amount": 59.0, "currency": "USD" } },
"detractors": { "count": 186, "share": 0.16, "revenue": { "amount": 10416.0, "currency": "USD" }, "aov": { "amount": 56.0, "currency": "USD" } }
},
"distribution": [
{ "score": 0, "count": 11, "share": 0.01 },
{ "score": 9, "count": 214, "share": 0.18 },
{ "score": 10, "count": 435, "share": 0.37 }
],
"filtered": null
}POST /surveys/{survey_id}/send
Send a survey email from your own event
When a booking ends, a ticket closes or an order is delivered in your system, one request emails a live email survey to that person.
One person, now. Give the recipient's email, a first name for the greeting and your own external_id. The same external_id never emails the same survey twice.
Or report a moment. POST /sends reports order_placed, order_shipped, order_delivered, checkout_abandoned or a custom event to email surveys that already listen for it through an API trigger, and their saved wait and rules decide.
Checks still run. Unsubscribes, suppressions, the limit per customer and the plan's monthly email allowance apply when the email goes. Sending through the API needs approval on the account first.
# Email one live email survey to one person now
curl https://app.userloop.io/api/v1/surveys/SURVEY_ID/send \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: booking-1042-survey" \
-d '{
"email": "emma@example.com",
"first_name": "Emma",
"external_id": "booking-1042"
}'const BASE = "https://app.userloop.io/api/v1";
const KEY = process.env.USERLOOP_API_KEY;
// Call this from your own event, for example when a booking ends
async function sendSurvey(booking) {
const res = await fetch(BASE + "/surveys/SURVEY_ID/send", {
method: "POST",
headers: {
Authorization: "Bearer " + KEY,
"Content-Type": "application/json",
"Idempotency-Key": "booking-" + booking.id + "-survey",
},
body: JSON.stringify({
email: booking.email,
first_name: booking.firstName,
// The same external_id never emails this survey twice
external_id: "booking-" + booking.id,
}),
});
const body = await res.json();
if (!res.ok) throw new Error(res.status + " " + body.code + ": " + body.detail);
return body.send_id; // GET /sends/{send_id} says what happened to it
}HTTP/2 202
Content-Type: application/json
{
"status": "queued",
"send_id": "j57a2c9x4m8q1w5r3t7y0n6v2b4h8k1d",
"survey_id": "k17f3n8w2q9d0c6v4m1r5t7y3h2b8x0j",
"external_id": "booking-1042",
"send_at": "2026-11-14T09:12:00.000Z"
}# For a survey that already has an API trigger: report the moment,
# and the survey's own wait and rules decide
curl https://app.userloop.io/api/v1/sends \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"moment": "order_delivered",
"occurred_at": "2026-11-11T09:12:00Z",
"customer": {
"email": "emma@example.com",
"first_name": "Emma",
"consent": "subscribed"
},
"order": {
"id": "84721",
"name": "#1042",
"total": 84.2,
"currency": "USD",
"shipping_country": "US",
"customer_type": "returning"
}
}'POST /responses
Record a response collected elsewhere
Answers gathered in your own app, in a support tool or by an agent on a call can be stored as a submission to a live link, email or website survey.
Checked before anything is stored. Every answer is checked against the survey's live version. A 400 lists each problem with its field, and nothing is recorded.
Try it without writing. validate_only runs every check and answers what would be recorded. Use a new Idempotency-Key when you send it for real.
Safe to retry. Send the same external_id and answers again and the submission is not stored twice. A 202 means accepted: it appears within about a minute, under the API channel.
# Record one submission to a live link, email or website survey
curl https://app.userloop.io/api/v1/responses \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ticket-1042" \
-d '{
"survey_id": "SURVEY_ID",
"external_id": "ticket-1042",
"answers": [
{ "question_id": "SCORE_QUESTION_PUBLIC_ID", "score": 9 },
{ "question_id": "TEXT_QUESTION_PUBLIC_ID", "text": "Helpful support" }
]
}'const BASE = "https://app.userloop.io/api/v1";
const KEY = process.env.USERLOOP_API_KEY;
// Answers collected in your own app, stored under the API channel
async function recordResponse(ticket) {
const res = await fetch(BASE + "/responses", {
method: "POST",
headers: {
Authorization: "Bearer " + KEY,
"Content-Type": "application/json",
"Idempotency-Key": "ticket-" + ticket.id,
},
body: JSON.stringify({
survey_id: "SURVEY_ID",
// Keep external_id and answers the same on a retry
external_id: "ticket-" + ticket.id,
answers: [
{ question_id: "SCORE_QUESTION_PUBLIC_ID", score: ticket.score },
{ question_id: "TEXT_QUESTION_PUBLIC_ID", text: ticket.comment },
],
}),
});
const body = await res.json();
// A 400 lists every problem in body.errors, and nothing is recorded
if (!res.ok) throw new Error(res.status + " " + body.code + ": " + body.detail);
return body.response_id; // 202: stored within about a minute
}# Check the answers first. Nothing is recorded.
curl https://app.userloop.io/api/v1/responses \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ticket-1042-validate" \
-d '{
"survey_id": "SURVEY_ID",
"external_id": "ticket-1042",
"validate_only": true,
"answers": [{ "question_id": "QUESTION_PUBLIC_ID", "text": "Helpful support" }]
}'The rules
What holds for every request
- Keys
- A key starts ulk_live_ and goes in the Authorization header as a bearer token. A key sent in the address is refused with 400 key_in_query. An organization can have up to 25 active keys, and a revoked key stops working within a minute.
- Scopes
- 7 scopes, chosen when the key is created: surveys:read, surveys:write, responses:read, responses:write, reports:write, account:read and account:write. A missing one answers 403 insufficient_scope and names it in required_scope.
- Acting as a person
- A key does everything as the person who created it, within their role. Publishing, unpublishing, archiving and restoring a survey need a key made by an organization admin. When that person leaves, their keys stop within 15 minutes.
- Expiry
- 30 days, 90 days, 1 year or never, chosen at creation. An expired key answers 401 key_expired and cannot be renewed, so create its replacement first.
- Pagination
- Every list returns data, has_more and next_cursor. Treat the cursor as opaque and keep the query the same between pages. Only limit may change.
- Rate limit
- About 120 requests a minute for each key, stated on every response as RateLimit-Policy. Over it, the API answers 429 with a Retry-After header in seconds. There is no remaining-requests header, so plan to stay under.
- Idempotency
- Send an Idempotency-Key header on any POST, PATCH or DELETE. A repeat with the same key within 24 hours returns the first result with Idempotent-Replayed: true. The same key on a different request answers 422.
- Errors
- Every error is an RFC 9457 problem, sent as application/problem+json with type, title, status, detail, instance and code. Branch on code. detail is a sentence for people and can change.
- Request ID
- Every response carries a UserLoop-Request-Id header, and an error repeats it as instance. Log it with each failed request.
- Contact details
- Customer email addresses, names and phone numbers come back masked unless the key was created to allow contact details and the request adds include_contact_details=true. Both are needed.
- Versioning
- Within v1, fields and enum values are only ever added. Write code that ignores the ones it does not know.
- OpenAPI
- https://app.userloop.io/api/v1/openapi.json is an OpenAPI 3.1 document, readable with no key. Each operation carries its scope as x-userloop-scope.
First call, and when it fails
A first request, then errors and retries you can code against
GET /me tells you what your key can do. After that, a refusal always says why in a stable code, and a write can be sent again without happening twice.
# Which key is this, whose is it and what may it do?
curl -s https://app.userloop.io/api/v1/me \
-H "Authorization: Bearer $USERLOOP_API_KEY"
# The machine-readable description. No key needed.
curl -s https://app.userloop.io/api/v1/openapi.jsonHTTP/2 403
Content-Type: application/problem+json
UserLoop-Request-Id: req_3Kp9WnX1cV5bM7qL
{
"type": "https://app.userloop.io/api/v1/problems/insufficient_scope",
"title": "Insufficient scope",
"status": 403,
"detail": "This API key doesn't have the surveys:write scope. Create a key with it on the API keys page.",
"instance": "req_3Kp9WnX1cV5bM7qL",
"code": "insufficient_scope",
"required_scope": "surveys:write"
}HTTP/2 429
Content-Type: application/problem+json
Retry-After: 60
UserLoop-Request-Id: req_9Tn4XcB2vL7mQ0aK
RateLimit-Policy: 120;w=60
{
"type": "https://app.userloop.io/api/v1/problems/rate_limited",
"title": "Rate limited",
"status": 429,
"detail": "Too many requests with this key. Try again in a minute.",
"instance": "req_9Tn4XcB2vL7mQ0aK",
"code": "rate_limited",
"retry_after": 60
}# Send the same key on every retry of this write. It runs once.
curl -s -X POST https://app.userloop.io/api/v1/exports \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 8f14e45f-ceea-467a-9575-3b8e1c5a2d6b" \
-d '{"range": "30d"}'
# The first answer: 202
# { "id": "kn7d2x9c4v1b8m5q3w6e0r7t2y4u8i1o", "status": "queued", ... }
# Every repeat within 24 hours: the same 202 and body, plus this header,
# and no second export
# Idempotent-Replayed: trueAround the API
What the API pairs with
The API is for reading and writing on your schedule. Two other tools cover the moments it is the wrong fit for.
Analytics
Counts done for you, with revenue attached
Four analytics endpoints count every response in a range and return the numbers, so a dashboard of your own needs one request, not a crawl.
A whole survey. GET /surveys/{survey_id}/analytics returns an overview, a trend and one entry per question, each figure beside the same figure for the period before.
One question. GET /analytics/answer-counts gives each answer's count, share, revenue and average order value. GET /analytics/scores gives NPS and satisfaction.
Over time. GET /analytics/timeseries counts responses per day, week or month, with empty periods filled with 0.
Webhooks
Do not poll for new responses
Polling spends your rate limit on work a webhook does for free. Add an endpoint with POST /webhooks and UserLoop posts each response to your URL as it arrives.
6 events. A new answer, a completed submission, an updated one, a low score, a survey published and a survey unpublished.
Same IDs both ways. The response_id in an event opens the same submission with GET /responses/{response_id}.
Catch up through the API. If your receiver was down, read what you missed with GET /responses and a date range.
Agents
A scoped key for an agent that runs on its own
An agent on a schedule or behind a webhook has nobody to sign in for it. Give it a key with only the scopes its job needs.
Least access. A weekly summary needs responses:read and nothing else. An agent that records answers needs responses:write.
Masked by default. Unless you create the key with contact details, the agent never sees an email address or a full name.
Or sign in. An AI app a person uses can connect to the MCP server with OAuth instead, and gets 93 tools with no key.
Keep building
The other three ways in
Most projects use the API with one of these.
- PlusWebhooks6 signed events, 10 attempts each and a 90 day delivery log.
- Every planWebsite SDKOne script that shows surveys in your front end and gives your code a global to call.
- Unlimited and PlusMCP server93 tools for Claude, ChatGPT, Cursor and any app that takes a remote MCP server.
- PlusMakeScenarios that trigger on a submission and send survey emails, built on this API.
- Plusn8nA UserLoop node for your own workflows, using a key and a webhook.
- All developer toolsThe four interfaces side by side, and when to use each.
Frequently asked questions
Does UserLoop have a survey API?
Yes. It is a REST API at https://app.userloop.io/api/v1 with 50 operations for surveys, questions, responses, customers, analytics, reports, email sends and webhooks. Requests and responses are JSON, and the OpenAPI 3.1 description is public.
Is there an NPS API?
Yes. GET /analytics/scores returns the NPS for a question over a date range, from -100 to 100, with promoters, passives and detractors, the 0 to 10 distribution and the revenue attached to each segment. The same endpoint returns satisfaction and number scores.
Which plan includes the API?
The Plus plan, at $99 a month or $950 a year, with a 14-day trial. On another plan, keys are kept but every endpoint except GET /me answers 402 plan_required.
How do I authenticate?
Create a key in Settings under API keys and send it as Authorization: Bearer ulk_live_ followed by the rest of the key. The key carries the scopes you ticked and acts as you. There is no OAuth flow for the API and no key in the query string.
What are the API rate limits?
About 120 requests a minute for each API key. Over the limit, the API answers 429 with a Retry-After header in seconds. Each key has its own limit, so two apps with a key each do not slow each other down.
Can I send a survey email through the API?
Yes. POST /surveys/{survey_id}/send emails a live email survey to one person now, and POST /sends reports an order or custom event to surveys that already have an API trigger. Both need the surveys:write scope and sending approval on the account, and they count toward the plan's monthly email allowance.
Can I import responses collected somewhere else?
Yes. POST /responses records a new submission to a live link, email or website survey, with the responses:write scope. Each answer is checked against the published survey first, and an external_id of your own makes a retry safe.
Does the API return customer email addresses?
Only when you allow it twice. The key must be created with contact details switched on, and the request must add include_contact_details=true. Otherwise emails, names and phone numbers are masked, for example em**@ex*****.com.
Can I call the API from a browser?
No. The API sends no CORS headers, so a web page cannot call it and a key never ends up in page source. Call it from your server. To show a survey in a browser, use the website SDK, which needs only a public site key.
Keep reading
Read the spec, then make the first call
The OpenAPI document needs no key. Plus includes the API and starts with a 14-day trial.