If your code calls https://api.userloop.io with an X-API-Key header and a key that starts ul_live_, it uses the old UserLoop API. The current API is a different service, with its own keys, addresses and response shapes. This page maps one onto the other so you can switch.
How long the old API keeps working
Old keys keep working with the old API, at https://api.userloop.io with the X-API-Key header. Each old key lapses 365 days after it was created. An old key doesn’t work with the current API: sending one there answers 401 with the code legacy_key.
What changed
| Old API | Current API | |
|---|---|---|
| Base URL | https://api.userloop.io |
https://app.userloop.io/api/v1 |
| Key | ul_live_…, made on the old dashboard’s account page |
ulk_live_…, made in Settings on the API keys page, with scopes |
| Sending the key | X-API-Key: ul_live_… |
Authorization: Bearer ulk_live_…. A key in the query string is refused. |
| Survey, question and answer IDs | 1710884429805x… |
The same IDs, as public_id. Surveys also have an id; either works wherever a survey_id is asked for. |
| A response | One row per answer | One item per submission, with every answer in answers |
| Customers’ emails and names | Returned as stored | Masked unless you ask with include_contact_details=true, using a key that allows it |
| Dates | start_date, end_date |
from, to (both YYYY-MM-DD, UTC, both included), or range |
| Pages | limit (up to 200) and offset |
limit and an opaque cursor; lists return data, has_more and next_cursor |
| Errors | { "error", "code", "detail" }, codes in capitals |
Problem details (application/problem+json) with type, title, status, detail, instance and a lower-case code |
| Writes | None | Surveys, questions, exports, sends and webhooks can be created and changed |
Read Authentication and scopes, Pagination and Errors for each in full.
Which endpoint replaces which
| Old endpoint | Current endpoint | Notes |
|---|---|---|
GET /health |
GET /me |
GET /me needs a key: it returns the key, its organisation and its scopes, and answers on every plan. GET /openapi.json needs none. |
GET /surveys |
GET /surveys |
Items have id, public_id, title, status (draft, active or archived) and format in lower case (email, checkout, link …). There is no company_id: the key names the organisation. |
GET /surveys/{survey_id} |
GET /surveys/{survey_id} |
Questions are under questions, each with public_id (the old question_id), type and answers, each answer with public_id (the old answer_id) and text. |
GET /responses?view=counts |
GET /analytics/answer-counts for single select, multi select and CSAT questions; GET /analytics/scores for NPS and number score questions |
share runs from 0 to 1 where percentage ran from 0 to 100. revenue and aov are objects with amount and currency. The total is respondents. |
GET /responses?view=open |
GET /written-answers |
Filter by survey with survey_id. It doesn’t filter by question (outside answer themes): keep the items whose question_id is yours. The text is in text. |
GET /responses |
GET /responses |
One item per submission instead of one per answer. The filters are those of the dashboard’s Responses page. |
GET /responses/{response_id} |
GET /responses/{response_id} |
Returns the whole submission under response. |
Two defaults changed with the dates. GET /responses and GET /written-answers still cover all time when you give no dates, but the analytics endpoints cover the last 30 days. Pass range=all, or from and to, for the old behaviour.
Fields of a response
The old raw response rows map onto a response item like this:
| Old field | Current field |
|---|---|
id, unique_id |
response_id. An old row named one answer; GET /responses/{response_id} takes the ID of any answer and returns its whole submission. |
survey |
survey.public_id (with survey.title) |
creation_date |
received_at |
question_id, question_text |
answers[].question_id, answers[].question |
answer_id, answer_text |
answers[].answer_ids, answers[].answer; for NPS and number scores, answers[].score |
open_ended_response |
answers[].answer of an open_ended answer |
recipient |
customer.email (masked by default) |
order_total, currency |
order.total, order.currency |
line_items |
order.products |
utm_source … utm_content, landing_site |
attribution.source … attribution.content, attribution.landing_site |
List and search responses describes every field.
Switch
Create a key
In the UserLoop dashboard, open Settings, then API keys, and create a key. Give it the scopes your code needs:
surveys:readfor surveys,responses:readfor responses and analytics. If your code reads customers’ email addresses, tick Include customers’ contact details when asked. Copy the key: it is shown once. See Quickstart: get a key and make a call.Change the address and the header
Replace the base URL and send the key as a bearer token:
curl https://app.userloop.io/api/v1/me \ -H "Authorization: Bearer ulk_live_…"A
200with your organisation’s name means the key works.Keep your stored IDs
The survey, question and answer IDs you stored from the old API work as they are: pass a survey’s old ID as
survey_id, and a question’s asquestion_id.Move each call
Use the table above. Rename
start_dateandend_datetofromandto, and passrange=allto the analytics endpoints if you relied on all-time totals. If you read email addresses, addinclude_contact_details=true.Read the new shapes
Read
datainstead ofresponsesorsurveys, and walkanswersin each response instead of one row per answer. Ignore fields and values you don’t know: new ones are added without warning.Page with the cursor
Replace
offsetwithcursor: sendnext_cursorback, with the same query, whilehas_moreistrue. There is no total count of responses; to count, use the analytics endpoints.Handle the new errors
Branch on
statusandcode, not on text. OldUNAUTHORIZEDis now one ofunauthenticated,key_revoked,key_expiredorkey_suspended; oldFORBIDDENis mostlyinsufficient_scope(withrequired_scope) orcontact_details_not_allowed; oldBAD_REQUESTisinvalid_request(witherrorslisting each parameter). New are429 rate_limitedand503 unavailable: wait forRetry-Afterand try again. See Rate limits and safe retries.
Check it worked
Run the old and new calls side by side for one survey and one date range, and compare what comes back. The current API’s numbers match the dashboard’s for the same survey and dates.
What can go wrong
| You see | What to do |
|---|---|
401 with code: "legacy_key" |
You sent a ul_live_ key to the current API. Create a ulk_live_ key. |
400 with code: "key_in_query" |
The key was in the address. Send it in the Authorization header, then revoke that key and create a new one, because addresses end up in logs. |
401 unauthenticated |
The header isn’t Authorization: Bearer ulk_…, or the key was mistyped. |
402 plan_required |
The organisation isn’t on the Plus plan. |
400 invalid_request naming start_date, offset or view |
Old parameter names. Use from, to, cursor and the endpoints above. |
Emails come back as ja**@ex*****.com |
Add include_contact_details=true, with a key that allows contact details. See Customer contact details in responses. |