---
title: "customer"
description: "Return customer information by ID"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/queries/customer'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/queries/customer.md'
---
# customer

Return customer information by ID

- **Required Scopes:** `read_customers`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Required Permissions

* `read_customers`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `id`

  [ID!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  Returns a Customer resource by ID.

## Returns

* `addresses`

  [[MailingAddress]](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/mailing-address.md)

  Address information

* `amountSpent`

  [MoneyV2](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/money-v2.md)

  Total cost amount

* `canDelete`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Can be deleted

* `createdAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  Creation time

* `defaultAddress`

  [MailingAddress](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/mailing-address.md)

  Default address

* `displayName`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Full name

* `email`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  email

* `emailMarketingConsent`

  [CustomerEmailMarketingConsentState](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/customer-email-marketing-consent-state.md)

  Mailbox subscription information

* `firstName`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  firstName

* `id`

  [ID](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  Customer id

* `lastName`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Last name

* `lifetimeDuration`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  The time when the customer joined the store, for example, one day, one week, one year

* `locale`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Language

* `note`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Notes

* `numberOfOrders`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Order qty

* `phone`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Phone number

* `smsMarketingConsent`

  [CustomerSmsMarketingConsentState](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/customer-sms-marketing-consent-state.md)

  Sms subscription status

* `state`

  [CustomerState](https://developer.shopline.com/docs/admin-graph-ql-api/customers/enums/customer-state.md)

  Customer status

* `tags`

  [[String]](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Tag

* `taxExempt`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  The customer's order can be marked as tax-free, true: tax-free, false: not tax-free

* `taxExemptions`

  [[FreeAreas]](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/free-areas.md)

  Customer's tax-free list

* `updatedAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  Update time

* `validEmailAddress`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Email address verification does not guarantee the authenticity of the email address

* `verifiedEmail`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Email verification or not

## Examples

### get customer details

query customer details by ID


**Request:**

```json
query {
  customer(id: "gid://shopline/Customer/4600419107") {
    locale
    id
    state
    firstName
    lastName
    email
    phone
    createdAt
    updatedAt
    note
    verifiedEmail
    tags
    lifetimeDuration
    validEmailAddress
    amountSpent{
        amount
        currencyCode
    }
    taxExempt
        taxExemptions{
            countryCode
            provinceGCodeList
    }
    numberOfOrders
    lifetimeDuration
    validEmailAddress
    defaultAddress {
      address1
      address2
      city
      company
      country
      countryCodeV2
      firstName
      lastName
      id
      phone
      province
      provinceCode
      zip
      district
      town
    }
    addresses {
      address1
      address2
      city
      company
      country
      countryCodeV2
      firstName
      lastName
      id
      phone
      province
      provinceCode
      zip
      district
      town
    }
    canDelete
  }
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "customer": {
        "amountSpent": {
          "amount": "0",
          "currencyCode": "CLP"
        },
        "firstName": "S*****",
        "lastName": "T*****",
        "locale": null,
        "phone": "0086138****1234",
        "validEmailAddress": true,
        "defaultAddress": {
          "id": "gid://shopline/MailingAddress/SL201UA6266776363820652562",
          "phone": "0086138****1234",
          "town": "Street",
          "countryCodeV2": "US",
          "firstName": "S*****",
          "lastName": "T*****",
          "provinceCode": null,
          "address2": "Apartment 2",
          "city": "Louisville",
          "country": "United States",
          "district": "district",
          "province": "Kentucky",
          "zip": "40202",
          "address1": "Chestnut Street 92",
          "company": "C*****"
        },
        "email": "*****@example.com",
        "id": "gid://shopline/Customer/4600419107",
        "numberOfOrders": 0,
        "tags": [
          "test1"
        ],
        "addresses": [
          {
            "address2": "Apartment 2",
            "country": "United States",
            "firstName": "S*****",
            "id": "gid://shopline/MailingAddress/SL201UA6266776363820652562",
            "provinceCode": null,
            "company": "C*****",
            "lastName": "T*****",
            "province": "Kentucky",
            "zip": "40202",
            "address1": "Chestnut Street 92",
            "countryCodeV2": "US",
            "town": "Street",
            "city": "Louisville",
            "district": "district",
            "phone": "0086138****1234"
          }
        ],
        "canDelete": true,
        "lifetimeDuration": "14 days ago",
        "state": "NOT_INVITED",
        "taxExempt": true,
        "taxExemptions": [
          {
            "countryCode": "US",
            "provinceGCodeList": [
              "AK",
              "AL"
            ]
          }
        ],
        "updatedAt": "2023-12-29T13:38:08.470Z",
        "createdAt": "2023-12-29T13:38:06.534Z",
        "note": "Placed an order that had a fraud warning",
        "verifiedEmail": true
      }
    }
  }
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

