---
schema_version: "1"
id: 44bc19f0a4b0f4c1018ee0555a24a2ea9f9edb953621fcbe782dabf53573e1c1
title: GETSESSIONID
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_getsessionid.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_getsessionid.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: a0c8959a79b49838443074a5e43ca11f4ac0c115d4dcd3dfe475d85ebfe0e2b8
description: Returns the user’s session ID.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# GETSESSIONID

Returns the user’s session ID.

## Use

`GETSESSIONID()`

## Tips

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_important.png)

Important `$Api.Session_ID` and `GETSESSIONID()` return the same value, an identifier for the current session in the current context. This context varies depending on where the global variable or function is evaluated. For example, if you use either in a custom formula field, and that field is displayed on a standard page layout in Salesforce Classic, the referenced session is a basic Salesforce session. That same field (or the underlying variable or formula result), when used in a Visualforce page, references a Visualforce session instead.

Session contexts are based on the domain of the request. That is, the session context changes whenever you cross a hostname boundary, such as from .salesforce.com to .vf.force.com or .lightning.force.com.

Session identifiers from different contexts, and the sessions themselves, are different. When you transition between contexts, the old session is replaced by the new one, and the old session is no longer valid. The session ID also changes at this time.

Normally Salesforce transparently handles session hand-off between contexts, but if you’re passing the session ID around yourself, you must reaccess `$Api.Session_ID` or `GETSESSIONID()` from the new context to ensure a valid session ID.

Not all sessions are created equal. In particular, sessions obtained in a Lightning Experience context have reduced privileges, and don't have API access. You can't use these session IDs to make API calls. `{!$Api.Session_ID}` isn’t generated for guest users.

If you use a JWT-based access token for session authentication, you can’t use `$Api.Session_ID` or `GETSESSIONID()`. To use `$Api.Session_ID` or `GETSESSIONID()`, use an opaque access token instead. Make sure that the “Issue JSON Web Token (JWT)-based access tokens for named users” setting isn’t selected for your external client app or connected app.

![Link Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Link Example

```
HYPERLINK
("https://www.myintegration.com?sId="&
GETSESSIONID() & "?&rowID="&Name & "action=CreateTask","Create
a Meeting Request")
```

creates a link to an application outside of Salesforce, passing the parameters so that it can connect to Salesforce via the API and create the necessary event.