How do I get active users only through the API | Experience Community
Skip to main content
Question

How do I get active users only through the API

  • September 10, 2020
  • 6 replies
  • 190 views

Forum|alt.badge.img+2

Hi, newbie question but I can't find an answer in the forums so hope someone can point me in the right direction.
I simply want a list of users where accountStatus=active.
Using the List Users call gives me all users, and adding accountStatus=active as a parameter gives me a string https://fra1.qualtrics.com/API/v3/users?accountStatus=active , but it still returns all users, both active and disabled. Maybe I'm mistaken in thinking using a parameter in this way acts like a filter.
I'm new to working with API's (I use Postman) and don't know json or python, although just beginning to familiarise with json.
Ultimately, I want a list of emails of active uses. So if there's a way I can exclude the other elements of the body, like id, username, etc, that would save me some cleaning up (which I do in Note++).
Thanks!

6 replies

SRenoMT
Level 1 ●
Forum|alt.badge.img+8
  • Level 1 ●
  • January 11, 2021

Newbie here as well and I have a similar experience. I tried to search just for users with a specific last name and it still returns all users.


CSUSB
Level 2 ●●
Forum|alt.badge.img+12
  • Level 2 ●●
  • August 28, 2026

I have my python code to do this working. I’ll post it here when I return on Monday. There is a system error preventing me from adding it today.

 

-Rich

 


TusharDalwani
QPN Level 6 ●●●●●●

The list users API call will return all users, you will need to store those in a survey project or IDP where you can further filter out the records by status=active.


CSUSB
Level 2 ●●
Forum|alt.badge.img+12
  • Level 2 ●●
  • August 31, 2026

Every time I attempt to paste my working.py code, a popup says “Something has gone wrong”, and the posting fails. Does anyone know why? Is there a length limit for posts here, perhaps?

 

-Rich

 


JesperAndersen
QPN Level 4 ●●●●
Forum|alt.badge.img+12
  • QPN Level 4 ●●●●
  • September 4, 2026

​Hi @TCA ,

One way of doing this could be to use a lifecycle project to pull in the users you need, based on an automation. Then you could use an API call to get and run through the participants in the project. 


CSUSB
Level 2 ●●
Forum|alt.badge.img+12
  • Level 2 ●●
  • September 4, 2026

I’m still trying to post my (working) python code here. What follows is just a code stub test, not the actual program. 

import csv
import json
import sys
import time
from urllib.error import HTTPError, URLError
from urllib.parse import urljoin, urlparse
from urllib.request import Request, urlopen


OUTPUT_FILE = "userlist.csv"
##### OUTPUT GOES TO userlist.csv
##### DANGER! TOKENS ARE SOURCED HERE! I did not put them in the environment!!!
#######
# Enter the API token between the quotation marks. Anyone who can read this
# source file will be able to use the token with its assigned permissions.
QUALTRICS_API_TOKEN = "YOUR_API_KEY_HERE!!!"

# Enter the datacenter ID shown in your Qualtrics account, such as iad1 or ca1.
QUALTRICS_DATACENTER_ID = "FIRST_NAME_OF_DATACENTER!!!"


class QualtricsError(RuntimeError):
"""Raised when a Qualtrics API request or response is invalid."""