customerCreate
mutation
Requires write_customers access scope.
An access token is required to call this API. Refer to Authorization for more information about how to obtain the token.
Create a new customer
Arguments
Input field for creating customers
Return
The created customer.
Error message
Status and error codes
For detailed information about common codes, see Status and error codes.
Example
Create a new customer
Code
{
"input": {
"addresses": [
{
"address1": "Chestnut Street 92",
"address2": "Apartment 2",
"city": "Louisville",
"company": "C*****",
"country": "United States",
"countryCode": "US",
"firstName": "S*****",
"lastName": "T*****",
"phone": "0086185****1234",
"province": "Kentucky",
"provinceCode": "4200021",
"zip": "40202",
"district":"district",
"town":"Street"
}
],
"email": "******@example.com",
"emailMarketingConsent": {
"consentUpdatedAt": null,
"marketingState": "SUBSCRIBED"
},
"firstName": "S*****",
"lastName": "T*****",
"note": "Placed an order that had a fraud warning",
"phone": "0086185****1234",
"smsMarketingConsent": {
"consentUpdatedAt": null,
"marketingState": "SUBSCRIBED"
},
"tags": [
"test1"
],
"taxExempt":true,
"taxExemptions": [
{
"countryCode":"US",
"provinceGCodeList":["AL","AK"]
}
]
}
}
Response
{
"data": {
"customerCreate": {
"customer": {
"addresses": [
{
"zip": "40202",
"countryCodeV2": "US",
"firstName": "S*****",
"phone": "0086185****1234",
"province": "Kentucky",
"town": "Street",
"address1": "Chestnut Street 92",
"address2": "Apartment 2",
"district": "district",
"id": "gid://shopline/MailingAddress/SL201UA6288180448515858676",
"provinceCode": null,
"city": "Louisville",
"lastName": "T****",
"company": "C*****",
"country": "United States"
}
],
"firstName": "S*****",
"note": "Placed an order that had a fraud warning",
"tags": [
"test1"
],
"taxExempt": true,
"taxExemptions": [
{
"countryCode": "US",
"provinceGCodeList": [
"AL",
"AK"
]
}
],
"verifiedEmail": false,
"createdAt": "2024-01-13T08:01:09.761Z",
"defaultAddress": {
"town": "Street",
"city": "Louisville",
"countryCodeV2": "US",
"province": "Kentucky",
"company": "C*****",
"district": "district",
"id": "gid://shopline/MailingAddress/SL201UA6288180448515858676",
"lastName": "T*****",
"phone": "0086185****1234",
"address1": "Chestnut Street 92",
"address2": "Apartment 2",
"country": "United States",
"firstName": "S*****",
"provinceCode": null,
"zip": "40202"
},
"email": "******@example.com",
"id": "gid://shopline/Customer/4600508354",
"lastName": "T*****",
"phone": "0086185****1234",
"updatedAt": "2024-01-13T08:01:10.541Z"
},
"userErrors": null
}
}
}
Was this article helpful to you?