---
schema_version: "1"
id: bce4a1f9837632d738a0306b531dfacd1a60168e08d3b4a4b6c38c453227159b
title: Error Handling for Session Expiration
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_error_handling_session_exp.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_error_handling_session_exp.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b3b69a79be2f1b21d1d82c7414d7843f62c42cd5f4ddf5b89107b183f1cb7981
---
# Error Handling for Session Expiration

When you sign on via the login() call, a new client session begins and a corresponding unique session ID is generated. Sessions automatically expire after the amount of time specified in the **Security Controls** setup area of the Salesforce application (default two hours). When your session expires, the exception code INVALID\_SESSION\_ID is returned. If this happens, you must invoke the login() call again. For more information about login(), see the [SOAP API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/ "HTML (New Window)").