You are currently viewing SurveyCTO API: 6 tips for automating survey data management

Push survey data to other platforms, filter submissions by review status, create real-time dashboards, and more with the SurveyCTO API.

The SurveyCTO API, or application programming interface, is primarily used to pull survey data into other platforms and databases. When you’re managing large amounts of data, letting your various platforms and tools talk to each other through an API can save you and your team massive amounts of time. 

You may already be a SurveyCTO user taking advantage of the API, so we’ll give you some ideas of more things you could be doing with it. 

And if you’re not using the API yet, this article will give you an idea of what’s possible.

 

Who can use the SurveyCTO API? 

If you’re a SurveyCTO user on a free trial, paid, or community subscription, you can use the REST API to access server data for both encrypted and unencrypted forms. Let’s dive into specific tips. 

1. Choose whether to export data in JSON or CSV format

With SurveyCTO’s API, you can export data in JSON or CSV format directly into other data analysis and visualization platforms and databases. Each format has its pros and cons, but you can choose whichever format works specifically for your use case.

JSON files work well with more robust data needs: In general, JSON exports are best if you need more robust and flexible options for what you do with your data, like encrypted data, incremental downloads with the date parameter, and segmentating submissions based on review status. We’ll share more on those in a moment. 

Choose CSV files for large exports: CSV files are best if you’re less tech-savvy and looking to export large amounts of data, or if you’re working with Stata. 

Regardless of whether you choose JSON or CSV format to export data, if you’re using a form that includes media files (such as images, signatures, audio recordings, or videos) the exported data will include URLs for those files.

2. Push data directly to PowerBI, Stata, or other platforms

PowerBI and Stata are two of the most common platforms that SurveyCTO users connect with the API to publish survey data. You can connect SurveyCTO via the API to any other platform that supports REST API with basic authentication.

For example, if you’re running a survey with SurveyCTO as your primary data collection tool, but want to then publish data directly into PowerBI for visualization, you can use the API to connect SurveyCTO to PowerBI and publish data directly into your dashboards

For example, here’s a real-time activity report from Oxfam GB where the organization used SurveyCTO to collect data and pushed data to PowerBI for real-time visualization. 

Oxfam GB Activity Report from Palu humanitarian response, Indonesia

 

Oxfam GB Activity Report from Palu humanitarian response, Indonesia

3. Export encrypted data via the API

If you choose to take advantage of SurveyCTO’s end-to-end encryption, the API allows you to pull data from encrypted forms by specifying a private key file to decrypt the data. The private key file is not stored in the SurveyCTO server and the decrypted data will not be cached anywhere. 

If you’re using Stata, you can also use the SurveyCTO Stata command to download encrypted data or forms. 

This is useful when you’re collecting Personally Identifiable Information (PII) that must be protected for respondent privacy and data security.

4. Save time by specifying date ranges to export data incrementally 

If you’ve ever created API calls to run automatically when new data comes in every day, you’ve probably experienced how cumbersome it can be to export all the data every single time. To avoid this cumbersome process, SurveyCTO’s API allows you to use the date parameter to specify the date range for the data you want to export. 

For example, if you only want to export new data that came in between yesterday and today, you can specify that data only be fetched after the specific date:

https://servername.surveycto.com/api/v2/forms/data/wide/json/formid?date=[D]

Find more details on how to specify a date range in the full API documentation. 

5. Use the API with the review and correction workflow

The review and correction workflow is one of the most powerful ways that SurveyCTO users monitor and ensure the quality of their data. This allows you to hold new submissions, correct, annotate, and approve or reject them before they are published or exported. 

If you take advantage of the review and corrections workflow, the API is flexible enough so that you can specify the review statuses (approved and/or rejected) of the submissions you want to export. 

You can also use the API to request submissions that are pending review.

For example, if you’re using the API to publish data to a live dashboard, you can use the review and corrections workflow to ensure that only approved submissions get pushed to the dashboard. 

6. Give API access at the user-role level 

Given that the API allows for easy access to your data within SurveyCTO, it’s important to ensure that only specified users have access to that data. To add extra security, you can adjust the “Allow server API access” setting to control whether or not users in a given role can use the API to fetch forms and data from the server. 

If you disable the access option, users in that specific role will only be able to access the server through the server console, SurveyCTO Desktop, and SurveyCTO Collect. You can learn more about managing user roles in our product documentation. 

User role access restrictions

 

API access settings at the user role level

Dive deeper into what’s possible with the API 

This article is a broad overview of what’s possible with the SurveyCTO REST API. For more comprehensive documentation, visit our API support article.

Lindo Simelane

Digital Analytics Associate

Lindo is a part of the marketing team at Dobility, the company that powers SurveyCTO. He is responsible for all aspects of data management and analytics for SurveyCTO’s website, social media, and other marketing efforts.

Lindo has a passion for research to inform policy in international development and economics. He has extensive experience in the ICT4D space that includes research work, and a background in international business and finance.