Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

Session API

The Session API provides access to current POS session information and secure authentication tokens, allowing you to retrieve shop details, user information, location data, and generate tokens for secure backend communication. The API includes both static session data and dynamic token generation for authenticated API calls.

  • Authentication: Authenticate API calls to your app's backend using secure session tokens.
  • Shop context: Customize extension behavior based on shop domain or location settings.
  • Location features: Implement location-specific features like tax calculations or inventory checks.
  • User tracking: Track user activity and staff member interactions for analytics.
Support
Targets (25)

The Session API object provides access to current POS session information and secure authentication tokens. Access the following properties on the API object to retrieve shop details, user information, location data, and generate tokens for secure backend communication.

Anchor to currentSession
currentSession
required

Provides comprehensive information about the current POS session including shop details, user authentication, location data, staff member information, currency settings, and POS version. This data is static for the duration of the session and updates when users switch locations or staff members change.

Anchor to getSessionToken
getSessionToken
() => Promise<string>
required

Generates a fresh session token for secure communication with your app's backend service. Returns undefined when the authenticated user lacks proper app permissions. The token is a Shopify OpenID Connect ID Token that should be used in Authorization headers for backend API calls. This is based on the authenticated user, not the pinned staff member.


  • Use appropriate identifiers: Distinguish between userId (authenticated account) and staffMemberId (pinned staff member) to implement correct permissions and personalization logic.
  • Implement location-aware features: Use locationId and currency information.
  • Secure backend communication: Use session tokens exclusively for backend API calls and never expose them in client-side logs or storage. validate tokens on your backend before processing requests.

  • Session tokens are only available when the authenticated user has proper app permissions enabled. Staff members who are pinned in but not authenticated can't generate tokens.
  • Session data is read-only and can't be modified through the API. Changes to shop settings, locations, or staff assignments require POS application updates.
  • Session tokens should only be used for communication with your app's configured backend service and can't be used for direct Shopify API calls from the client side.

Was this page helpful?