diff --git a/api/handlers/confighandler.py b/api/handlers/confighandler.py
index 8b341b73ed29910f1e27067fdc14c92dec91474d..d248264822cc58511cbef99e0964328ee074edbf 100644
--- a/api/handlers/confighandler.py
+++ b/api/handlers/confighandler.py
@@ -22,4 +22,8 @@ class Version(base.RequestHandler):
 
     def get(self):
         """Return database schema version"""
-        return config.get_version()
+        resp = config.get_version()
+        if resp != None:
+            return resp
+        else:
+            self.abort(404, "Version document does not exist")
diff --git a/test/integration_tests/python/test_handlers.py b/test/integration_tests/python/test_handlers.py
index 4f2015fdfbb413e9c5124d34454cbf835593597c..65b5133cd9682cf23043a086f5a1e14a6e8d4638 100644
--- a/test/integration_tests/python/test_handlers.py
+++ b/test/integration_tests/python/test_handlers.py
@@ -80,8 +80,14 @@ def test_devicehandler(as_user, as_root, as_drone, api_db):
     api_db.devices.remove({'_id': 'test_drone'})
 
 
-def test_config_version(as_user):
+def test_config_version(as_user, api_db):
+    # get database version when no version document exists, It hasn;t been set yet in the tests
+    r = as_user.get('/version')
+    assert r.status_code == 404
+    api_db.singletons.insert_one({"_id":"version","database":3})
+
     # get database schema version
     r = as_user.get('/version')
     assert r.ok
-    assert r.text == '' # not set yet
+    assert r.json()['database'] == 3
+    api_db.singletons.find_one_and_delete({'_id':'version'})