customer.graphql 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. # Represents information about a customer of the shop, such as the customer's contact details, their order
  2. # history, and whether they've agreed to receive marketing material by email.
  3. #
  4. # Caution: Only use this data if it's required for your app's functionality.
  5. # Shopify will restrict access to scopes for apps that don't have a legitimate use for the associated data.
  6. type Customer implements CommentEventSubject&HasEvents&HasMetafieldDefinitions&HasMetafields&LegacyInteroperability&Node{
  7. # A list of addresses associated with the customer.
  8. addresses(first: Int): [MailingAddress!]!
  9. # The total amount that the customer has spent on orders in their lifetime.
  10. amountSpent: MoneyV2!
  11. # The average amount that the customer spent per order.
  12. averageOrderAmountV2: MoneyV2
  13. # Whether the merchant can delete the customer from their store.
  14. #
  15. # A customer can be deleted from a store only if they have not yet made an order. After a customer makes an
  16. # order, they can't be deleted from a store.
  17. canDelete: Boolean!
  18. # A list of the customer's company contact profiles.
  19. companyContactProfiles: [CompanyContact!]!
  20. # The date and time when the customer was added to the store.
  21. createdAt: DateTime!
  22. # The default address associated with the customer.
  23. defaultAddress: MailingAddress
  24. # The full name of the customer, based on the values for first_name and last_name. If the first_name and
  25. # 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.
  26. displayName: String!
  27. # The customer's email address.
  28. email: String
  29. # The current email marketing state for the customer.
  30. # If the customer doesn't have an email address, then this property is `null`.
  31. emailMarketingConsent: CustomerEmailMarketingConsentState
  32. # A list of events associated with the customer.
  33. events(
  34. first: Int
  35. after: String
  36. last: Int
  37. before: String
  38. reverse: Boolean = false
  39. sortKey: EventSortKeys = ID
  40. query: String
  41. ): EventConnection!
  42. # The customer's first name.
  43. firstName: String
  44. # Whether the timeline subject has a timeline comment. If true, then a timeline comment exists.
  45. hasTimelineComment: Boolean!
  46. # A globally-unique identifier.
  47. id: ID!
  48. # The image associated with the customer.
  49. image: Image!
  50. # The customer's last name.
  51. lastName: String
  52. # The customer's last order.
  53. lastOrder: Order
  54. # The ID of the corresponding resource in the REST Admin API.
  55. legacyResourceId: UnsignedInt64!
  56. # The amount of time since the customer was first added to the store.
  57. #
  58. # Example: 'about 12 years'.
  59. lifetimeDuration: String!
  60. # The customer's locale.
  61. locale: String!
  62. # The market that includes the customer’s default address.
  63. market: Market
  64. # Returns a metafield by namespace and key that belongs to the resource.
  65. metafield(namespace: String!key: String!): Metafield
  66. # List of metafield definitions.
  67. metafieldDefinitions(
  68. namespace: String
  69. pinnedStatus: MetafieldDefinitionPinnedStatus = ANY
  70. first: Int
  71. after: String
  72. last: Int
  73. before: String
  74. reverse: Boolean = false
  75. sortKey: MetafieldDefinitionSortKeys = ID
  76. query: String
  77. ): MetafieldDefinitionConnection!
  78. # List of metafields that belong to the resource.
  79. metafields(
  80. namespace: String
  81. first: Int
  82. after: String
  83. last: Int
  84. before: String
  85. reverse: Boolean = false
  86. ): MetafieldConnection!
  87. # A unique identifier for the customer that's used with Multipass login.
  88. multipassIdentifier: String
  89. # A note about the customer.
  90. note: String
  91. # The number of orders that the customer has made at the store in their lifetime.
  92. numberOfOrders: UnsignedInt64!
  93. # A list of the customer's orders.
  94. orders(
  95. first: Int
  96. after: String
  97. last: Int
  98. before: String
  99. reverse: Boolean = false
  100. sortKey: OrderSortKeys = ID
  101. query: String
  102. ): OrderConnection!
  103. # A list of the customer's payment methods.
  104. paymentMethods(
  105. showRevoked: Boolean = false
  106. first: Int
  107. after: String
  108. last: Int
  109. before: String
  110. reverse: Boolean = false
  111. ): CustomerPaymentMethodConnection!
  112. # The customer's phone number.
  113. phone: String
  114. # Returns a private metafield by namespace and key that belongs to the resource.
  115. privateMetafield(namespace: String!key: String!): PrivateMetafield
  116. # List of private metafields that belong to the resource.
  117. privateMetafields(
  118. namespace: String
  119. first: Int
  120. after: String
  121. last: Int
  122. before: String
  123. reverse: Boolean = false
  124. ): PrivateMetafieldConnection!
  125. # Possible subscriber states of a customer defined by their subscription contracts.
  126. productSubscriberStatus: CustomerProductSubscriberStatus!
  127. # The current SMS marketing state for the customer's phone number.
  128. #
  129. # If the customer does not have a phone number, then this property is null.
  130. smsMarketingConsent: CustomerSmsMarketingConsentState
  131. # The state of the customer's account with the shop.
  132. state: CustomerState!
  133. # The statistics for a given customer.
  134. statistics: CustomerStatistics!
  135. # A list of the customer's subscription contracts.
  136. subscriptionContracts(
  137. first: Int
  138. after: String
  139. last: Int
  140. before: String
  141. reverse: Boolean = false
  142. ): SubscriptionContractConnection!
  143. # A comma separated list of tags that have been added to the customer.
  144. tags: [String!]!
  145. # Whether the customer is exempt from being charged taxes on their orders.
  146. taxExempt: Boolean!
  147. # The list of tax exemptions applied to the customer.
  148. taxExemptions: [TaxExemption!]!
  149. # The URL to unsubscribe the customer from the mailing list.
  150. unsubscribeUrl: URL!
  151. # The date and time when the customer was last updated.
  152. updatedAt: DateTime!
  153. # Whether the email address is formatted correctly.
  154. # Returns true when the email is formatted correctly and
  155. # belongs to an existing domain. This doesn't guarantee that
  156. # the email address actually exists.
  157. validEmailAddress: Boolean!
  158. # Whether the customer has verified their email address. Defaults to true if the customer is created through the Shopify admin or API.
  159. verifiedEmail: Boolean!
  160. }
  161. # Represents the data about a staff member's Shopify account.
  162. # Merchants can use staff member data to get more information about the staff members in their store.
  163. type StaffMember implements Node {
  164. # Whether the staff member is active.
  165. active: Boolean!
  166. # The image used as the staff member's avatar in the Shopify admin.
  167. avatar(fallback: StaffMemberDefaultImage = DEFAULT): Image!
  168. # The staff member's email address.
  169. email: String!
  170. # Whether the staff member's account exists.
  171. exists: Boolean!
  172. # The staff member's first name.
  173. firstName: String
  174. # A globally-unique identifier.
  175. id: ID!
  176. # The staff member's initials, if available.
  177. initials: [String!]
  178. # Whether the staff member is the shop owner.
  179. isShopOwner: Boolean!
  180. # The staff member's last name.
  181. lastName: String
  182. # The staff member's preferred locale. Locale values use the format language or language-COUNTRY, where language is a two-letter language code, and COUNTRY is a two-letter country code. For example: en or en-US
  183. locale: String!
  184. # The staff member's full name.
  185. name: String!
  186. # The staff member's phone number.
  187. phone: String
  188. # The data used to customize the Shopify admin experience for the staff member.
  189. privateData: StaffMemberPrivateData!
  190. }
  191. # Represents the data used to customize the Shopify admin experience for a logged-in staff member.
  192. type StaffMemberPrivateData {
  193. # The URL to the staff member's account settings page.
  194. accountSettingsUrl: URL!
  195. # The date and time when the staff member was created.
  196. createdAt: DateTime!
  197. }
  198. # The record of when a customer consented to receive marketing material by email.
  199. type CustomerEmailMarketingConsentState {
  200. # The date and time at which the customer consented to receive marketing material by email.
  201. # The customer's consent state reflects the consent record with the most recent consent_updated_at date.
  202. # If no date is provided, then the date and time at which the consent information was sent is used.
  203. consentUpdatedAt: DateTime
  204. # The marketing subscription opt-in level, as described by the M3AAWG best practices guidelines,
  205. # that the customer gave when they consented to receive marketing material by email.
  206. marketingOptInLevel: CustomerMarketingOptInLevel
  207. # The current email marketing state for the customer.
  208. marketingState: CustomerEmailMarketingState!
  209. }
  210. # The record of when a customer consented to receive marketing material by SMS.
  211. #
  212. # The customer's consent state reflects the record with the most recent date when consent was updated.
  213. type CustomerSmsMarketingConsentState {
  214. # The source from which the SMS marketing information for the customer was collected.
  215. consentCollectedFrom: CustomerConsentCollectedFrom
  216. # The date and time when the customer consented to receive marketing material by SMS.
  217. # If no date is provided, then the date and time when the consent information was sent is used.
  218. consentUpdatedAt: DateTime
  219. # The marketing subscription opt-in level that was set when the customer consented to receive marketing information.
  220. marketingOptInLevel: CustomerMarketingOptInLevel!
  221. # The current SMS marketing state for the customer.
  222. marketingState: CustomerSmsMarketingState!
  223. }
  224. # A customer's computed statistics.
  225. type CustomerStatistics {
  226. # The predicted spend tier of a customer with a shop.
  227. predictedSpendTier: CustomerPredictedSpendTier
  228. }
  229. # Represents a customer's session visiting a shop's online store,
  230. # including information about the marketing activity attributed to starting the session.
  231. type CustomerVisit implements CustomerMoment&Node {
  232. # A globally-unique identifier.
  233. id: ID!
  234. # URL of the first page the customer landed on for the session.
  235. landingPage: URL
  236. # Landing page information with URL linked in HTML.
  237. # For example, the first page the customer visited was store.myshopify.com/products/1.
  238. landingPageHtml: HTML
  239. # Represent actions taken by an app, on behalf of a merchant,
  240. # to market Shopify resources such as products, collections, and discounts.
  241. marketingEvent: MarketingEvent
  242. # The date and time when the customer's session occurred.
  243. occurredAt: DateTime!
  244. # Marketing referral code from the link that the customer clicked to visit the store.
  245. # Supports the following URL attributes: ref, source, or r.
  246. # For example, if the URL is myshopifystore.com/products/slide?ref=j2tj1tn2, then this value is j2tj1tn2.
  247. referralCode: String
  248. # Referral information with URLs linked in HTML.
  249. referralInfoHtml: FormattedString!
  250. # Webpage where the customer clicked a link that sent them to the online store.
  251. # For example, https://randomblog.com/page1 or android-app://com.google.android.gm.
  252. referrerUrl: URL
  253. # Source from which the customer visited the store, such as a platform (Facebook, Google), email, direct,
  254. # a website domain, QR code, or unknown.
  255. source: String!
  256. # Describes the source explicitly for first or last session.
  257. sourceDescription: String
  258. # Type of marketing tactic.
  259. sourceType: MarketingTactic
  260. # A set of UTM parameters gathered from the URL parameters of the referrer.
  261. utmParameters: UTMParameters
  262. }
  263. # Represents actions that market a merchant's store or products.
  264. type MarketingEvent implements LegacyInteroperability&Node {
  265. # The app that the marketing event is attributed to.
  266. app: App!
  267. # The marketing channel used by the marketing event.
  268. channel: MarketingChannel
  269. # A human-readable description of the marketing event.
  270. description: String
  271. # The date and time when the marketing event ended.
  272. endedAt: DateTime
  273. # A globally-unique identifier.
  274. id: ID!
  275. # The ID of the corresponding resource in the REST Admin API.
  276. legacyResourceId: UnsignedInt64!
  277. # The URL where the marketing event can be managed.
  278. manageUrl: URL
  279. # The URL where the marketing event can be previewed.
  280. previewUrl: URL
  281. # An optional ID that helps Shopify validate engagement data.
  282. remoteId: String
  283. # The date and time when the marketing event is scheduled to end.
  284. scheduledToEndAt: DateTime
  285. # Where the MarketingEvent occurred and what kind of content was used.
  286. # Because utmSource and utmMedium are often used interchangeably, this is
  287. # based on a combination of marketingChannel, referringDomain, and type to
  288. # provide a consistent representation for any given piece of marketing
  289. # regardless of the app that created it.
  290. sourceAndMedium: String!
  291. # The date and time when the marketing event started.
  292. startedAt: DateTime!
  293. # The marketing event type.
  294. type: MarketingTactic!
  295. # The name of the marketing campaign.
  296. utmCampaign: String
  297. # The medium that the marketing campaign is using. Example values: cpc, banner.
  298. utmMedium: String
  299. # The referrer of the marketing event. Example values: google, newsletter.
  300. utmSource: String
  301. }
  302. # A customer's payment method.
  303. type CustomerPaymentMethod implements Node {
  304. # The customer to whom the payment method belongs.
  305. customer: Customer
  306. # The ID of this payment method.
  307. id: ID!
  308. # The instrument for this payment method.
  309. instrument: CustomerPaymentInstrument
  310. # The time that the payment method was revoked.
  311. revokedAt: DateTime
  312. # The revocation reason for this payment method.
  313. revokedReason: CustomerPaymentMethodRevocationReason
  314. # List Subscription Contracts.
  315. subscriptionContracts(
  316. first: Int
  317. after: String
  318. last: Int
  319. before: String
  320. reverse: Boolean = false
  321. ): SubscriptionContractConnection!
  322. }
  323. # Represents a customer's visiting activities on a shop's online store.
  324. type CustomerJourneySummary {
  325. customerOrderIndex: Int
  326. # The position of the current order within the customer's order history. Test orders aren't included.
  327. # The number of days between the first session and the order creation date.
  328. # The first session represents the first session since the last order, or the first session within the 30 day attribution window, if more than 30 days have passed since the last order.
  329. daysToConversion: Int
  330. # The customer's first session going into the shop.
  331. firstVisit: CustomerVisit
  332. # The last session before an order is made.
  333. lastVisit: CustomerVisit
  334. # The events preceding a customer's order, such as shop sessions.
  335. moments(
  336. first: Int
  337. after: String
  338. last: Int
  339. before: String
  340. reverse: Boolean = false
  341. ): CustomerMomentConnection
  342. # The total number of customer moments associated with this order. Returns null if the order is still in the process of being attributed.
  343. momentsCount: Int
  344. # Whether the attributed sessions for the order have been created yet.
  345. ready: Boolean!
  346. }
  347. # Represents a card instrument for customer payment method.
  348. type CustomerCreditCard {
  349. # The billing address of the card.
  350. billingAddress: CustomerCreditCardBillingAddress
  351. # The brand of the card.
  352. brand: String!
  353. # Whether the card is about to expire.
  354. expiresSoon: Boolean!
  355. # The expiry month of the card.
  356. expiryMonth: Int!
  357. # The expiry year of the card.
  358. expiryYear: Int!
  359. # The card's BIN number.
  360. firstDigits: String
  361. # The payment method can be revoked if there are no active subscription contracts.
  362. isRevocable: Boolean!
  363. # The last 4 digits of the card.
  364. lastDigits: String!
  365. # The masked card number with only the last 4 digits displayed.
  366. maskedNumber: String!
  367. # The name of the card holder.
  368. name: String!
  369. # The source of the card if coming from a wallet such as Apple Pay.
  370. source: String
  371. # The last 4 digits of the Device Account Number.
  372. virtualLastDigits: String
  373. }
  374. # The billing address of a credit card payment instrument.
  375. type CustomerCreditCardBillingAddress {
  376. # The first line of the address. Typically the street address or PO Box number.
  377. address1: String
  378. # The name of the city, district, village, or town.
  379. city: String
  380. # The name of the country.
  381. country: String
  382. # The two-letter code for the country of the address.
  383. # For example, US.
  384. countryCode: CountryCode
  385. # The region of the address, such as the province, state, or district.
  386. province: String
  387. # The two-letter code for the region.
  388. # For example, ON.
  389. provinceCode: String
  390. # The zip or postal code of the address.
  391. zip: String
  392. }
  393. # Represents a PayPal instrument for customer payment method.
  394. type CustomerPaypalBillingAgreement {
  395. # The billing address of this payment method.
  396. billingAddress: CustomerPaymentInstrumentBillingAddress
  397. # Whether the PayPal billing agreement is inactive.
  398. inactive: Boolean!
  399. # Whether the payment method can be revoked.The payment method can be revoked if there are no active subscription contracts.
  400. isRevocable: Boolean!
  401. # The customers's PayPal account email address.
  402. paypalAccountEmail: String
  403. }
  404. # The billing address of a payment instrument.
  405. type CustomerPaymentInstrumentBillingAddress {
  406. # The first line of the address. Typically the street address or PO Box number.
  407. address1: String
  408. # The name of the city, district, village, or town.
  409. city: String
  410. # The name of the country.
  411. country: String
  412. # The two-letter code for the country of the address.
  413. # For example, US.
  414. countryCode: CountryCode
  415. # The name of the buyer of the address.
  416. name: String
  417. # The region of the address, such as the province, state, or district.
  418. province: String
  419. # The two-letter code for the region.
  420. # For example, ON.
  421. provinceCode: String
  422. # The zip or postal code of the address.
  423. zip: String
  424. }
  425. # Represents a Shop Pay card instrument for customer payment method.
  426. type CustomerShopPayAgreement {
  427. # Whether the card is about to expire.
  428. expiresSoon: Boolean!
  429. # The expiry month of the card.
  430. expiryMonth: Int!
  431. # The expiry year of the card.
  432. expiryYear: Int!
  433. # Whether the Shop Pay billing agreement is inactive.
  434. inactive: Boolean!
  435. # The payment method can be revoked if there are no active subscription contracts.
  436. isRevocable: Boolean!
  437. # The last 4 digits of the card.
  438. lastDigits: String!
  439. # The masked card number with only the last 4 digits displayed.
  440. maskedNumber: String!
  441. # The name of the card holder.
  442. name: String!
  443. }