diff --git a/api/api.inc.php b/api/api.inc.php
index 351a21570f24b3e643b8ab8e90e562054c466bd0..ecde89f9b7d8c6c7aa6a6f1082c39fd5a9484c6d 100644
--- a/api/api.inc.php
+++ b/api/api.inc.php
@@ -14,6 +14,13 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 file_exists('../main.inc.php') or die('System Error');
+
+// Disable sessions for the API. API should be considered stateless and
+// shouldn't chew up database records to store sessions
+if (!function_exists('noop')) { function noop() {} }
+session_set_save_handler('noop','noop','noop','noop','noop','noop');
+define('DISABLE_SESSION', true);
+
 require_once('../main.inc.php');
 require_once(INCLUDE_DIR.'class.http.php');
 require_once(INCLUDE_DIR.'class.api.php');
diff --git a/include/class.ostsession.php b/include/class.ostsession.php
index f2be6b18b5ea2ffe9c94beda2cfd896e699e91f4..1bcea436bd0115e957fd2c26da147f445190e63e 100644
--- a/include/class.ostsession.php
+++ b/include/class.ostsession.php
@@ -26,7 +26,7 @@ class osTicketSession {
         if(!$this->ttl)
             $this->ttl=SESSION_TTL;
 
-        if (!OsticketConfig::getDBVersion()) {
+        if (!defined('DISABLE_SESSION') && !OsticketConfig::getDBVersion()) {
             //Set handlers.
             session_set_save_handler(
                 array(&$this, 'open'),