I have exported my survey responses as a CSV file because I wanted to update few responses that is why I also exported the response ID’s . Now I made the updates to the responses in the CSV file in excel and I want to import them using API (there are more than 1 Lakh responses).
The CSV file is present in my downloads folder. I want to use import API to import the responses, I went through the support docs but still cannot understand how to use it.
We can do it either using python or postman. Can anyone please provIde me the python script required to import the responses? If not the python code I would appreciate some detailed step by step guidance as to how to do it in postman.
Hi Jason, here's a working Python script to import your updated responses via the Qualtrics Response Imports API. This assumes:
-
You have your API token and Data Center ID (e.g.,
ca1
,eu1
,us2
, etc.). -
Your CSV file is properly formatted, matching the survey’s question structure and including the correct Response IDs.
import requests
# === Configuration ===
api_token = 'YOUR_API_TOKEN'
data_center = 'YOUR_DATA_CENTER' # e.g., 'ca1', 'eu1', 'us2'
survey_id = 'YOUR_SURVEY_ID'
file_path = 'C:/Users/YourName/Downloads/updated_responses.csv'
# === Endpoint ===
url = f'https://{data_center}.qualtrics.com/API/v3/surveys/{survey_id}/import-responses'
# === Headers ===
headers = {
'x-api-token': api_token,
}
# === File Upload ===
files = {
'file': ('updated_responses.csv', open(file_path, 'rb'), 'text/csv')
}
# === Make the Request ===
response = requests.post(url, headers=headers, files=files)
# === Handle the Response ===
if response.status_code == 200:
print('Import request submitted successfully!')
print('Response:', response.json())
else:
print(f'Failed to import responses. Status code: {response.status_code}')
print('Error:', response.text)
I am getting a 404 error when using this code
Hi Jason, thanks for flagging that.
A 404 error from the Qualtrics API occurs when the endpoint URL is incorrect or the resource you're referencing doesn't exist (maybe a wrong survey ID or data center).
Here are a few things which you can try to double-check:
Verify your survey_id
Go to your Qualtrics dashboard → Projects → Select your survey → Click Survey Options → Find the ID in the URL (it starts with SV_).
Ensure that this ID matches exactly in your script.
Confirm your data_center value
You can find this in your account settings:
Go to Account Settings → Qualtrics IDs, and check the Datacenter value.
For example, if your URL is https://ca1.qualtrics.com, then your data_center = 'ca1'.
Check the endpoint construction
The line:
url = f'https://{data_center}.qualtrics.com/API/v3/surveys/{survey_id}/import-responses'
must exactly match the pattern above—with no trailing slashes or typos. A missing or extra / can break it.
Ensure your token has correct permissions
If the API token doesn't have import privileges or access to the given survey, Qualtrics may throw a 404.
If you can share (privately) the actual values you’re using for survey_id and data_center, I can help verify the full URL. Otherwise, just cross-check the structure exactly as above.
Let me know once if you stil face the issue!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.