User API
The User API retrieves information about the currently logged-in user, such as their name, email, and account access level. The response shape depends on the platform: admin users and POS users return different sets of properties.
Anchor to Use casesUse cases
- User personalization: Personalize the app experience based on the logged-in user's name and role.
- Staff identification: Identify which staff member is using the app for audit logging or permissions.
- POS user context: Access POS-specific user data like assigned location when running on Shopify POS.
- Account details: Retrieve the current user's email and account type for display or communication.
Anchor to AdminUserAPIAdmin User API()
When the user is logged into the Shopify admin, shopify.user() returns the user's account access level.
AdminUser
- accountAccess
The account access level of the logged-in user.
string
Anchor to POSUserAPIPOSUser API()
When the user is logged into Shopify POS, shopify.user() returns the user's ID, first and last name, email, account access level, and account type.
Anchor to POSUserAPI-returnsReturns
POSUser
- accountAccess
The account access level of the logged-in user.
string - accountType
The user's account type.
string - email
The user's email address.
string - firstName
The user's first name.
string - id
The staff member's numeric ID.
number - lastName
The user's last name.
string
js
Examples
Description
Retrieve information about the current user. The properties available in the response depend on whether the user is logged into the Shopify admin or Shopify POS.
js
const user = await shopify.user(); console.log(user.accountAccess); // => 'full'Description
On Shopify POS, the user object includes additional properties such as `firstName`, `lastName`, and `accountType` that are not available on the admin.
js
const user = await shopify.user(); console.log(user.id); // => 12345 console.log(user.firstName); // => 'Jane' console.log(user.lastName); // => 'Doe' console.log(user.email); // => 'jane@example.com' console.log(user.accountAccess); // => 'full' console.log(user.accountType); // => 'regular'