🔌 API

Vtiger API session expires silently after 15–30 minutes of inactivity

The problem: Vtiger uses PHP session-based authentication. The sessionName you receive after login is tied to a server-side PHP session. PHP sessions have a session.gc_maxlifetime (default 1440 seconds / 24 minutes). Any session inactive for that duration is garbage-collected.

Solution 1 — Implement session auto-renewal in your client:
php
function vtiger_call(string $op, array $params): array {
$result = make_api_call($op, $params);
if (isset($result['error']['code']) &&
in_array($result['error']['code'], ['SESSION_EXPIRED','INVALID_SESSION_ID'])) {
$this->sessionName = vtiger_login($this->username, $this->accessKey);
$params['sessionName'] = $this->sessionName;
$result = make_api_call($op, $params);
}
return $result;
}


Solution 2 — Send a heartbeat call every 10 minutes:

GET /webservice.php?operation=getCurrentUser&sessionName=YOUR_SESSION


Solution 3 — Increase PHP session lifetime on your server:
ini
session.gc_maxlifetime = 86400
session.cookie_lifetime = 86400
← Back to API Join to discuss →