# Session API The Session API contains the information about the current user session, and allows to fetch a fresh session token for communication with your apps backend service. ## SessionApi ### SessionApiContent ### currentSession value: `Session` Access information on the current POS session. ### getSessionToken value: `() => Promise<string>` Get a fresh session token for communication with your app's backend service. Calls to Shopify APIs must be made by your app’s backend service. ### Session ### currency value: `CurrencyCode` The currency code associated with the location currently in on POS. ### locationId value: `number` The location ID associated with the POS' current location. ### shopDomain value: `string` The shop domain associated with the shop currently logged into POS. ### shopId value: `number` The shop ID associated with the shop currently logged into POS. ### staffMemberId value: `number` The staff ID who is currently pinned into the POS. Note that this staff member ID may be different to the User ID, as the staff member who enters their PIN may be different to the User who logged onto POS. ### userId value: `number` The user ID associated with the Shopify account currently authenticated on POS. ## Examples The Session API contains the information about the current user session, and allows to fetch a fresh session token for communication with your apps backend service. ```tsx import React, {useState} from 'react'; import { reactExtension, useApi, Screen, Text, } from '@shopify/ui-extensions-react/point-of-sale'; const SmartGridModal = () => { const {currentSession, getSessionToken} = useApi<'pos.home.modal.render'>().session; const {shopId, userId, locationId, staffMemberId} = currentSession; const [sessionToken, setSessionToken] = useState<string>(); getSessionToken().then((newToken) => { setSessionToken(newToken); }); return ( <Screen name="ScreenOne" title="Screen One Title"> <Text> shopId: {shopId}, userId: {userId}, locationId: {locationId}, staffId: {staffMemberId} </Text> <Text>sessionToken: {sessionToken}</Text> </Screen> ); }; export default reactExtension('pos.home.modal.render', () => ( <SmartGridModal /> )); ``` ```ts import { Screen, Stack, Text, extension, } from '@shopify/ui-extensions/point-of-sale'; export default extension('pos.home.modal.render', (root, api) => { const {session} = api; const {currentSession, getSessionToken} = session; const {shopId, userId, locationId, staffMemberId} = currentSession; const screen = root.createComponent(Screen, { name: 'ScreenOne', title: 'Screen One Title', }); const currentSessionText = root.createComponent( Text, {}, `shopId: ${shopId}, userId: ${userId}, locationId: ${locationId}, staffId: ${staffMemberId}`, ); const sessionTokenText = root.createComponent( Text, {}, 'sessionToken: undefined', ); getSessionToken().then((newToken) => { sessionTokenText.children.forEach((child) => { sessionTokenText.removeChild(child); }); sessionTokenText.appendChild(`sessionToken: ${newToken}`); }); screen.appendChild(currentSessionText); screen.appendChild(sessionTokenText); root.appendChild(screen); }); ```