How to recover and upload deleted data in kobotool box

Recovering deleted data in KoBoToolbox depends on several factors, including whether backups are available or if the data is still retrievable from the system. While losing important data can be stressful, there are several methods you can try to restore it.

In this guide, we’ll walk you through the key recovery options available in KoBoToolbox. From checking built-in archive or trash folders to exploring backup solutions and external recovery methods, we’ll outline the steps you can take to retrieve lost data effectively. By following these best practices, you can improve your chances of successful recovery and ensure your data remains protected in the future.

1.Check Data Table for Soft Deletion

  • Sometimes, submissions are archived instead of permanently deleted.
  • Go to DATA > Table View and check if the data is still available

2. Using ODK Briefcase to upload Data

If you collected data using ODK Collect and need to push it back to KoboToolbox, follow these steps:

Steps:

1.Download ODK Briefcase

2.Pull Data from Your Device or Local Storage

  • Open ODK Briefcase.
  • Click “Pull” → Select your ODK Collect storage folder or previously downloaded .xml files.

3.Export Data as CSV (Optional)

Go to “Export” tab → Choose CSV format.

4.Push Data Back to KoboToolbox

3. Using the post method

a. Requirements

Your KoboToolbox API Key (found in Account Settings)
 Your Form ID (to get this, go to your project URL, it looks like aBcDeFGh123)
A backup of your deleted data in CSV, JSON, or Excel format
A tool to make API requests (e.g., Python, Postman, cURL)

b.Convert Your Data to JSON Format

KoboToolbox’s API accepts submissions in JSON format. Your data should look like this:

{ “id”: “your_ form

“submission”: [ { “field1”: “value1”, “field2”: “value2”, “field3”: “value3” }, { “field1”: “value4”, “field2”: “value5”, “field3”: “value6” } ] }

Make sure the field names match exactly with the KoboToolbox form.

c. Send a POST Request to upload Data

You can use Python, Postman, or cURL to send data to KoboToolbox.

 

d.Verify Your Data in KoboToolbox

  • Go to KoboToolbox > Data > Table View
  • Refresh the page to check if the new submissions appear
  • If necessary, export the data to confirm everything is correct

4.By using scripting method

If you have accidentally deleted data in KoboToolbox, you can attempt to recover and re-upload it using the KoboToolbox API. Below is a complete script in java that:

Retrieves backups (if available)
Restores lost data
Re-uploads deleted records

a.Requirements

KoboToolbox API Key (Find it in Account Settings)

  • Form ID (Check your KoboToolbox URL for the project)
  • Backup of deleted data (CSV, JSON, Excel)

b.Step-by-Step Scripting Approach

i.Get Existing Data (If Available)

         Before restoring data, check if any submissions still exist.

ii. Re-Upload Deleted Data (Using Backup CSV/JSON)

        If you have a backup file (CSV/Excel/JSON), you can re-upload it.

iii.Automate Recovery with a Full Script

4.Verifying Restored Data

After running the script:
 Log in to KoboToolbox
 Go to Data > Table View
 Check if the missing records have been restored

5.Scripting method by python

If you want to automate tasks in KoboToolbox using Python, you can interact with KoboToolbox API for tasks like:

  • Fetching survey data
  • Submitting data programmatically
  • Managing forms (creating, updating, deleting surveys)
  • Exporting responses to Excel or CSV
  • Automating data analysis

1.Installing Required Libraries

First, install the necessary Python libraries

pip install requests pandas

2.Authenticate with KoboToolbox API

You’ll need an API Token from KoboToolbox.
Find it in KoboToolbox → Account Settings → API Token.

3. Fetch Form Data from KoboToolbox

Python Code to Fetch API Token

import requests

 username = “your_username” 

password = “your_password” 

response = requests.get(“https://kf.kobotoolbox.org/token/?format=json”, auth=(username, password)) print(response.json()) # This will print your API token

4.Export KoboToolbox Data to CSV/Excel

Example: Convert API Data to CSV

import pandas as pd

 data = response.json() # Fetch data from API

df = pd.DataFrame(data) 

df.to_csv(“kobo_data.csv”, index=False

print(“Data exported to kobo_data.csv”)

5.Submit Data to KoboToolbox via API

If you want to programmatically submit data:

Sending a Form Response via Python

import json

API_TOKEN = “your_api_token”
url = “https://kc.kobotoolbox.org/api/v1/submissions”

data = {
“id”: “your_form_id”,
“values”: {
“name”: “John Doe”,
“age”: 30,
“gender”: “male”
}
}

headers = {
“Authorization”: f”Token {API_TOKEN},
“Content-Type”: “application/json”
}

response = requests.post(url, headers=headers, data=json.dumps(data))

 

print(response.status_code, response.text)

 

6.Get a List of All Forms in KoboToolbox

url = "https://kc.kobotoolbox.org/api/v1/forms"
response = requests.get(url, headers=headers)

if response.status_code == 200:
print(response.json()) # List all available forms
else:
print("Failed to fetch forms")


7.Download Attachments (Images, Signatures)

If your form includes images, signatures, or file uploads, you can download them using Python

import os

 API_TOKEN = “your_api_token” 

FORM_ID = “12345”

headers = {“Authorization”: f”Token {API_TOKEN}

response = requests.get(f”https://kc.kobotoolbox.org/api/v1/data/{FORM_ID}, headers=headers) 

if response.status_code == 200:

 submissions = response.json()

 os.makedirs(“downloads”, exist_ok=True) # Create folder to save files

for submission in submissions:

  if “image_field_name” in submission: # Replace with actual field name 

image_url = submission[“image_field_name”

image_response = requests.get(image_url, headers=headers) 

filename = os.path.join(“downloads”, image_url.split(“/”)[-1])

  with open(filename, “wb”) as file:

 file.write(image_response.content) 

print(f”Downloaded {filename}

else:

  print(“Failed to fetch submissions”)

8.Automate Data Processing with Python

After downloading data, you can use pandas, NumPy, or Matplotlib for analysis.

Frequently
Asked Questions

KoboToolbox offers a few ways to check if your data is still available:

1. Checking Submissions:

  • Log in to your KoboToolbox account.
  • Open your project. This will show you the number of submissions received.
  • View your data in a table. This allows you to see all the submissions and their details.  

2. Downloading the Data:

  • On the project page, select "Download data."  
  • Choose your preferred format (XLS, CSV, ZIP, KML).  
  • Download the file. This ensures you have a local copy of your data.

3. Project Settings:

  • Go to "Project Settings."
  • Check "Accept submissions." This confirms that submissions are still being accepted.
  • Ensure the project hasn't been deleted.

Additional Tips:

  • Regularly download your data. This serves as a backup in case of any issues.
  • Check the KoboToolbox community forum or documentation for any updates or known issues.
  • If you have concerns about data loss, contact KoboToolbox support.

By following these steps, you can ensure that your data is safe and accessible within KoboToolbox

KoboToolbox

 

does not currently offer a direct way to restore deleted submissions. 1 Once data is deleted from your KoboToolbox server, it is generally irretrievable.   

This is why it's crucial to:

  • Regularly download your data: This creates a backup of your submissions, allowing you to restore them if they are ever deleted from the server.
  • Be cautious when deleting data: Double-check before deleting any submissions to avoid accidental data loss.

Possible Workarounds (with limitations):

  • If you have offline drafts: If the submissions were saved as drafts on the data collection devices but not yet submitted, you might be able to retrieve them from those devices.
  • ODK Briefcase: If you used ODK Briefcase to manage your data collection, it might have a copy of the submissions.

Important Note:

  • KoboToolbox is aware of this limitation and has a feature request for a "restore deleted project" option. You can vote for this feature on their Suggestion Box to show your support.

While there's no guarantee of restoring deleted submissions, these workarounds might help in some cases. However, the best approach is always to back up your data regularly to prevent data loss.

Restoring Data from Offline Sources:

  • Upload from KoboCollect: The primary way to restore data from an offline source is by uploading the saved forms from the KoboCollect app to your KoboToolbox server.
  • Data Backup: If you have backups of the data files from your mobile device, you might be able to manually upload them to your KoboToolbox server. However, this might require some technical knowledge and might not always be possible.

Important Considerations:

  • Data Integrity: Ensure that the data on your offline source is complete and accurate before uploading it to your KoboToolbox server.
  • Data Security: Protect the devices containing offline data to prevent data loss or unauthorized access.
  • Regular Backups: Regularly back up your data from offline sources to prevent data loss in case of device damage or theft.

By following these steps, you can effectively collect data offline and restore it to your KoboToolbox server when an internet connection is available.

  • Generally, no. KoboToolbox does not currently have a built-in "undo" button or a way to restore deleted projects or data. This is a feature that has been requested by users, but it's not available as of February 2025.
     

 

  • Unfortunately, nothing directly within KoboToolbox. Once a project is deleted, it's typically gone.
  • Feature Request: You can vote for the "backup restore operations" feature request in the KoboToolbox community forum to show your support for this functionality.
     

 

  • It depends on where the data was deleted.
    • Data deleted from the server: If you deleted data from the KoboToolbox server, it's likely not recoverable.
    • Data deleted from the device (KoboCollect or Enketo): There might be a chance to recover data if it was not yet submitted to the server. This is less likely if the device's cache was cleared or the data was overwritten.

4. How can I minimize the risk of data loss in the future?

  • Regular Backups: If possible, regularly export your data from KoboToolbox to your computer or another secure storage location.
  • ODK Briefcase: If you are using KoboCollect, you can use ODK Briefcase to retrieve data from devices even if it hasn't been submitted to the server.
× Chat with us !