Troubleshoot API Pulls Systematically
If an API script cannot pull survey responses, check the key, survey id, request headers, pagination, permissions, and expected response shape. Fix one layer at a time so you do not confuse an authentication problem with a data parsing problem.
Use the browser export as the reference point. If Export shows responses but the API does not, the problem is probably the request, credentials, survey id, or pagination. If both are missing the same rows, investigate collection, Flow, or response cleaning first.
Export: Data Output
Debug The Request
Step 1: Confirm the key exists. Follow Pull Survey Responses With the API to create or identify the API key in Settings.
Step 1: Confirm the key exists
Step 2: Check the Authorization header. Send the key as a Bearer token and avoid copying extra spaces or quotes from an environment file.
Step 2: Check the Authorization header
Step 3: Confirm the survey id. Use the UUID from the survey URL, not the public link slug or title.
Step 3: Confirm the survey id
Step 4: Test a small request. Start with
limit=1or another low limit before wiring the request into a full data pipeline.Step 4: Test a small request
Step 5: Handle pagination. Keep requesting until
next_cursorisnull, as described in Pull Survey Responses With the API.Step 5: Handle pagination
Step 6: Compare with a manual export. Download Export data and confirm your script receives the same expected fields and response count.
Step 6: Compare with a manual export
Common API Errors
- 401: the key is missing, invalid, expired, or copied incorrectly.
- 403: the key does not have access to the requested survey.
- 404: the survey id is wrong or the survey is unavailable to that key.
- 429: the script is sending requests too quickly; add a delay between pages.
- 500: retry once, then check whether your request parameters are valid before assuming responses are missing.
- Empty data: check whether responses exist, whether you are using the right survey id, whether the key belongs to the right workspace, and whether pagination has reached the end.
Export: Data Output
Request Checklist
- Header:
Authorization: Bearer dmdt_...with no surrounding quotes in the actual header value. - Endpoint:
/api/v1/responseswithsurvey_idas a query parameter. - Survey id: the UUID from the editor URL, not the published
/s/...path. - Limit: keep test requests small, then increase up to the documented maximum once the response shape is correct.
- Cursor: pass the previous
next_cursorvalue exactly; do not reformat the timestamp. - Logging: log status code, request URL without the key, response count, and next cursor for every page.