Customer
The customer api stores information about a store's customers such as contact information, address information, number of orders of the customer.
A customer resource stores information about a store's customers, such as contact information, order history, and whether they agree to receive email marketing.
The customer resource also maintains information about the status of a customer's account. Customers with accounts save time at checkout as they don't need to enter their contact information when they log in. You can use the Customer API to check if a customer has an active account, and then invite the customer to create one if they don't.
For security reasons, the Customer resource does not store credit card information. Customers must always enter this information at checkout.
Models
Customer
type Customer {
id: ID!
accountStatus: CustomerAccountStatusEnum
accountStatusUpdatedAt: Timestamp
addresses: [CustomerAddress!]
attributes: [CustomerAttributeValue!]
customerGroupIds: [String!]
customerSegmentIds: [String!]
customerSequence: Float
email: String
emailVerifiedDate: Timestamp
firstName: String!
firstOrderDate: Timestamp
fullName: String
ip: String
isEmailVerified: Boolean
isPhoneVerified: Boolean
lastName: String
lastOrderDate: Timestamp
lastPriceListId: String
lastStorefrontRoutingId: String
note: String
orderCount: Float
passwordUpdateDate: Timestamp
phone: String
phoneVerifiedDate: Timestamp
preferredLanguage: String
priceListId: String
priceListRules: [CustomerPriceListRule!]
registrationSource: CustomerRegistrationSourceEnum
subscriptionStatus: CustomerEmailSubscriptionStatusesEnum
subscriptionStatusUpdatedAt: Timestamp
tagIds: [String!]
totalOrderPrice: Float
userAgent: String
}
Fields
accountStatusCustomerAccountStatusEnumCustomerAccountStatusEnum
accountStatusUpdatedAtTimestampaddresses[CustomerAddress!]A list of the ten most recently updated addresses for the customer.
attributes[CustomerAttributeValue!]customerGroupIds[String!]Groups that the store owner attaches to the customer.
customerSegmentIds[String!]Segments that the customers are belong to.
customerSequenceFloatIt is the sequence value of the customer. The sequence value starts from 1.
emailStringThe unique email address of the customer. Attempting to assign the same email address to multiple customers returns an error.
emailVerifiedDateTimestampThe date the email was verified.
The customer's first name.
firstOrderDateTimestampDate of first order by the customer
fullNameStringCustomer's full name. Firstname plus lastname if firstname and lastname exist. Otherwise, it is saved as firstname only.
ipStringisEmailVerifiedBooleanEmail verification status. isEmailVerified returns true if the email is verified.
isPhoneVerifiedBooleanPhone verification status. isPhoneVerified returns true if the email is verified.
lastNameStringThe customer's last name.
lastOrderDateTimestampDate of last order by the customer
lastPriceListIdStringLast used price list id by the customer
lastStorefrontRoutingIdStringLast used storefront routing id by the customer
noteStringA note about the customer.
orderCountFloatNumber of orders placed by the customer.
passwordUpdateDateTimestampDate the customer last changed their password.
phoneStringThe customer's phone number
phoneVerifiedDateTimestampThe date the email was verified.
preferredLanguageStringpriceListIdStringpriceListRules[CustomerPriceListRule!]registrationSourceCustomerRegistrationSourceEnumRegistration source of customer.
subscriptionStatusCustomerEmailSubscriptionStatusesEnumCustomerEmailSubscriptionStatusesEnum
subscriptionStatusUpdatedAtTimestamptagIds[String!]Tags that the store owner attaches to the customer.
totalOrderPriceFloatAmount of orders by the customer
userAgentStringCustomerAddress
type CustomerAddress {
id: ID!
addressLine1: String!
addressLine2: String
attributes: [CustomerAttributeValue!]
city: CustomerAddressCity!
company: String
country: CustomerAddressCountry!
district: CustomerAddressDistrict
firstName: String!
identityNumber: String
isDefault: Boolean
lastName: String!
phone: String
postalCode: String
region: CustomerAddressRegion
state: CustomerAddressState
taxNumber: String
taxOffice: String
title: String!
}
Fields
The customer's mailing address.
addressLine2StringAn additional field for the customer's mailing address.
attributes[CustomerAttributeValue!]The customer's city.
companyStringThe customer's company.
The customer's country.
districtCustomerAddressDistrictThe customer's district in city.
The customer's first name.
identityNumberStringThe customer's identity numbers.
isDefaultBooleanWhether this address is the default address for the customer. Returns true for each default address.
The customer's last name.
phoneStringThe customer's phone number at this address
postalCodeStringThe customer's postal code, also known as zip, postcode, etc.
regionCustomerAddressRegionstateCustomerAddressStatetaxNumberStringTax number that the customer will use for orders
taxOfficeStringIf customer is corporate, customer can use that field to fill their Tax Office name.
CustomerAddressCountry
type CustomerAddressCountry {
id: String
code: String
iso2: String
iso3: String
name: String!
}
Fields
idStringcodeStringThe two-letter country code corresponding to the customer's country.
iso2StringThe two-letter country code corresponding to the customer's country.
iso3StringThe two-letter country code corresponding to the customer's country.
The customer's normalized country name.
CustomerAddressCity
type CustomerAddressCity {
id: String
code: String
name: String!
}
Fields
idStringcodeStringThe two-letter country code corresponding to the customer's country.
The customer's normalized city name.
CustomerAddressDistrict
type CustomerAddressDistrict {
id: String
code: String
name: String
}
Fields
idStringcodeStringThe two-letter district code corresponding to the customer's district.
nameStringThe customer's normalized district name.
CustomerAddressState
type CustomerAddressState {
id: String
code: String
name: String
}
Fields
idStringcodeStringnameStringQueries
List Customers
listCustomer(
email: StringFilterInput
id: StringFilterInput
merchantId: StringFilterInput
pagination: PaginationInput
phone: StringFilterInput
search: String
sort: String
updatedAt: DateFilterInput
): CustomerPaginationResponse!
Arguments
emailStringFilterInputYou can get the filter response by entering the desired condition for the email.
note
For example email: { eq: aa@gmail.com}
merchantIdStringFilterInputpaginationPaginationInputWith the pagination feature in the data returned as a response, you can filter the data and display the part you want.
phoneStringFilterInputYou can get the filter response by entering the desired condition for the email.
note
For example phone: { eq: 5123456789999}
searchStringSome listing APIs have searchable fields. You can search in these fields as you wish. For example, in an API; Let the searchableFields :['name', 'description']. If we send search: AAA as input in args, it will return records with 'AAA' in both the name and description fields.
sortStringSome listing APIs have sortable fields. Using these fields, the data returned as response has been sorted. For example, in an API; Let it be sortableFields: ['updatedAt']. The data returned as a response will be sorted according to updatedAt.
updatedAtDateFilterInputReturn Type
CustomerPaginationResponseCustomerPaginationResponseExamples
Retrieves a list of customers
- BASH
- NODE.JS
curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"{ listCustomer(merchantId: { eq: \"your_merchant_id\" }) { data { accountStatus accountStatusUpdatedAt createdAt customerGroupIds deleted email emailVerifiedDate firstName id isEmailVerified isPhoneVerified lastName note passwordUpdateDate phone phoneVerifiedDate subscriptionStatus subscriptionStatusUpdatedAt tagIds updatedAt orderCount } } }"}'
const axios = require('axios');
const data = {"query":`{
listCustomer(merchantId: { eq: "your_merchant_id" }) {
data {
accountStatus
accountStatusUpdatedAt
createdAt
customerGroupIds
deleted
email
emailVerifiedDate
firstName
id
isEmailVerified
isPhoneVerified
lastName
note
passwordUpdateDate
phone
phoneVerifiedDate
subscriptionStatus
subscriptionStatusUpdatedAt
tagIds
updatedAt
orderCount
}
}
}
`};
const config = {
method: 'POST',
url: 'https://api.myikas.com/api/v1/admin/graphql',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
if (error.response) {
console.log(JSON.stringify(error.response.data));
}
});
Response
{
"data": {
"listCustomer": {
"data": [
{
"accountStatus": "ACTIVE_ACCOUNT",
"accountStatusUpdatedAt": null,
"createdAt": 1634019877744,
"customerGroupIds": [],
"deleted": false,
"email": "onur@gmail.com",
"emailVerifiedDate": null,
"firstName": "onur",
"id": "a8befae6-2cb9-487a-bd7f-5e0bfff3676b",
"isEmailVerified": false,
"isPhoneVerified": false,
"lastName": "ilkyaz",
"note": null,
"passwordUpdateDate": null,
"phone": "+905554443322",
"phoneVerifiedDate": null,
"subscriptionStatus": "NOT_SUBSCRIBED",
"subscriptionStatusUpdatedAt": null,
"tagIds": [],
"updatedAt": 1634019877744,
"orderCount": 5
}
]
}
}
}