--- title: Authenticated Account API description: >- The Authenticated Account API provides read-only access to the signed-in customer's ID and B2B purchasing company details. Use this API to identify the current customer, determine whether they're a B2B buyer, and personalize your extension based on their account context. api_version: 2025-07 api_name: customer-account-ui-extensions source_url: html: >- https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/target-apis/account-apis/authenticated-account-api md: >- https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/target-apis/account-apis/authenticated-account-api.md --- Migrate to Polaris Version 2025-07 is the last API version to support React-based UI components. Later versions use [web components](https://shopify.dev/docs/api/customer-account-ui-extensions/latest/polaris-web-components), native UI elements with built-in accessibility, better performance, and consistent styling with [Shopify's design system](https://shopify.dev/docs/apps/design). Check out the [migration guide](https://shopify.dev/docs/apps/build/customer-accounts/migrate-to-web-components) to upgrade your extension. # Authenticated Account API The Authenticated Account API provides read-only access to the signed-in customer's ID and B2B purchasing company details. Use this API to identify the current customer, determine whether they're a B2B buyer, and personalize your extension based on their account context. For more detailed customer data such as email, name, or phone, use the [Customer Account API](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/target-apis/account-apis/customer-account-api) to query for additional details. ### Use cases * **Personalize the experience**: Display a personalized greeting or tailored content based on the authenticated customer's identity. * **Detect B2B customers**: Determine if the buyer is a B2B customer and show company-specific UI. * **Gate features by authentication**: Only render certain features when the customer is signed in. ### Support Targets (25) ### Supported targets * Customer​Account::Kitchen​Sink * [customer-account.​footer.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/footer#footer-render-after-) * [customer-account.​order-index.​announcement.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-index#order-index-targets) * [customer-account.​order-index.​block.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-index#order-index-block-) * [customer-account.​order-status.​announcement.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-status#order-status-announcement-) * [customer-account.​order-status.​block.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-status#order-status-block-) * [customer-account.​order-status.​cart-line-item.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-status#cart-line-item-render-after-) * [customer-account.​order-status.​cart-line-list.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-status#cart-line-list-render-after-) * [customer-account.​order-status.​customer-information.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-status#customer-information-render-after-) * [customer-account.​order-status.​fulfillment-details.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/fulfillment-status#fulfillment-status-targets) * [customer-account.​order-status.​payment-details.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/payments-and-returns#payments-and-returns-targets) * [customer-account.​order-status.​return-details.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/payments-and-returns#return-details-render-after-) * [customer-account.​order-status.​unfulfilled-items.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/fulfillment-status#unfulfilled-items-render-after-) * [customer-account.​order.​action.​menu-item.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-actions#order-action-menu-item-) * [customer-account.​order.​action.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/order-actions#order-action-) * [customer-account.​order.​page.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/full-page#order-specific-full-page-) * [customer-account.​page.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/full-page#customer-account-full-page-) * [customer-account.​profile.​addresses.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-default#profile-page-default-targets-) * [customer-account.​profile.​announcement.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-default#announcement-) * [customer-account.​profile.​block.​render](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-default#profile-block-) * [customer-account.​profile.​company-details.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-b2b#profile-page-b2b-targets-) * [customer-account.​profile.​company-location-addresses.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-b2b#company-location-addresses-render-after-) * [customer-account.​profile.​company-location-payment.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-b2b#company-location-payment-render-after-) * [customer-account.​profile.​company-location-staff.​render-after](https://shopify.dev/docs/api/customer-account-ui-extensions/2025-07/targets/profile-page-b2b#company-location-staff-render-after-) * customer-account.​profile.​payment.​render-after ### Properties The Authenticated Account API object provides the authenticated customer's account information. Access the following properties on the API object to read account data. * **authenticatedAccount** **AuthenticatedAccount** **required** The authenticated customer's account information, including their customer ID and B2B company details. ### AuthenticatedAccount * customer The authenticated customer's account information, including their globally-unique ID. ```ts StatefulRemoteSubscribable ``` * purchasingCompany The B2B company information for the authenticated business customer. The value is \`undefined\` if the customer isn't authenticated or isn't a B2B customer. ```ts StatefulRemoteSubscribable ``` ### Customer The authenticated customer's account information. {% include /apps/checkout/privacy-icon.md %} Requires access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). * id A globally-unique identifier for the customer. ```ts string ``` ### PurchasingCompany * company The company that the authenticated B2B customer belongs to. ```ts Company ``` * location The company location that the authenticated B2B customer is purchasing for. ```ts CompanyLocation ``` ### Company * id A globally-unique identifier for the company. ```ts string ``` ### CompanyLocation * id A globally-unique identifier for the company location. ```ts string ``` Examples ### Examples * #### ##### Description Read the authenticated customer's ID and display it. This example uses \`useAuthenticatedAccountCustomer\` and handles the case where the customer isn't authenticated. ##### React ```tsx import { reactExtension, useAuthenticatedAccountCustomer, } from '@shopify/ui-extensions-react/customer-account'; import {Text} from '@shopify/ui-extensions/customer-account'; export default reactExtension( 'customer-account.order-status.block.render', () => , ); function Extension() { const customer = useAuthenticatedAccountCustomer(); if (!customer) return Not authenticated; return Customer ID: {customer.id}; } ``` ##### TS ```ts import {extension, Text} from '@shopify/ui-extensions/customer-account'; export default extension( 'customer-account.order-status.block.render', (root, api) => { const customer = api.authenticatedAccount.customer.current; if (!customer) { root.appendChild(root.createComponent(Text, {appearance: 'subdued'}, 'Not authenticated')); return; } root.appendChild(root.createComponent(Text, {}, `Customer ID: ${customer.id}`)); }, ); ``` * #### ##### Description Read the B2B company and location and display the details. This example uses \`useAuthenticatedAccountPurchasingCompany\` and only renders when B2B data is available. ##### React ```tsx import { reactExtension, useAuthenticatedAccountCustomer, useAuthenticatedAccountPurchasingCompany, } from '@shopify/ui-extensions-react/customer-account'; import {Banner, BlockStack, Text} from '@shopify/ui-extensions/customer-account'; export default reactExtension( 'customer-account.order-status.block.render', () => , ); function Extension() { const customer = useAuthenticatedAccountCustomer(); const company = useAuthenticatedAccountPurchasingCompany(); if (!customer) return null; if (!company) return Customer: {customer.id}; return ( {company.company.id} {company.location && Location: {company.location.id}} ); } ``` ##### TS ```ts import {extension, Banner, BlockStack, Text} from '@shopify/ui-extensions/customer-account'; export default extension( 'customer-account.order-status.block.render', (root, api) => { const customer = api.authenticatedAccount.customer.current; const company = api.authenticatedAccount.purchasingCompany.current; if (!customer) return; if (!company) { root.appendChild(root.createComponent(Text, {}, `Customer: ${customer.id}`)); return; } const banner = root.createComponent(Banner, {status: 'info'}); const stack = root.createComponent(BlockStack, {}); stack.appendChild(root.createComponent(Text, {emphasis: 'bold'}, company.company.id)); if (company.location) { stack.appendChild(root.createComponent(Text, {}, `Location: ${company.location.id}`)); } banner.appendChild(stack); root.appendChild(banner); }, ); ``` * #### ##### Description Read the authenticated customer's ID and uses it to personalize a loyalty banner. This example uses \`useAuthenticatedAccountCustomer\` to conditionally show a loyalty message. ##### React ```tsx import { reactExtension, useAuthenticatedAccountCustomer, useCustomer, useI18n, } from '@shopify/ui-extensions-react/customer-account'; import {Banner, Link} from '@shopify/ui-extensions/customer-account'; export default reactExtension( 'customer-account.order-status.block.render', () => , ); function Extension() { const i18n = useI18n(); const authenticatedCustomer = useAuthenticatedAccountCustomer(); const orderStatusCustomer = useCustomer(); if ( authenticatedCustomer?.id && orderStatusCustomer?.id?.endsWith(authenticatedCustomer?.id) ) { return ( {i18n.translate('manageLoyaltyPoints')} ); } return null; } ``` ##### TS ```ts import {extension, Banner, Link} from '@shopify/ui-extensions/customer-account'; export default extension( 'customer-account.order-status.block.render', (root, api) => { const authenticatedCustomer = api.authenticatedAccount.customer.current; const orderStatusCustomer = api.buyerIdentity?.customer.current; if ( authenticatedCustomer?.id && orderStatusCustomer?.id?.endsWith(authenticatedCustomer?.id) ) { const banner = root.createComponent(Banner, {}); banner.appendChild( root.createComponent(Link, {to: 'extension:manageLoyaltyPoints/'}, api.i18n.translate('manageLoyaltyPoints')), ); root.appendChild(banner); } }, ); ``` *** ## Best practices * **Handle undefined customer**: The `customer` property is `undefined` when the buyer isn't authenticated. Always check before accessing customer fields. * **Use purchasing company for B2B logic**: The `purchasingCompany` provides the company and location for B2B customers. Use it to implement location-specific pricing or catalog restrictions. ***