# Customer - admin - OBJECT
Version: unstable

## Description
Represents information about a customer of the shop, such as the customer's contact details, their order
history, and whether they've agreed to receive marketing material by email.

**Caution:** Only use this data if it's required for your app's functionality. Shopify will restrict [access to scopes](https://shopify.dev/api/usage/access-scopes) for apps that don't have a legitimate use for the associated data.

### Access Scopes
`read_customers` access scope.


## Fields
* [addresses](/docs/api/admin/unstable/objects/MailingAddress): MailingAddress! - A list of addresses associated with the customer.
* [amountSpent](/docs/api/admin/unstable/objects/MoneyV2): MoneyV2! - The total amount that the customer has spent on orders in their lifetime.
* [canDelete](/docs/api/admin/unstable/scalars/Boolean): Boolean! - Whether the merchant can delete the customer from their store.

A customer can be deleted from a store only if they haven't yet made an order. After a customer makes an
order, they can't be deleted from a store.
* [companyContactProfiles](/docs/api/admin/unstable/objects/CompanyContact): CompanyContact! - A list of the customer's company contact profiles.
* [createdAt](/docs/api/admin/unstable/scalars/DateTime): DateTime! - The date and time when the customer was added to the store.
* [dataSaleOptOut](/docs/api/admin/unstable/scalars/Boolean): Boolean! - Whether the customer has opted out of having their data sold.
* [defaultAddress](/docs/api/admin/unstable/objects/MailingAddress): MailingAddress - The default address associated with the customer.
* [defaultEmailAddress](/docs/api/admin/unstable/objects/CustomerEmailAddress): CustomerEmailAddress - The customer's default email address.
* [displayName](/docs/api/admin/unstable/scalars/String): String! - The full name of the customer, based on the values for first_name and last_name. If the first_name and
last_name are not available, then this falls back to the customer's email address, and if that is not available, the customer's phone number.
* [email](/docs/api/admin/unstable/scalars/String): String - The customer's email address.
* [emailMarketingConsent](/docs/api/admin/unstable/objects/CustomerEmailMarketingConsentState): CustomerEmailMarketingConsentState - The current email marketing state for the customer.
If the customer doesn't have an email address, then this property is `null`.
* [firstName](/docs/api/admin/unstable/scalars/String): String - The customer's first name.
* [hasTimelineComment](/docs/api/admin/unstable/scalars/Boolean): Boolean! - Whether the merchant has added timeline comments about the customer on the customer's page.
* [id](/docs/api/admin/unstable/scalars/ID): ID! - A globally-unique ID.
* [image](/docs/api/admin/unstable/objects/Image): Image! - The image associated with the customer.
* [lastName](/docs/api/admin/unstable/scalars/String): String - The customer's last name.
* [lastOrder](/docs/api/admin/unstable/objects/Order): Order - The customer's last order.
* [legacyResourceId](/docs/api/admin/unstable/scalars/UnsignedInt64): UnsignedInt64! - The ID of the corresponding resource in the REST Admin API.
* [lifetimeDuration](/docs/api/admin/unstable/scalars/String): String! - The amount of time since the customer was first added to the store.

Example: 'about 12 years'.
* [locale](/docs/api/admin/unstable/scalars/String): String! - The customer's locale.
* [market](/docs/api/admin/unstable/objects/Market): Market - The market that includes the customer’s default address.
* [mergeable](/docs/api/admin/unstable/objects/CustomerMergeable): CustomerMergeable! - Whether the customer can be merged with another customer.
* [metafield](/docs/api/admin/unstable/objects/Metafield): Metafield - 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.
* [metafieldsByIdentifiers](/docs/api/admin/unstable/objects/Metafield): Metafield! - The metafields associated with the resource matching the supplied list of namespaces and keys.
* [multipassIdentifier](/docs/api/admin/unstable/scalars/String): String - A unique identifier for the customer that's used with Multipass login.
* [note](/docs/api/admin/unstable/scalars/String): String - A note about the customer.
* [numberOfOrders](/docs/api/admin/unstable/scalars/UnsignedInt64): UnsignedInt64! - The number of orders that the customer has made at the store in their lifetime.
* [phone](/docs/api/admin/unstable/scalars/String): String - The customer's phone number.
* [productSubscriberStatus](/docs/api/admin/unstable/enums/CustomerProductSubscriberStatus): CustomerProductSubscriberStatus! - Possible subscriber states of a customer defined by their subscription contracts.
* [smsMarketingConsent](/docs/api/admin/unstable/objects/CustomerSmsMarketingConsentState): CustomerSmsMarketingConsentState - The current SMS marketing state for the customer's phone number.

If the customer does not have a phone number, then this property is `null`.
* [state](/docs/api/admin/unstable/enums/CustomerState): CustomerState! - The state of the customer's account with the shop.

Please note that this only meaningful when Classic Customer Accounts is active.
* [statistics](/docs/api/admin/unstable/objects/CustomerStatistics): CustomerStatistics! - The statistics for a given customer.
* [tags](/docs/api/admin/unstable/scalars/String): String! - A comma separated list of tags that have been added to the customer.
* [taxExempt](/docs/api/admin/unstable/scalars/Boolean): Boolean! - Whether the customer is exempt from being charged taxes on their orders.
* [taxExemptions](/docs/api/admin/unstable/enums/TaxExemption): TaxExemption! - The list of tax exemptions applied to the customer.
* [unsubscribeUrl](/docs/api/admin/unstable/scalars/URL): URL! - The URL to unsubscribe the customer from the mailing list.
* [updatedAt](/docs/api/admin/unstable/scalars/DateTime): DateTime! - The date and time when the customer was last updated.
* [validEmailAddress](/docs/api/admin/unstable/scalars/Boolean): Boolean! - Whether the email address is formatted correctly.

Returns `true` when the email is formatted correctly and
belongs to an existing domain. This doesn't guarantee that
the email address actually exists.
* [verifiedEmail](/docs/api/admin/unstable/scalars/Boolean): Boolean! - Whether the customer has verified their email address. Defaults to `true` if the customer is created through the Shopify admin or API.

## Connections
* [addressesV2](/docs/api/admin/unstable/connections/MailingAddressConnection): MailingAddressConnection!
* [events](/docs/api/admin/unstable/connections/EventConnection): EventConnection!
* [metafieldDefinitions](/docs/api/admin/unstable/connections/MetafieldDefinitionConnection): MetafieldDefinitionConnection!
* [metafields](/docs/api/admin/unstable/connections/MetafieldConnection): MetafieldConnection!
* [orders](/docs/api/admin/unstable/connections/OrderConnection): OrderConnection!
* [paymentMethods](/docs/api/admin/unstable/connections/CustomerPaymentMethodConnection): CustomerPaymentMethodConnection!
* [storeCreditAccounts](/docs/api/admin/unstable/connections/StoreCreditAccountConnection): StoreCreditAccountConnection!
* [subscriptionContracts](/docs/api/admin/unstable/connections/SubscriptionContractConnection): SubscriptionContractConnection!



## Related queries
* [customer](/docs/api/admin/unstable/queries/customer) Returns a Customer resource by ID.
* [customerByIdentifier](/docs/api/admin/unstable/queries/customerByIdentifier) Return a customer by an identifier.
* [customers](/docs/api/admin/unstable/queries/customers) Returns a list of customers.

## Related mutations
* [customerAddTaxExemptions](/docs/api/admin/unstable/mutations/customerAddTaxExemptions) Add tax exemptions for the customer.
* [customerCreate](/docs/api/admin/unstable/mutations/customerCreate) Create a new customer. As of API version 2022-10, apps using protected customer data must meet the protected customer data [requirements](https://shopify.dev/apps/store/data-protection/protected-customer-data).
* [customerEmailMarketingConsentUpdate](/docs/api/admin/unstable/mutations/customerEmailMarketingConsentUpdate) Update a customer's email marketing information information.
* [customerPaymentMethodSendUpdateEmail](/docs/api/admin/unstable/mutations/customerPaymentMethodSendUpdateEmail) Sends a link to the customer so they can update a specific payment method.
* [customerRemoveTaxExemptions](/docs/api/admin/unstable/mutations/customerRemoveTaxExemptions) Remove tax exemptions from a customer.
* [customerReplaceTaxExemptions](/docs/api/admin/unstable/mutations/customerReplaceTaxExemptions) Replace tax exemptions for a customer.
* [customerSendAccountInviteEmail](/docs/api/admin/unstable/mutations/customerSendAccountInviteEmail) Sends the customer an account invite email.
* [customerSet](/docs/api/admin/unstable/mutations/customerSet) Creates or updates a customer in a single mutation.

Use this mutation when syncing information from an external data source into Shopify.

This mutation can be used to create a new customer, update an existing customer by id, or
upsert a customer by a unique key (email or phone).

To create a new customer omit the `identifier` argument.
To update an existing customer, include the `identifier` with the id of the customer to update.

To perform an 'upsert' by unique key (email or phone)
use the `identifier` argument to upsert a customer by a unique key (email or phone). If a customer
with the specified unique key exists, it will be updated. If not, a new customer will be created with
that unique key.

As of API version 2022-10, apps using protected customer data must meet the
protected customer data [requirements](https://shopify.dev/apps/store/data-protection/protected-customer-data)

Any list field (e.g.
[addresses](https://shopify.dev/api/admin-graphql/unstable/input-objects/MailingAddressInput),
will be updated so that all included entries are either created or updated, and all existing entries not
included will be deleted.

All other fields will be updated to the value passed. Omitted fields will not be updated.
* [customerSmsMarketingConsentUpdate](/docs/api/admin/unstable/mutations/customerSmsMarketingConsentUpdate) Update a customer's SMS marketing consent information.
* [customerUpdateDefaultAddress](/docs/api/admin/unstable/mutations/customerUpdateDefaultAddress) Updates a customer's default address.
* [customerUpdate](/docs/api/admin/unstable/mutations/customerUpdate) Update a customer's attributes. As of API version 2022-10, apps using protected customer data must meet the protected customer data [requirements](https://shopify.dev/apps/store/data-protection/protected-customer-data).

## Related Unions
* [CommentEventEmbed](/docs/api/admin/unstable/unions/CommentEventEmbed) The main embed of a comment event.
* [MetafieldReference](/docs/api/admin/unstable/unions/MetafieldReference) The resource referenced by the metafield value.
* [MetafieldReferencer](/docs/api/admin/unstable/unions/MetafieldReferencer) Types of resources that may use metafields to reference other resources.
* [PurchasingEntity](/docs/api/admin/unstable/unions/PurchasingEntity) Represents information about the purchasing entity for the order or draft order.

## Examples
### Get a customer by ID
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customer(id: \\\"gid://shopify/Customer/544365967\\\") { id firstName lastName email phone numberOfOrders amountSpent { amount currencyCode } createdAt updatedAt note verifiedEmail validEmailAddress tags lifetimeDuration defaultAddress { formattedArea address1 } addresses { address1 } image { src } canDelete } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      id\n      firstName\n      lastName\n      email\n      phone\n      numberOfOrders\n      amountSpent {\n        amount\n        currencyCode\n      }\n      createdAt\n      updatedAt\n      note\n      verifiedEmail\n      validEmailAddress\n      tags\n      lifetimeDuration\n      defaultAddress {\n        formattedArea\n        address1\n      }\n      addresses {\n        address1\n      }\n      image {\n        src\n      }\n      canDelete\n    }\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      id\n      firstName\n      lastName\n      email\n      phone\n      numberOfOrders\n      amountSpent {\n        amount\n        currencyCode\n      }\n      createdAt\n      updatedAt\n      note\n      verifiedEmail\n      validEmailAddress\n      tags\n      lifetimeDuration\n      defaultAddress {\n        formattedArea\n        address1\n      }\n      addresses {\n        address1\n      }\n      image {\n        src\n      }\n      canDelete\n    }\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      id\n      firstName\n      lastName\n      email\n      phone\n      numberOfOrders\n      amountSpent {\n        amount\n        currencyCode\n      }\n      createdAt\n      updatedAt\n      note\n      verifiedEmail\n      validEmailAddress\n      tags\n      lifetimeDuration\n      defaultAddress {\n        formattedArea\n        address1\n      }\n      addresses {\n        address1\n      }\n      image {\n        src\n      }\n      canDelete\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  customer(id: \"gid://shopify/Customer/544365967\") {\n    id\n    firstName\n    lastName\n    email\n    phone\n    numberOfOrders\n    amountSpent {\n      amount\n      currencyCode\n    }\n    createdAt\n    updatedAt\n    note\n    verifiedEmail\n    validEmailAddress\n    tags\n    lifetimeDuration\n    defaultAddress {\n      formattedArea\n      address1\n    }\n    addresses {\n      address1\n    }\n    image {\n      src\n    }\n    canDelete\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "customer": {
      "id": "gid://shopify/Customer/544365967",
      "firstName": "Bob",
      "lastName": "Bobsen",
      "email": "bob@example.com",
      "phone": "+13125551212",
      "numberOfOrders": "25",
      "amountSpent": {
        "amount": "8305.6",
        "currencyCode": "USD"
      },
      "createdAt": "2005-06-15T15:57:11Z",
      "updatedAt": "2005-06-16T15:57:11Z",
      "note": null,
      "verifiedEmail": true,
      "validEmailAddress": true,
      "tags": [
        "Bob",
        "Canadian",
        "Léon",
        "Noël"
      ],
      "lifetimeDuration": "over 19 years",
      "defaultAddress": {
        "formattedArea": "Ottawa ON, Canada",
        "address1": "123 Amoebobacterieae St"
      },
      "addresses": [
        {
          "address1": "123 Amoebobacterieae St"
        }
      ],
      "image": {
        "src": "https://cdn.shopify.com/proxy/d02a582792c73c48b4b62a95f42bcbf6eff91c5d232efb2057ca4c41005e4728/www.gravatar.com/avatar/4b9bb80620f03eb3719e0a061c14283d.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fadmin%2Fcustomers%2Fpolaris%2Favatar-2-a0ee6e3fb3ae515b66b68388b265e5bd1e90646c4c72d59170518f45351e668b.png"
      },
      "canDelete": false
    }
  }
}

### Get a customer's name, email, and default address
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customer(id: \\\"gid://shopify/Customer/544365967\\\") { email firstName lastName defaultAddress { address1 city province zip country } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      email\n      firstName\n      lastName\n      defaultAddress {\n        address1\n        city\n        province\n        zip\n        country\n      }\n    }\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      email\n      firstName\n      lastName\n      defaultAddress {\n        address1\n        city\n        province\n        zip\n        country\n      }\n    }\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      email\n      firstName\n      lastName\n      defaultAddress {\n        address1\n        city\n        province\n        zip\n        country\n      }\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  customer(id: \"gid://shopify/Customer/544365967\") {\n    email\n    firstName\n    lastName\n    defaultAddress {\n      address1\n      city\n      province\n      zip\n      country\n    }\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "customer": {
      "email": "bob@example.com",
      "firstName": "Bob",
      "lastName": "Bobsen",
      "defaultAddress": {
        "address1": "123 Amoebobacterieae St",
        "city": "Ottawa",
        "province": "Ontario",
        "zip": "K2P0V6",
        "country": "Canada"
      }
    }
  }
}

### Get a metafield attached to a customer
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) { customer(id: $ownerId) { nickname: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n    \"namespace\": \"my_fields\",\n    \"key\": \"nickname\",\n    \"ownerId\": \"gid://shopify/Customer/544365967\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n      customer(id: $ownerId) {\n        nickname: metafield(namespace: $namespace, key: $key) {\n          value\n        }\n      }\n    }`,\n    \"variables\": {\n      \"namespace\": \"my_fields\",\n      \"key\": \"nickname\",\n      \"ownerId\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n    customer(id: $ownerId) {\n      nickname: metafield(namespace: $namespace, key: $key) {\n        value\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"namespace\": \"my_fields\",\n  \"key\": \"nickname\",\n  \"ownerId\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n    customer(id: $ownerId) {\n      nickname: metafield(namespace: $namespace, key: $key) {\n        value\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"namespace\": \"my_fields\",\n      \"key\": \"nickname\",\n      \"ownerId\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n  customer(id: $ownerId) {\n    nickname: metafield(namespace: $namespace, key: $key) {\n      value\n    }\n  }\n}"
#### Graphql Input
{
  "namespace": "my_fields",
  "key": "nickname",
  "ownerId": "gid://shopify/Customer/544365967"
}
#### Graphql Response
{
  "data": {
    "customer": {
      "nickname": {
        "value": "rob"
      }
    }
  }
}

### Get all a customer's fields and connections
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customer(id: \\\"gid://shopify/Customer/544365967\\\") { addresses(first: 5) { address1 } canDelete createdAt defaultAddress { address1 } displayName email events(first: 5) { edges { node { message } } } firstName id image { id } lastName legacyResourceId lifetimeDuration mergeable { isMergeable reason } metafield(key: \\\"app_key\\\", namespace: \\\"affiliates\\\") { description } metafields(first: 5) { edges { node { id } } } note orders(first: 5) { edges { node { id } } } numberOfOrders phone state tags taxExempt amountSpent { amount } updatedAt validEmailAddress verifiedEmail } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      addresses(first: 5) {\n        address1\n      }\n      canDelete\n      createdAt\n      defaultAddress {\n        address1\n      }\n      displayName\n      email\n      events(first: 5) {\n        edges {\n          node {\n            message\n          }\n        }\n      }\n      firstName\n      id\n      image {\n        id\n      }\n      lastName\n      legacyResourceId\n      lifetimeDuration\n      mergeable {\n        isMergeable\n        reason\n      }\n      metafield(key: \"app_key\", namespace: \"affiliates\") {\n        description\n      }\n      metafields(first: 5) {\n        edges {\n          node {\n            id\n          }\n        }\n      }\n      note\n      orders(first: 5) {\n        edges {\n          node {\n            id\n          }\n        }\n      }\n      numberOfOrders\n      phone\n      state\n      tags\n      taxExempt\n      amountSpent {\n        amount\n      }\n      updatedAt\n      validEmailAddress\n      verifiedEmail\n    }\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      addresses(first: 5) {\n        address1\n      }\n      canDelete\n      createdAt\n      defaultAddress {\n        address1\n      }\n      displayName\n      email\n      events(first: 5) {\n        edges {\n          node {\n            message\n          }\n        }\n      }\n      firstName\n      id\n      image {\n        id\n      }\n      lastName\n      legacyResourceId\n      lifetimeDuration\n      mergeable {\n        isMergeable\n        reason\n      }\n      metafield(key: \"app_key\", namespace: \"affiliates\") {\n        description\n      }\n      metafields(first: 5) {\n        edges {\n          node {\n            id\n          }\n        }\n      }\n      note\n      orders(first: 5) {\n        edges {\n          node {\n            id\n          }\n        }\n      }\n      numberOfOrders\n      phone\n      state\n      tags\n      taxExempt\n      amountSpent {\n        amount\n      }\n      updatedAt\n      validEmailAddress\n      verifiedEmail\n    }\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    customer(id: \"gid://shopify/Customer/544365967\") {\n      addresses(first: 5) {\n        address1\n      }\n      canDelete\n      createdAt\n      defaultAddress {\n        address1\n      }\n      displayName\n      email\n      events(first: 5) {\n        edges {\n          node {\n            message\n          }\n        }\n      }\n      firstName\n      id\n      image {\n        id\n      }\n      lastName\n      legacyResourceId\n      lifetimeDuration\n      mergeable {\n        isMergeable\n        reason\n      }\n      metafield(key: \"app_key\", namespace: \"affiliates\") {\n        description\n      }\n      metafields(first: 5) {\n        edges {\n          node {\n            id\n          }\n        }\n      }\n      note\n      orders(first: 5) {\n        edges {\n          node {\n            id\n          }\n        }\n      }\n      numberOfOrders\n      phone\n      state\n      tags\n      taxExempt\n      amountSpent {\n        amount\n      }\n      updatedAt\n      validEmailAddress\n      verifiedEmail\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  customer(id: \"gid://shopify/Customer/544365967\") {\n    addresses(first: 5) {\n      address1\n    }\n    canDelete\n    createdAt\n    defaultAddress {\n      address1\n    }\n    displayName\n    email\n    events(first: 5) {\n      edges {\n        node {\n          message\n        }\n      }\n    }\n    firstName\n    id\n    image {\n      id\n    }\n    lastName\n    legacyResourceId\n    lifetimeDuration\n    mergeable {\n      isMergeable\n      reason\n    }\n    metafield(key: \"app_key\", namespace: \"affiliates\") {\n      description\n    }\n    metafields(first: 5) {\n      edges {\n        node {\n          id\n        }\n      }\n    }\n    note\n    orders(first: 5) {\n      edges {\n        node {\n          id\n        }\n      }\n    }\n    numberOfOrders\n    phone\n    state\n    tags\n    taxExempt\n    amountSpent {\n      amount\n    }\n    updatedAt\n    validEmailAddress\n    verifiedEmail\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "customer": {
      "addresses": [
        {
          "address1": "123 Amoebobacterieae St"
        }
      ],
      "canDelete": false,
      "createdAt": "2005-06-15T15:57:11Z",
      "defaultAddress": {
        "address1": "123 Amoebobacterieae St"
      },
      "displayName": "Bob Bobsen",
      "email": "bob@example.com",
      "events": {
        "edges": []
      },
      "firstName": "Bob",
      "id": "gid://shopify/Customer/544365967",
      "image": {
        "id": null
      },
      "lastName": "Bobsen",
      "legacyResourceId": "544365967",
      "lifetimeDuration": "over 19 years",
      "mergeable": {
        "isMergeable": false,
        "reason": "Bob Bobsen is scheduled for redaction or has been redacted and can’t be merged."
      },
      "metafield": null,
      "metafields": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/Metafield/749520593"
            }
          }
        ]
      },
      "note": null,
      "orders": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/Order/116757651"
            }
          },
          {
            "node": {
              "id": "gid://shopify/Order/126216516"
            }
          },
          {
            "node": {
              "id": "gid://shopify/Order/148977776"
            }
          },
          {
            "node": {
              "id": "gid://shopify/Order/215577410"
            }
          },
          {
            "node": {
              "id": "gid://shopify/Order/235240302"
            }
          }
        ]
      },
      "numberOfOrders": "25",
      "phone": "+13125551212",
      "state": "ENABLED",
      "tags": [
        "Bob",
        "Canadian",
        "Léon",
        "Noël"
      ],
      "taxExempt": false,
      "amountSpent": {
        "amount": "8305.6"
      },
      "updatedAt": "2005-06-16T15:57:11Z",
      "validEmailAddress": true,
      "verifiedEmail": true
    }
  }
}

### Get metafields attached to a customer
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomerMetafields($ownerId: ID!) { customer(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n    \"ownerId\": \"gid://shopify/Customer/544365967\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `query CustomerMetafields($ownerId: ID!) {\n      customer(id: $ownerId) {\n        metafields(first: 3) {\n          edges {\n            node {\n              namespace\n              key\n              value\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"ownerId\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query CustomerMetafields($ownerId: ID!) {\n    customer(id: $ownerId) {\n      metafields(first: 3) {\n        edges {\n          node {\n            namespace\n            key\n            value\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"ownerId\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query CustomerMetafields($ownerId: ID!) {\n    customer(id: $ownerId) {\n      metafields(first: 3) {\n        edges {\n          node {\n            namespace\n            key\n            value\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"ownerId\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "query CustomerMetafields($ownerId: ID!) {\n  customer(id: $ownerId) {\n    metafields(first: 3) {\n      edges {\n        node {\n          namespace\n          key\n          value\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "ownerId": "gid://shopify/Customer/544365967"
}
#### Graphql Response
{
  "data": {
    "customer": {
      "metafields": {
        "edges": [
          {
            "node": {
              "namespace": "my_fields",
              "key": "nickname",
              "value": "rob"
            }
          }
        ]
      }
    }
  }
}

### Get pinned metafield definitions associated with a customer
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) { customer(id: $ownerId) { metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) { edges { node { name namespace key type { name } } } } } }\",\n \"variables\": {\n    \"pinnedStatus\": \"PINNED\",\n    \"ownerId\": \"gid://shopify/Customer/544365967\",\n    \"first\": 10,\n    \"sortKey\": \"PINNED_POSITION\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n      customer(id: $ownerId) {\n        metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n          edges {\n            node {\n              name\n              namespace\n              key\n              type {\n                name\n              }\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"pinnedStatus\": \"PINNED\",\n      \"ownerId\": \"gid://shopify/Customer/544365967\",\n      \"first\": 10,\n      \"sortKey\": \"PINNED_POSITION\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n    customer(id: $ownerId) {\n      metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n        edges {\n          node {\n            name\n            namespace\n            key\n            type {\n              name\n            }\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"pinnedStatus\": \"PINNED\",\n  \"ownerId\": \"gid://shopify/Customer/544365967\",\n  \"first\": 10,\n  \"sortKey\": \"PINNED_POSITION\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n    customer(id: $ownerId) {\n      metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n        edges {\n          node {\n            name\n            namespace\n            key\n            type {\n              name\n            }\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"pinnedStatus\": \"PINNED\",\n      \"ownerId\": \"gid://shopify/Customer/544365967\",\n      \"first\": 10,\n      \"sortKey\": \"PINNED_POSITION\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n  customer(id: $ownerId) {\n    metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n      edges {\n        node {\n          name\n          namespace\n          key\n          type {\n            name\n          }\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "pinnedStatus": "PINNED",
  "ownerId": "gid://shopify/Customer/544365967",
  "first": 10,
  "sortKey": "PINNED_POSITION"
}
#### Graphql Response
{
  "data": {
    "customer": {
      "metafieldDefinitions": {
        "edges": [
          {
            "node": {
              "name": "Pronouns",
              "namespace": "my_fields",
              "key": "pronouns",
              "type": {
                "name": "single_line_text_field"
              }
            }
          },
          {
            "node": {
              "name": "Nickname",
              "namespace": "my_fields",
              "key": "nickname",
              "type": {
                "name": "single_line_text_field"
              }
            }
          }
        ]
      }
    }
  }
}

### Get the email, name, and account creation date of three customers using a fragment
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { Bob: customer(id: \\\"gid://shopify/Customer/544365967\\\") { ...customerProfile } Jane: customer(id: \\\"gid://shopify/Customer/567375318\\\") { ...customerProfile } Jenny: customer(id: \\\"gid://shopify/Customer/56501169\\\") { ...customerProfile } } fragment customerProfile on Customer { firstName lastName email createdAt }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n      ...customerProfile\n    }\n    Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n      ...customerProfile\n    }\n    Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n      ...customerProfile\n    }\n  }\n  \n  fragment customerProfile on Customer {\n    firstName\n    lastName\n    email\n    createdAt\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n      ...customerProfile\n    }\n    Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n      ...customerProfile\n    }\n    Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n      ...customerProfile\n    }\n  }\n  \n  fragment customerProfile on Customer {\n    firstName\n    lastName\n    email\n    createdAt\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n      ...customerProfile\n    }\n    Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n      ...customerProfile\n    }\n    Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n      ...customerProfile\n    }\n  }\n  \n  fragment customerProfile on Customer {\n    firstName\n    lastName\n    email\n    createdAt\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n    ...customerProfile\n  }\n  Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n    ...customerProfile\n  }\n  Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n    ...customerProfile\n  }\n}\n\nfragment customerProfile on Customer {\n  firstName\n  lastName\n  email\n  createdAt\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "Bob": {
      "firstName": "Bob",
      "lastName": "Bobsen",
      "email": "bob@example.com",
      "createdAt": "2005-06-15T15:57:11Z"
    },
    "Jane": {
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "janesmith@b2b.example.com",
      "createdAt": "2024-11-04T18:56:43Z"
    },
    "Jenny": {
      "firstName": "Jenny",
      "lastName": "Test",
      "email": "jennytest@b2b.example.com",
      "createdAt": "2024-11-04T18:56:43Z"
    }
  }
}

### Get the first five line items of the customer's last order
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customer(id: \\\"gid://shopify/Customer/624407574\\\") { lastOrder { lineItems(first: 5) { edges { node { name quantity } } } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    customer(id: \"gid://shopify/Customer/624407574\") {\n      lastOrder {\n        lineItems(first: 5) {\n          edges {\n            node {\n              name\n              quantity\n            }\n          }\n        }\n      }\n    }\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    customer(id: \"gid://shopify/Customer/624407574\") {\n      lastOrder {\n        lineItems(first: 5) {\n          edges {\n            node {\n              name\n              quantity\n            }\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    customer(id: \"gid://shopify/Customer/624407574\") {\n      lastOrder {\n        lineItems(first: 5) {\n          edges {\n            node {\n              name\n              quantity\n            }\n          }\n        }\n      }\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  customer(id: \"gid://shopify/Customer/624407574\") {\n    lastOrder {\n      lineItems(first: 5) {\n        edges {\n          node {\n            name\n            quantity\n          }\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "customer": {
      "lastOrder": {
        "lineItems": {
          "edges": [
            {
              "node": {
                "name": "Draft - 151cm",
                "quantity": 1
              }
            }
          ]
        }
      }
    }
  }
}

### Get the merge status of a customer
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customer(id: \\\"gid://shopify/Customer/105906728\\\") { mergeable { isMergeable reason errorFields mergeInProgress { jobId status resultingCustomerId customerMergeErrors { errorFields message } } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    customer(id: \"gid://shopify/Customer/105906728\") {\n      mergeable {\n        isMergeable\n        reason\n        errorFields\n        mergeInProgress {\n          jobId\n          status\n          resultingCustomerId\n          customerMergeErrors {\n            errorFields\n            message\n          }\n        }\n      }\n    }\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    customer(id: \"gid://shopify/Customer/105906728\") {\n      mergeable {\n        isMergeable\n        reason\n        errorFields\n        mergeInProgress {\n          jobId\n          status\n          resultingCustomerId\n          customerMergeErrors {\n            errorFields\n            message\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    customer(id: \"gid://shopify/Customer/105906728\") {\n      mergeable {\n        isMergeable\n        reason\n        errorFields\n        mergeInProgress {\n          jobId\n          status\n          resultingCustomerId\n          customerMergeErrors {\n            errorFields\n            message\n          }\n        }\n      }\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  customer(id: \"gid://shopify/Customer/105906728\") {\n    mergeable {\n      isMergeable\n      reason\n      errorFields\n      mergeInProgress {\n        jobId\n        status\n        resultingCustomerId\n        customerMergeErrors {\n          errorFields\n          message\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "customer": {
      "mergeable": {
        "isMergeable": false,
        "reason": "John Smith is scheduled for redaction or has been redacted and can’t be merged.",
        "errorFields": [
          "REDACTED_AT"
        ],
        "mergeInProgress": null
      }
    }
  }
}

### Get two specific customers by their ID using aliases
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { bob: customer(id: \\\"gid://shopify/Customer/544365967\\\") { firstName lastName email } john: customer(id: \\\"gid://shopify/Customer/105906728\\\") { firstName lastName email } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `query {\n    bob: customer(id: \"gid://shopify/Customer/544365967\") {\n      firstName\n      lastName\n      email\n    }\n    john: customer(id: \"gid://shopify/Customer/105906728\") {\n      firstName\n      lastName\n      email\n    }\n  }`,\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query {\n    bob: customer(id: \"gid://shopify/Customer/544365967\") {\n      firstName\n      lastName\n      email\n    }\n    john: customer(id: \"gid://shopify/Customer/105906728\") {\n      firstName\n      lastName\n      email\n    }\n  }\nQUERY\n\nresponse = client.query(query: query)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query {\n    bob: customer(id: \"gid://shopify/Customer/544365967\") {\n      firstName\n      lastName\n      email\n    }\n    john: customer(id: \"gid://shopify/Customer/105906728\") {\n      firstName\n      lastName\n      email\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n  bob: customer(id: \"gid://shopify/Customer/544365967\") {\n    firstName\n    lastName\n    email\n  }\n  john: customer(id: \"gid://shopify/Customer/105906728\") {\n    firstName\n    lastName\n    email\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "bob": {
      "firstName": "Bob",
      "lastName": "Bobsen",
      "email": "bob@example.com"
    },
    "john": {
      "firstName": "John",
      "lastName": "Smith",
      "email": "johnsmith@example.com"
    }
  }
}

### Retrieves a list of addresses for a customer
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomerAddressList($id: ID!) { customer(id: $id) { defaultAddress { address1 city } addressesV2(first: 10) { edges { node { address1 city } } } } }\",\n \"variables\": {\n    \"id\": \"gid://shopify/Customer/544365967\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `query CustomerAddressList($id: ID!) {\n      customer(id: $id) {\n        defaultAddress {\n          address1\n          city\n        }\n        addressesV2(first: 10) {\n          edges {\n            node {\n              address1\n              city\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"id\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query CustomerAddressList($id: ID!) {\n    customer(id: $id) {\n      defaultAddress {\n        address1\n        city\n      }\n      addressesV2(first: 10) {\n        edges {\n          node {\n            address1\n            city\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"id\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query CustomerAddressList($id: ID!) {\n    customer(id: $id) {\n      defaultAddress {\n        address1\n        city\n      }\n      addressesV2(first: 10) {\n        edges {\n          node {\n            address1\n            city\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"id\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "query CustomerAddressList($id: ID!) {\n  customer(id: $id) {\n    defaultAddress {\n      address1\n      city\n    }\n    addressesV2(first: 10) {\n      edges {\n        node {\n          address1\n          city\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "id": "gid://shopify/Customer/544365967"
}
#### Graphql Response
{
  "data": {
    "customer": {
      "defaultAddress": {
        "address1": "123 Amoebobacterieae St",
        "city": "Ottawa"
      },
      "addressesV2": {
        "edges": [
          {
            "node": {
              "address1": "123 Amoebobacterieae St",
              "city": "Ottawa"
            }
          }
        ]
      }
    }
  }
}

### Retrieves details for a single customer address
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomerAddressShow($id: ID!) { customer(id: $id) { addressesV2(first: 250) { edges { node { id address1 city } } } } }\",\n \"variables\": {\n    \"id\": \"gid://shopify/Customer/544365967\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `query CustomerAddressShow($id: ID!) {\n      customer(id: $id) {\n        addressesV2(first: 250) {\n          edges {\n            node {\n              id\n              address1\n              city\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"id\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  query CustomerAddressShow($id: ID!) {\n    customer(id: $id) {\n      addressesV2(first: 250) {\n        edges {\n          node {\n            id\n            address1\n            city\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"id\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  query CustomerAddressShow($id: ID!) {\n    customer(id: $id) {\n      addressesV2(first: 250) {\n        edges {\n          node {\n            id\n            address1\n            city\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"id\": \"gid://shopify/Customer/544365967\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "query CustomerAddressShow($id: ID!) {\n  customer(id: $id) {\n    addressesV2(first: 250) {\n      edges {\n        node {\n          id\n          address1\n          city\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "id": "gid://shopify/Customer/544365967"
}
#### Graphql Response
{
  "data": {
    "customer": {
      "addressesV2": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/MailingAddress/544365967?model_name=CustomerAddress",
              "address1": "123 Amoebobacterieae St",
              "city": "Ottawa"
            }
          }
        ]
      }
    }
  }
}