diff --git a/TES/tes/apiendpoints.py b/TES/tes/apiendpoints.py
index 5d9bddc44f9dc4253d4afcfc6a9de277f9b005cd..7d65e207f8bd17fb3e114a145639cfdbde42a643 100644
--- a/TES/tes/apiendpoints.py
+++ b/TES/tes/apiendpoints.py
@@ -223,9 +223,9 @@ class JobStat(Resource):
             res = Ssh.execute(sshsess, host=host, user=user, cmd=cmd)
         except SshAgentException as e:
             logger.error(e)
-            flask_restful.abort(403, message="Identity error {}".format(e))
+            flask_restful.abort(401, message="Identity error {}".format(e))
         except SshCtrlException as e:
-            flask_restful.abort(403,message="We're having difficultly contacting {}. We failed with the message: {}".format(host,e))
+            flask_restful.abort(400,message="We're having difficultly contacting {}. We failed with the message: {}".format(host,e))
         if not (res['stderr'] == '' or res['stderr'] is None or res['stderr'] == b''):
             logger.error(res['stderr'])
             flask_restful.abort(400, message=res['stderr'].decode())
@@ -295,7 +295,7 @@ class DirList(Resource):
                 try:
                     dirls = json.loads(res['stdout'].decode())
                 except:
-                    flask_restful.abort(403,message="You don't have permission to view that directory")
+                    flask_restful.abort(401,message="You don't have permission to view that directory")
             else:
                 logger.debug('using ssh.sftpls')