--- title: Customer API description: >- The Customer API provides read-only access to customer data. Use this API to get customer information and build personalized experiences based on the selected customer context. The API offers the customer identifier for linking to customer data and enabling customer-specific features. api_version: 2025-04 api_name: pos-ui-extensions source_url: html: >- https://shopify.dev/docs/api/pos-ui-extensions/2025-04/target-apis/contextual-apis/customer-api md: >- https://shopify.dev/docs/api/pos-ui-extensions/2025-04/target-apis/contextual-apis/customer-api.md --- # Customer API The Customer API provides read-only access to customer data. Use this API to get customer information and build personalized experiences based on the selected customer context. The API offers the customer identifier for linking to customer data and enabling customer-specific features. #### Use cases * **Customer access:** Access the customer identifier to implement customer-specific functionality. * **Customer extensions:** Build extensions displaying customer information or loyalty program details. * **Contextual UI:** Create contextual interfaces adapting based on current customer context. * **External integrations:** Link customer data with external CRM (Customer Relationship Management) platforms or third-party integrations. Support Targets (3) ### Supported targets * [pos.​customer-details.​action.​menu-item.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-04/targets/customer-details#customer-details-action-menu-item-) * [pos.​customer-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-04/targets/customer-details#customer-details-action-modal-) * [pos.​customer-details.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-04/targets/customer-details#customer-details-block-) ## CustomerApi The `CustomerApi` object provides access to customer data. Access this property through `api.customer` to interact with the current customer context. * id number required The unique identifier for the customer. Use for customer lookups, applying customer-specific pricing, enabling personalized features, and integrating with external systems. Examples ### Examples * #### Get the current customer ID ##### Description Retrieve the unique identifier of the customer currently associated with the extension's context. This example shows how to access the customer ID from customer details screens, enabling you to fetch additional customer data, track customer-specific actions, or link to external systems. ##### React ```tsx import React from 'react'; import { Text, Screen, ScrollView, Navigator, reactExtension, useApi, } from '@shopify/ui-extensions-react/point-of-sale'; const Modal = () => { const api = useApi<'pos.customer-details.action.render'>(); return ( {`Customer ID: ${api.customer.id}`} ); }; export default reactExtension('pos.customer-details.action.render', () => ( )); ``` ##### TS ```ts import { Navigator, Screen, ScrollView, Text, extension, } from '@shopify/ui-extensions/point-of-sale'; export default extension('pos.customer-details.action.render', (root, api) => { const navigator = root.createComponent(Navigator); const screen = root.createComponent(Screen, { name: 'CustomerApi', title: 'Customer Api', }); const scrollView = root.createComponent(ScrollView); const text = root.createComponent(Text); text.append(`Customer ID: ${api.customer.id}`); scrollView.append(text); screen.append(scrollView); navigator.append(screen); root.append(navigator); }); ``` ## Best practices * **Implement customer-specific features:** Use the customer context to enable personalized functionality like customer-specific pricing, loyalty program integration, or customized product recommendations. * **Validate customer access:** Verify that the customer ID is valid before performing customer-specific operations or external API calls. ## Limitations * The API provides only the customer identifier—use Shopify APIs or external systems to fetch additional customer details like name, email, or purchase history. * Customer data reflects the current POS session and may not include real-time updates from other channels until the session is refreshed.