Skip to content

Quickstart: get a key and make a call

Create an API key in UserLoop, check it with GET /me, then list your surveys, in about five minutes.

Create an API key in UserLoop, check it works with GET /me, then list your surveys. You need a terminal with curl; every other example on these pages builds on the same two calls.

Before you start

  • Your organisation is on the Plus plan.
  • You can sign in to UserLoop. Any member can create a key; an organisation admin can give it more permissions (see Authentication and scopes).
  • You’ll call the API from a server or a terminal. Browsers can’t call it, so a key never ends up in a web page.

Create a key

  1. Open the API keys page

    In UserLoop, open Settings, then select API keys under Developer. Select Create key. If you have no keys yet, the button is Create your first key.

  2. Name the key

    In Name, say what will use it, for example “Data warehouse”. Up to 60 characters. Create one key for each app or script, so you can revoke one without stopping the others.

  3. Choose its permissions

    Under Permissions, tick what the key may do. The read permissions are ticked to start with. For this quickstart, Read surveys is enough. Authentication and scopes lists what each one allows.

    The Create an API key dialog: the Name field, the Permissions checkboxes with the read permissions ticked, the contact details checkbox, the Expires choices and the Create key button
  4. Decide on contact details

    Leave Include customers’ contact details when asked unticked unless your code needs customers’ email addresses and names. Without it, they’re masked in every response. See Customer contact details in responses.

  5. Choose when it expires

    Under Expires, choose 30 days, 90 days, 1 year or Never. 1 year is chosen to start with.

  6. Create the key and copy it

    Select Create key. Your new API key shows the key, which starts ulk_live_, and a Try it command. Select Copy next to the key and store it where your code keeps secrets, then select I’ve copied it.

    UserLoop shows the key only this once. If you lose it, revoke it and create another.

    The Your new API key dialog: It expires on, the Copy it now warning, the Key and the Try it command (covered in this picture) each with a Copy button, and I’ve copied it

Check the key with GET /me

GET /me tells you which key you sent, which organisation it belongs to and what it may do. It needs no permission and answers on every plan, so it is the best first call. It is the same command as Try it in the dialog.

curl -s https://app.userloop.io/api/v1/me \
  -H "Authorization: Bearer ulk_live_…"

You should see 200 and a body like this:

{
  "key": {
    "id": "jd7c2kq8w4v1m9x3n5b6t0r2y8z4h1fa",
    "name": "Data warehouse",
    "hint": "ulk_live_4Qm7…C2d3",
    "scopes": ["surveys:read", "responses:read", "account:read"],
    "contact_details": false,
    "created_at": "2026-11-11T09:30:00.000Z",
    "expires_at": "2027-11-11T09:30:00.000Z"
  },
  "organisation": {
    "id": "org_2xYb7QeL9mNc4RtV8kHs1PaD0wF",
    "name": "Acme Coffee",
    "slug": null
  },
  "acting_as": {
    "user_id": "user_2xYbA1cD3eF5gH7iJ9kL0mN2pQ",
    "role": "org:member"
  },
  "plan_allows_api": true,
  "api_version": "v1"
}
  • key.scopes is what the key may do right now: the permissions you ticked, within what your role allows.
  • acting_as is you. Everything the key does is done as you, and shows as you in UserLoop.
  • plan_allows_api is false when the organisation’s plan doesn’t include the API. Every other endpoint then answers 402.

List your surveys

curl -s "https://app.userloop.io/api/v1/surveys?limit=2" \
  -H "Authorization: Bearer ulk_live_…"

You get a page of surveys, newest first:

{
  "data": [
    {
      "id": "k173vq9m2c8x4n1b5t7w3r6y0z2h8d4e",
      "public_id": "Nq8XcT2w",
      "title": "Post-purchase survey",
      "status": "active",
      "format": "checkout",
      "live_on": ["checkout"],
      "question_count": 3,
      "follow_up_count": 1,
      "published_version": 4,
      "live_since": "2026-09-02T10:15:00.000Z",
      "last_published_at": "2026-10-28T16:40:00.000Z",
      "link_url": null,
      "languages": [],
      "updated_at": "2026-10-28T16:40:00.000Z"
    },
    {
      "id": "k17aw2c5x8n0m3b6v9t1r4y7z0h3d6f9",
      "public_id": "Lp4RmZ7s",
      "title": "Website NPS",
      "status": "draft",
      "format": "link",
      "live_on": [],
      "question_count": 2,
      "follow_up_count": 0,
      "published_version": null,
      "live_since": null,
      "last_published_at": null,
      "link_url": "https://s.userloop.io/Lp4RmZ7s",
      "languages": ["fr", "de"],
      "updated_at": "2026-11-10T08:05:00.000Z"
    }
  ],
  "has_more": true,
  "next_cursor": "eyJ2IjoxLCJ0IjoibGlzdF9zdXJ2ZXlzIiwiYyI6IjIiLCJxIjoiZTNiMGM0NDIifQ",
  "total": 7
}

status is draft, active (live) or archived. Pass id (or public_id) as survey_id to the other endpoints. To read the next page, send next_cursor back as cursor: see Pagination.

Check it worked

Both calls return 200. On the API keys page, the key’s Last used column changes to Just now.

If a call fails

Every error is JSON with a code that says what went wrong and a detail sentence for people. For example, a key that was cut short when it was copied:

{
  "type": "https://app.userloop.io/api/v1/problems/unauthenticated",
  "title": "Unauthenticated",
  "status": 401,
  "detail": "That isn't a UserLoop API key. Keys start ulk_live_ or ulk_test_; check it was copied whole.",
  "instance": "req_7Hq2LmZ0aB4cD9eF",
  "code": "unauthenticated"
}
You see What it means What to do
401 unauthenticated No Authorization header, or the key isn’t one UserLoop knows. Send Authorization: Bearer and the whole key. Copy it again from where you stored it; UserLoop can’t show it again.
401 legacy_key The key starts ul_live_: it belongs to UserLoop’s old API. Create a new key on the API keys page. See Move from the old API.
401 key_revoked, key_expired or key_suspended The key was revoked, reached its expiry date, or the person who created it left the organisation. Create a new key.
402 plan_required The organisation’s plan doesn’t include the API. GET /me still works and shows "plan_allows_api": false. Move to the Plus plan in Settings > Plans & billing.
403 insufficient_scope The key doesn’t have the permission this endpoint needs. required_scope names it, for example surveys:read. Create a key with that permission.
400 key_in_query The key was sent in the address, for example ?api_key=. Send it in the Authorization header instead, and revoke that key: it may now be in logs.

Errors lists every code.

Next

Type to search…

↑↓ navigate↵ selectEsc close