Skip to main content

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

idID!required

CustomerAccountStatusEnum

accountStatusUpdatedAtTimestamp

A list of the ten most recently updated addresses for the customer.

customerGroupIds[String!]

Groups that the store owner attaches to the customer.

customerSegmentIds[String!]

Segments that the customers are belong to.

customerSequenceFloat

It is the sequence value of the customer. The sequence value starts from 1.

emailString

The unique email address of the customer. Attempting to assign the same email address to multiple customers returns an error.

emailVerifiedDateTimestamp

The date the email was verified.

firstNameString!required

The customer's first name.

firstOrderDateTimestamp

Date of first order by the customer

fullNameString

Customer's full name. Firstname plus lastname if firstname and lastname exist. Otherwise, it is saved as firstname only.

isEmailVerifiedBoolean

Email verification status. isEmailVerified returns true if the email is verified.

isPhoneVerifiedBoolean

Phone verification status. isPhoneVerified returns true if the email is verified.

lastNameString

The customer's last name.

lastOrderDateTimestamp

Date of last order by the customer

lastPriceListIdString

Last used price list id by the customer

lastStorefrontRoutingIdString

Last used storefront routing id by the customer

noteString

A note about the customer.

orderCountFloat

Number of orders placed by the customer.

passwordUpdateDateTimestamp

Date the customer last changed their password.

phoneString

The customer's phone number

phoneVerifiedDateTimestamp

The date the email was verified.

preferredLanguageString
priceListIdString

Registration source of customer.

CustomerEmailSubscriptionStatusesEnum

subscriptionStatusUpdatedAtTimestamp
tagIds[String!]

Tags that the store owner attaches to the customer.

totalOrderPriceFloat

Amount of orders by the customer

userAgentString

CustomerAddress

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

idID!required
addressLine1String!required

The customer's mailing address.

addressLine2String

An additional field for the customer's mailing address.

The customer's city.

companyString

The customer's company.

The customer's country.

The customer's district in city.

firstNameString!required

The customer's first name.

identityNumberString

The customer's identity numbers.

isDefaultBoolean

Whether this address is the default address for the customer. Returns true for each default address.

lastNameString!required

The customer's last name.

phoneString

The customer's phone number at this address

postalCodeString

The customer's postal code, also known as zip, postcode, etc.

taxNumberString

Tax number that the customer will use for orders

taxOfficeString

If customer is corporate, customer can use that field to fill their Tax Office name.

titleString!required

CustomerAddressCountry

type CustomerAddressCountry {
id: String
code: String
iso2: String
iso3: String
name: String!
}

Fields

codeString

The two-letter country code corresponding to the customer's country.

iso2String

The two-letter country code corresponding to the customer's country.

iso3String

The two-letter country code corresponding to the customer's country.

nameString!required

The customer's normalized country name.

CustomerAddressCity

type CustomerAddressCity {
id: String
code: String
name: String!
}

Fields

codeString

The two-letter country code corresponding to the customer's country.

nameString!required

The customer's normalized city name.

CustomerAddressDistrict

type CustomerAddressDistrict {
id: String
code: String
name: String
}

Fields

codeString

The two-letter district code corresponding to the customer's district.

nameString

The customer's normalized district name.

CustomerAddressState

type CustomerAddressState {
id: String
code: String
name: String
}

Fields

codeString
nameString

Queries

List Customers

listCustomer(
email: StringFilterInput
id: StringFilterInput
merchantId: StringFilterInput
pagination: PaginationInput
phone: StringFilterInput
search: String
sort: String
updatedAt: DateFilterInput
): CustomerPaginationResponse!

Arguments

You can get the filter response by entering the desired condition for the email.

note

For example email: { eq: aa@gmail.com}

paginationPaginationInput

With the pagination feature in the data returned as a response, you can filter the data and display the part you want.

You can get the filter response by entering the desired condition for the email.

note

For example phone: { eq: 5123456789999}

searchString

Some 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.

sortString

Some 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.

Return Type

CustomerPaginationResponseCustomerPaginationResponse

Examples

Retrieves a list of customers

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 } } }"}'

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
}
]
}
}
}