---
title: customer - Storefront API
description: >
  Retrieves the [`Customer`](/docs/api/storefront/2025-07/objects/Customer)
  associated with the provided access token. Use the
  [`customerAccessTokenCreate`](/docs/api/storefront/2025-07/mutations/customerAccessTokenCreate)
  mutation to obtain an access token using legacy customer account
  authentication (email and password).


  The returned customer includes data such as contact information,
  [addresses](/docs/api/storefront/2025-07/objects/MailingAddress),
  [orders](/docs/api/storefront/2025-07/objects/Order), and [custom
  data](https://shopify.dev/docs/apps/build/custom-data) associated with the
  customer.
api_version: 2025-07
api_name: storefront
type: query
api_type: graphql
source_url:
  html: 'https://shopify.dev/docs/api/storefront/2025-07/queries/customer'
  md: 'https://shopify.dev/docs/api/storefront/2025-07/queries/customer.md'
---

# customer

query

Retrieves the [`Customer`](https://shopify.dev/docs/api/storefront/2025-07/objects/Customer) associated with the provided access token. Use the [`customerAccessTokenCreate`](https://shopify.dev/docs/api/storefront/2025-07/mutations/customerAccessTokenCreate) mutation to obtain an access token using legacy customer account authentication (email and password).

The returned customer includes data such as contact information, [addresses](https://shopify.dev/docs/api/storefront/2025-07/objects/MailingAddress), [orders](https://shopify.dev/docs/api/storefront/2025-07/objects/Order), and [custom data](https://shopify.dev/docs/apps/build/custom-data) associated with the customer.

## Arguments

* customer​Access​Token

  [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

  required

  The customer access token.

***

## Possible returns

* Customer

  [Customer](https://shopify.dev/docs/api/storefront/2025-07/objects/Customer)

  A customer account with the shop. Includes data such as contact information, [addresses](https://shopify.dev/docs/api/storefront/2025-07/objects/MailingAddress) and marketing preferences for logged-in customers, so they don't have to provide these details at every checkout.

  Access the customer through the [`customer`](https://shopify.dev/docs/api/storefront/2025-07/queries/customer) query using a customer access token obtained from the [`customerAccessTokenCreate`](https://shopify.dev/docs/api/storefront/2025-07/mutations/customerAccessTokenCreate) mutation.

  The object implements the [`HasMetafields`](https://shopify.dev/docs/api/storefront/2025-07/interfaces/HasMetafields) interface, enabling retrieval of [custom data](https://shopify.dev/docs/apps/build/custom-data) associated with the customer.

  * accepts​Marketing

    [Boolean!](https://shopify.dev/docs/api/storefront/2025-07/scalars/Boolean)

    non-null Token access required

    Indicates whether the customer has consented to be sent marketing material via email.

  * addresses

    [Mailing​Address​Connection!](https://shopify.dev/docs/api/storefront/2025-07/connections/MailingAddressConnection)

    non-null Token access required

    A list of addresses for the customer.

    * first

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      ### Arguments

      Returns up to the first `n` elements from the list.

    * after

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Returns the elements that come after the specified cursor.

    * last

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      Returns up to the last `n` elements from the list.

    * before

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Returns the elements that come before the specified cursor.

    * reverse

      [Boolean](https://shopify.dev/docs/api/storefront/2025-07/scalars/Boolean)

      Default:false

      Reverse the order of the underlying list.

    ***

  * created​At

    [Date​Time!](https://shopify.dev/docs/api/storefront/2025-07/scalars/DateTime)

    non-null Token access required

    The date and time when the customer was created.

  * default​Address

    [Mailing​Address](https://shopify.dev/docs/api/storefront/2025-07/objects/MailingAddress)

    Token access required

    The customer’s default address.

  * display​Name

    [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    non-null Token access required

    The customer’s name, email or phone number.

  * email

    [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    Token access required

    The customer’s email address.

  * first​Name

    [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    Token access required

    The customer’s first name.

  * id

    [ID!](https://shopify.dev/docs/api/storefront/2025-07/scalars/ID)

    non-null Token access required

    A unique ID for the customer.

  * last​Name

    [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    Token access required

    The customer’s last name.

  * metafield

    [Metafield](https://shopify.dev/docs/api/storefront/2025-07/objects/Metafield)

    Token access required

    A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information.

    * namespace

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      ### Arguments

      The container the metafield belongs to. If omitted, the app-reserved namespace will be used.

    * key

      [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      required

      The identifier for the metafield.

    ***

  * metafields

    [\[Metafield\]!](https://shopify.dev/docs/api/storefront/2025-07/objects/Metafield)

    non-null Token access required

    A list of [custom fields](https://shopify.dev/docs/apps/build/custom-data) that a merchant associates with a Shopify resource.

    * identifiers

      [\[Has​Metafields​Identifier!\]!](https://shopify.dev/docs/api/storefront/2025-07/input-objects/HasMetafieldsIdentifier)

      required

      ### Arguments

      The list of metafields to retrieve by namespace and key.

      The input must not contain more than `250` values.

    ***

  * number​Of​Orders

    [Unsigned​Int64!](https://shopify.dev/docs/api/storefront/2025-07/scalars/UnsignedInt64)

    non-null Token access required

    The number of orders that the customer has made at the store in their lifetime.

  * orders

    [Order​Connection!](https://shopify.dev/docs/api/storefront/2025-07/connections/OrderConnection)

    non-null Token access required

    The orders associated with the customer.

    * first

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      ### Arguments

      Returns up to the first `n` elements from the list.

    * after

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Returns the elements that come after the specified cursor.

    * last

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      Returns up to the last `n` elements from the list.

    * before

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Returns the elements that come before the specified cursor.

    * reverse

      [Boolean](https://shopify.dev/docs/api/storefront/2025-07/scalars/Boolean)

      Default:false

      Reverse the order of the underlying list.

    * sort​Key

      [Order​Sort​Keys](https://shopify.dev/docs/api/storefront/2025-07/enums/OrderSortKeys)

      Default:ID

      Sort the underlying list by the given key.

    * query

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Apply one or multiple filters to the query. Refer to the detailed [search syntax](https://shopify.dev/api/usage/search-syntax) for more information about using filters.

      * processed\_at

    ***

  * phone

    [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    Token access required

    The customer’s phone number.

  * tags

    [\[String!\]!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    non-null Token access required

    A comma separated list of tags that have been added to the customer. Additional access scope required: unauthenticated\_read\_customer\_tags.

  * updated​At

    [Date​Time!](https://shopify.dev/docs/api/storefront/2025-07/scalars/DateTime)

    non-null Token access required

    The date and time when the customer information was updated.

***

## Examples

* ### Get a customer by access token

  #### Description

  The following query retrieves the customer with the associated access token. It returns the customer fields specified in the query.

  #### Query

  ```graphql
  query {
    customer(customerAccessToken: "bobs_token") {
      id
      firstName
      lastName
      acceptsMarketing
      email
      phone
    }
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/api/2025-07/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \
  -d '{
  "query": "query { customer(customerAccessToken: \"bobs_token\") { id firstName lastName acceptsMarketing email phone } }"
  }'
  ```

  #### React Router

  ```javascript
  import { unauthenticated } from "../shopify.server";

  export const loader = async () => {
    const { storefront } = await unauthenticated.storefront(
      'your-development-store.myshopify.com'
    );
    const response = await storefront.graphql(
      `#graphql
    query {
      customer(customerAccessToken: "bobs_token") {
        id
        firstName
        lastName
        acceptsMarketing
        email
        phone
      }
    }`,
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Storefront({
    domain: 'your-development-store.myshopify.com',
    storefrontAccessToken,
  });
  const data = await client.query({
    data: `query {
      customer(customerAccessToken: "bobs_token") {
        id
        firstName
        lastName
        acceptsMarketing
        email
        phone
      }
    }`,
  });
  ```

  #### Response

  ```json
  {
    "customer": {
      "id": "gid://shopify/Customer/410535040",
      "firstName": "John",
      "lastName": "Smith",
      "acceptsMarketing": false,
      "email": "johnsmith@example.com",
      "phone": "+16134504533"
    }
  }
  ```
