Class: CustomersCoreService
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:30
Extends
BaseService
Constructors
Constructor
new CustomersCoreService(
client):CustomersCoreService
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:12
Parameters
client
Returns
CustomersCoreService
Inherited from
BaseService.constructor
Properties
client
protectedclient:TanqoryClient
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:10
Inherited from
BaseService.client
Methods
addNote()
addNote(
customerId,data,storeId?):Promise<{author?:string;createdAt:Date;id:string;note:string; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:329
Add a customer note
Adds an internal note to a customer's profile.
Parameters
customerId
string
Customer ID
data
Note data
note
string
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ author?: string; createdAt: Date; id: string; note: string; }>
Created note
addTimelineComment()
addTimelineComment(
customerId,data,storeId):Promise<{attachments?:object[];author?:string;authorId?:string;authorName?:string;createdAt?:Date;description?:string;editedAt?:Date;id:string;isComment?:boolean;isEdited?:boolean;isSystem?:boolean;mentions?:object[];metadata?:Record<string,unknown>;relatedId?:string;relatedType?:string;storeId?:string;timestamp:Date;title:string;type:"NOTE_ADDED"|"COMMENT"|"GIFT_CARD_ISSUED"|"ORDER_CANCELLED"|"ORDER_EDITED"|"REFUND_ISSUED"|"PASSWORD_CHANGED"|"EMAIL_SENT"|"ORDER_PLACED"|"ORDER_FULFILLED"|"RETURN_REQUESTED"|"RETURN_COMPLETED"|"EXCHANGE_CREATED"|"SMS_SENT"|"NOTE_CHANGED"|"NOTE_REMOVED"|"TAG_ADDED"|"TAG_REMOVED"|"ACCOUNT_CREATED"|"ACCOUNT_ACTIVATED"|"ACCOUNT_DISABLED"|"PASSWORD_RESET_REQUESTED"|"CUSTOMER_MERGED"|"STATUS_CHANGED"|"ADDRESS_ADDED"|"ADDRESS_UPDATED"|"ADDRESS_DELETED"|"MARKETING_SUBSCRIBED"|"MARKETING_UNSUBSCRIBED"|"GIFT_CARD_REDEEMED"|"STORE_CREDIT_ADDED"|"STORE_CREDIT_USED"|"TAX_EXEMPTION_CHANGED"; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:384
Add a comment to customer timeline
Parameters
customerId
string
data
attachments?
object[]
mentions?
object[]
message
string
storeId
string
Returns
Promise<{ attachments?: object[]; author?: string; authorId?: string; authorName?: string; createdAt?: Date; description?: string; editedAt?: Date; id: string; isComment?: boolean; isEdited?: boolean; isSystem?: boolean; mentions?: object[]; metadata?: Record<string, unknown>; relatedId?: string; relatedType?: string; storeId?: string; timestamp: Date; title: string; type: "NOTE_ADDED" | "COMMENT" | "GIFT_CARD_ISSUED" | "ORDER_CANCELLED" | "ORDER_EDITED" | "REFUND_ISSUED" | "PASSWORD_CHANGED" | "EMAIL_SENT" | "ORDER_PLACED" | "ORDER_FULFILLED" | "RETURN_REQUESTED" | "RETURN_COMPLETED" | "EXCHANGE_CREATED" | "SMS_SENT" | "NOTE_CHANGED" | "NOTE_REMOVED" | "TAG_ADDED" | "TAG_REMOVED" | "ACCOUNT_CREATED" | "ACCOUNT_ACTIVATED" | "ACCOUNT_DISABLED" | "PASSWORD_RESET_REQUESTED" | "CUSTOMER_MERGED" | "STATUS_CHANGED" | "ADDRESS_ADDED" | "ADDRESS_UPDATED" | "ADDRESS_DELETED" | "MARKETING_SUBSCRIBED" | "MARKETING_UNSUBSCRIBED" | "GIFT_CARD_REDEEMED" | "STORE_CREDIT_ADDED" | "STORE_CREDIT_USED" | "TAX_EXEMPTION_CHANGED"; }>
buildQuery()
protectedbuildQuery(options?):Record<string,any>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:26
Build query parameters
Parameters
options?
Returns
Record<string, any>
Inherited from
BaseService.buildQuery
bulkAddTags()
bulkAddTags(
storeId,ids,tags):Promise<{success:boolean;updatedCount:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:208
Bulk add tags to customers
Adds tags to multiple customers at once.
Parameters
storeId
string
Store ID
ids
string[]
Array of customer IDs
tags
string[]
Tags to add
Returns
Promise<{ success: boolean; updatedCount: number; }>
Result with updated count
bulkDelete()
bulkDelete(
storeId,ids):Promise<{deletedCount:number;success:boolean; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:186
Bulk delete customers
Permanently deletes multiple customers at once.
Parameters
storeId
string
Store ID
ids
string[]
Array of customer IDs to delete
Returns
Promise<{ deletedCount: number; success: boolean; }>
Deletion result with count
bulkEdit()
bulkEdit(
storeId,customers):Promise<{errors?:object[];failed:number;success:boolean;updated:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:246
Bulk edit customers (heterogeneous per-item updates)
Parameters
storeId
string
customers
object[]
Returns
Promise<{ errors?: object[]; failed: number; success: boolean; updated: number; }>
bulkRemoveTags()
bulkRemoveTags(
storeId,ids,tags):Promise<{success:boolean;updatedCount:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:231
Bulk remove tags from customers
Removes tags from multiple customers at once.
Parameters
storeId
string
Store ID
ids
string[]
Array of customer IDs
tags
string[]
Tags to remove
Returns
Promise<{ success: boolean; updatedCount: number; }>
Result with updated count
create()
create(
data,storeId?):Promise<{addresses:object[];createdAt:Date;currency?:string;defaultAddress?: {address1:string;address2?:string;city:string;company?:string;country:string;firstName:string;id:string;isDefault:boolean;lastName:string;phone?:string;postalCode:string;province:string; };string;emailMarketingConsent:"SUBSCRIBED"|"UNSUBSCRIBED"|"NOT_SUBSCRIBED";firstName:string;id:string;language?:string;lastName:string;market?:string;note?:string;phone?:string;rfmSegment?:"CHAMPIONS"|"LOYAL"|"POTENTIAL_LOYALISTS"|"NEW_CUSTOMERS"|"PROMISING"|"NEED_ATTENTION"|"AT_RISK"|"CANT_LOSE"|"HIBERNATING"|"LOST";smsMarketingConsent:"SUBSCRIBED"|"UNSUBSCRIBED"|"NOT_SUBSCRIBED";stats?: {averageOrderValue:number;lastOrderDate?:Date;lastOrderId?:string;ordersCount:number;totalSpent:number; };status:"DISABLED"|"ACTIVE"|"DECLINED";tags:string[];taxExempt:"PENDING"|"NONE"|"EXEMPT";updatedAt:Date; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:80
Create a new customer
Creates a new customer record with optional addresses, marketing consent, tax exemptions, and custom metadata.
Parameters
data
Customer creation data
currency?
string
defaultAddress?
{ address1: string; address2?: string; city: string; company?: string; country: string; firstName: string; isDefault: boolean; lastName: string; phone?: string; postalCode: string; province: string; }
defaultAddress.address1
string
defaultAddress.address2?
string
defaultAddress.city
string
defaultAddress.company?
string
defaultAddress.country
string
defaultAddress.firstName
string
defaultAddress.isDefault
boolean
defaultAddress.lastName
string
defaultAddress.phone?
string
defaultAddress.postalCode
string
defaultAddress.province
string
email
string
emailMarketingConsent?
"SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"
firstName
string
language?
string
lastName
string
market?
string
metafields?
object[]
note?
string
phone?
string
smsMarketingConsent?
"SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"
tags?
string[]
taxExempt?
"PENDING" | "NONE" | "EXEMPT"
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ addresses: object[]; createdAt: Date; currency?: string; defaultAddress?: { address1: string; address2?: string; city: string; company?: string; country: string; firstName: string; id: string; isDefault: boolean; lastName: string; phone?: string; postalCode: string; province: string; }; email: string; emailMarketingConsent: "SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"; firstName: string; id: string; language?: string; lastName: string; market?: string; note?: string; phone?: string; rfmSegment?: "CHAMPIONS" | "LOYAL" | "POTENTIAL_LOYALISTS" | "NEW_CUSTOMERS" | "PROMISING" | "NEED_ATTENTION" | "AT_RISK" | "CANT_LOSE" | "HIBERNATING" | "LOST"; smsMarketingConsent: "SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"; stats?: { averageOrderValue: number; lastOrderDate?: Date; lastOrderId?: string; ordersCount: number; totalSpent: number; }; status: "DISABLED" | "ACTIVE" | "DECLINED"; tags: string[]; taxExempt: "PENDING" | "NONE" | "EXEMPT"; updatedAt: Date; }>
Created customer
delete()
delete(
id,storeId?):Promise<{deleted:true;id:string;object:"customer"; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:122
Delete a customer
Permanently deletes a customer and all associated data. This action cannot be undone.
Parameters
id
string
Customer ID
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ deleted: true; id: string; object: "customer"; }>
Deletion confirmation
deleteTimelineComment()
deleteTimelineComment(
customerId,commentId,storeId):Promise<{deleted:true;id:string;object:"customer_timeline_comment"; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:415
Delete a comment from customer timeline
Parameters
customerId
string
commentId
string
storeId
string
Returns
Promise<{ deleted: true; id: string; object: "customer_timeline_comment"; }>
editTimelineComment()
editTimelineComment(
customerId,commentId,data,storeId):Promise<{attachments?:object[];author?:string;authorId?:string;authorName?:string;createdAt?:Date;description?:string;editedAt?:Date;id:string;isComment?:boolean;isEdited?:boolean;isSystem?:boolean;mentions?:object[];metadata?:Record<string,unknown>;relatedId?:string;relatedType?:string;storeId?:string;timestamp:Date;title:string;type:"NOTE_ADDED"|"COMMENT"|"GIFT_CARD_ISSUED"|"ORDER_CANCELLED"|"ORDER_EDITED"|"REFUND_ISSUED"|"PASSWORD_CHANGED"|"EMAIL_SENT"|"ORDER_PLACED"|"ORDER_FULFILLED"|"RETURN_REQUESTED"|"RETURN_COMPLETED"|"EXCHANGE_CREATED"|"SMS_SENT"|"NOTE_CHANGED"|"NOTE_REMOVED"|"TAG_ADDED"|"TAG_REMOVED"|"ACCOUNT_CREATED"|"ACCOUNT_ACTIVATED"|"ACCOUNT_DISABLED"|"PASSWORD_RESET_REQUESTED"|"CUSTOMER_MERGED"|"STATUS_CHANGED"|"ADDRESS_ADDED"|"ADDRESS_UPDATED"|"ADDRESS_DELETED"|"MARKETING_SUBSCRIBED"|"MARKETING_UNSUBSCRIBED"|"GIFT_CARD_REDEEMED"|"STORE_CREDIT_ADDED"|"STORE_CREDIT_USED"|"TAX_EXEMPTION_CHANGED"; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:399
Edit a comment in customer timeline
Parameters
customerId
string
commentId
string
data
message
string
storeId
string
Returns
Promise<{ attachments?: object[]; author?: string; authorId?: string; authorName?: string; createdAt?: Date; description?: string; editedAt?: Date; id: string; isComment?: boolean; isEdited?: boolean; isSystem?: boolean; mentions?: object[]; metadata?: Record<string, unknown>; relatedId?: string; relatedType?: string; storeId?: string; timestamp: Date; title: string; type: "NOTE_ADDED" | "COMMENT" | "GIFT_CARD_ISSUED" | "ORDER_CANCELLED" | "ORDER_EDITED" | "REFUND_ISSUED" | "PASSWORD_CHANGED" | "EMAIL_SENT" | "ORDER_PLACED" | "ORDER_FULFILLED" | "RETURN_REQUESTED" | "RETURN_COMPLETED" | "EXCHANGE_CREATED" | "SMS_SENT" | "NOTE_CHANGED" | "NOTE_REMOVED" | "TAG_ADDED" | "TAG_REMOVED" | "ACCOUNT_CREATED" | "ACCOUNT_ACTIVATED" | "ACCOUNT_DISABLED" | "PASSWORD_RESET_REQUESTED" | "CUSTOMER_MERGED" | "STATUS_CHANGED" | "ADDRESS_ADDED" | "ADDRESS_UPDATED" | "ADDRESS_DELETED" | "MARKETING_SUBSCRIBED" | "MARKETING_UNSUBSCRIBED" | "GIFT_CARD_REDEEMED" | "STORE_CREDIT_ADDED" | "STORE_CREDIT_USED" | "TAX_EXEMPTION_CHANGED"; }>
generateIdempotencyKey()
protectedgenerateIdempotencyKey(prefix):string
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:19
Generate idempotency key
Parameters
prefix
string
Returns
string
Inherited from
BaseService.generateIdempotencyKey
getAllTags()
getAllTags(
storeId,params?):Promise<any>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:484
Get all customer tags (paginated) API: GET /stores/:storeId/customers/tags/all
Parameters
storeId
string
params?
limit?
number
page?
number
Returns
Promise<any>
getCounts()
getCounts(
storeId):Promise<{acceptsMarketing:number;all:number;hasOrders:number;new:number;noOrders:number;returning:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:141
Get customer counts by status
Returns counts for different customer categories including all customers, new customers, returning customers, and marketing consent status.
Parameters
storeId
string
Store ID
Returns
Promise<{ acceptsMarketing: number; all: number; hasOrders: number; new: number; noOrders: number; returning: number; }>
Customer counts by category
getCountsTimeseries()
getCountsTimeseries(
storeId,params):Promise<{all:object[];marketing:object[];newCustomers:object[];returning:object[]; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:155
Get customer counts time-series data
Parameters
storeId
string
params
from
string
groupBy?
"day" | "week" | "month"
to
string
Returns
Promise<{ all: object[]; marketing: object[]; newCustomers: object[]; returning: object[]; }>
getExportMimeType()
protectedgetExportMimeType(format):string
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:45
Get MIME type for export format
Parameters
format
string
Returns
string
Inherited from
BaseService.getExportMimeType
getNotes()
getNotes(
customerId,storeId?):Promise<{notes:object[]; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:352
Get customer notes
Retrieves all internal notes for a customer.
Parameters
customerId
string
Customer ID
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ notes: object[]; }>
List of customer notes
getOrders()
getOrders(
customerId,params?,storeId?):Promise<{data:object[];limit:number;page:number;total:number;total_pages:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:437
Get customer orders
Retrieves all orders placed by a customer.
Parameters
customerId
string
Customer ID
params?
Query parameters for filtering and pagination
limit?
number
page?
number
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ data: object[]; limit: number; page: number; total: number; total_pages: number; }>
Paginated list of customer orders
getTagSuggestions()
getTagSuggestions(
storeId,params?):Promise<string[]>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:474
Get tag suggestions for autocomplete API: GET /stores/:storeId/customers/tags/suggestions
Parameters
storeId
string
params?
search?
string
Returns
Promise<string[]>
getTimeline()
getTimeline(
customerId,storeId?):Promise<{timeline:object[]; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:374
Get customer timeline
Retrieves a chronological timeline of all customer activities including orders, notes, emails, and account changes.
Parameters
customerId
string
Customer ID
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ timeline: object[]; }>
Customer timeline events
importCustomers()
importCustomers(
storeId,data):Promise<any>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:496
Import customers from CSV API: POST /stores/:storeId/customers/import
Parameters
storeId
string
data
FormData
Returns
Promise<any>
list()
list(
storeId?,params?):Promise<{data:object[];limit:number;page:number;total:number;total_pages:number; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:46
List all customers
Returns a paginated list of customers with advanced filtering options including search, status, tags, marketing consent, spending, and more.
Parameters
storeId?
string
Store ID (optional, uses current store if not provided)
params?
Query parameters for filtering, sorting, and pagination
acceptsMarketing?
boolean
createdAfter?
string
createdBefore?
string
limit?
number
maxOrders?
number
maxSpent?
number
minOrders?
number
minSpent?
number
page?
number
search?
string
segment?
string
sortBy?
string
sortOrder?
"asc" | "desc"
status?
string
tags?
string[]
Returns
Promise<{ data: object[]; limit: number; page: number; total: number; total_pages: number; }>
Paginated list of customers with metadata
mergeCustomers()
mergeCustomers(
storeId,data):Promise<{archivedCustomerId:string;mergedCustomer: {billingAddress?: {city:string;country:string;line1?:string;line2?:string;postalCode:string;state?:string;street:string; };createdAt:Date;string;firstName?:string;id:string;lastName?:string;metadata?:Record<string,unknown>;phone?:string;shippingAddress?: {city:string;country:string;line1?:string;line2?:string;postalCode:string;state?:string;street:string; };status:CustomerStatus;storeId:string;updatedAt:Date; };mergeDetails: {addressesTransferred:number;draftOrdersTransferred:number;metafieldsTransferred:number;notesTransferred:number;ordersTransferred:number;tagsAdded:number;timelineEventsTransferred:number; };success:boolean; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:282
Merge two customers into one
Combines two customer profiles. The primary customer keeps their data, while the secondary customer's orders, addresses, notes, tags, metafields, and timeline events are transferred. The secondary customer is archived.
Parameters
storeId
string
Store ID
data
Merge configuration
overrides?
{ useSecondaryFirstName?: boolean; useSecondaryLastName?: boolean; useSecondaryNote?: boolean; useSecondaryPhone?: boolean; }
overrides.useSecondaryFirstName?
boolean
overrides.useSecondaryLastName?
boolean
overrides.useSecondaryNote?
boolean
overrides.useSecondaryPhone?
boolean
primaryCustomerId
string
secondaryCustomerId
string
Returns
Promise<{ archivedCustomerId: string; mergedCustomer: { billingAddress?: { city: string; country: string; line1?: string; line2?: string; postalCode: string; state?: string; street: string; }; createdAt: Date; email: string; firstName?: string; id: string; lastName?: string; metadata?: Record<string, unknown>; phone?: string; shippingAddress?: { city: string; country: string; line1?: string; line2?: string; postalCode: string; state?: string; street: string; }; status: CustomerStatus; storeId: string; updatedAt: Date; }; mergeDetails: { addressesTransferred: number; draftOrdersTransferred: number; metafieldsTransferred: number; notesTransferred: number; ordersTransferred: number; tagsAdded: number; timelineEventsTransferred: number; }; success: boolean; }>
Merge result with details
retrieve()
retrieve(
id,storeId?):Promise<{addresses:object[];createdAt:Date;currency?:string;defaultAddress?: {address1:string;address2?:string;city:string;company?:string;country:string;firstName:string;id:string;isDefault:boolean;lastName:string;phone?:string;postalCode:string;province:string; };string;emailMarketingConsent:"SUBSCRIBED"|"UNSUBSCRIBED"|"NOT_SUBSCRIBED";firstName:string;id:string;language?:string;lastName:string;market?:string;note?:string;phone?:string;rfmSegment?:"CHAMPIONS"|"LOYAL"|"POTENTIAL_LOYALISTS"|"NEW_CUSTOMERS"|"PROMISING"|"NEED_ATTENTION"|"AT_RISK"|"CANT_LOSE"|"HIBERNATING"|"LOST";smsMarketingConsent:"SUBSCRIBED"|"UNSUBSCRIBED"|"NOT_SUBSCRIBED";stats?: {averageOrderValue:number;lastOrderDate?:Date;lastOrderId?:string;ordersCount:number;totalSpent:number; };status:"DISABLED"|"ACTIVE"|"DECLINED";tags:string[];taxExempt:"PENDING"|"NONE"|"EXEMPT";updatedAt:Date; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:64
Get a single customer
Retrieves detailed information about a specific customer including addresses, notes, order history, and analytics.
Parameters
id
string
Customer ID
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ addresses: object[]; createdAt: Date; currency?: string; defaultAddress?: { address1: string; address2?: string; city: string; company?: string; country: string; firstName: string; id: string; isDefault: boolean; lastName: string; phone?: string; postalCode: string; province: string; }; email: string; emailMarketingConsent: "SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"; firstName: string; id: string; language?: string; lastName: string; market?: string; note?: string; phone?: string; rfmSegment?: "CHAMPIONS" | "LOYAL" | "POTENTIAL_LOYALISTS" | "NEW_CUSTOMERS" | "PROMISING" | "NEED_ATTENTION" | "AT_RISK" | "CANT_LOSE" | "HIBERNATING" | "LOST"; smsMarketingConsent: "SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"; stats?: { averageOrderValue: number; lastOrderDate?: Date; lastOrderId?: string; ordersCount: number; totalSpent: number; }; status: "DISABLED" | "ACTIVE" | "DECLINED"; tags: string[]; taxExempt: "PENDING" | "NONE" | "EXEMPT"; updatedAt: Date; }>
Customer details
sendMarketingEmail()
sendMarketingEmail(
storeId,data):Promise<{message:string;sentCount:number;success:boolean; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:515
Send marketing email to selected customers
Parameters
storeId
string
Store ID
data
Email data with customer IDs, subject, and message
fromName?
string
ids
string[]
message
string
subject
string
Returns
Promise<{ message: string; sentCount: number; success: boolean; }>
Send result with count
update()
update(
id,data,storeId?):Promise<{addresses:object[];createdAt:Date;currency?:string;defaultAddress?: {address1:string;address2?:string;city:string;company?:string;country:string;firstName:string;id:string;isDefault:boolean;lastName:string;phone?:string;postalCode:string;province:string; };string;emailMarketingConsent:"SUBSCRIBED"|"UNSUBSCRIBED"|"NOT_SUBSCRIBED";firstName:string;id:string;language?:string;lastName:string;market?:string;note?:string;phone?:string;rfmSegment?:"CHAMPIONS"|"LOYAL"|"POTENTIAL_LOYALISTS"|"NEW_CUSTOMERS"|"PROMISING"|"NEED_ATTENTION"|"AT_RISK"|"CANT_LOSE"|"HIBERNATING"|"LOST";smsMarketingConsent:"SUBSCRIBED"|"UNSUBSCRIBED"|"NOT_SUBSCRIBED";stats?: {averageOrderValue:number;lastOrderDate?:Date;lastOrderId?:string;ordersCount:number;totalSpent:number; };status:"DISABLED"|"ACTIVE"|"DECLINED";tags:string[];taxExempt:"PENDING"|"NONE"|"EXEMPT";updatedAt:Date; }>
Defined in: tanqory-platform-packages/packages/api/sdk/src/services/customers-core.ts:100
Update a customer
Updates customer information including personal details, marketing consent, tax exemptions, and metadata.
Parameters
id
string
Customer ID
data
Customer update data
currency?
string
defaultAddress?
{ address1: string; address2?: string; city: string; company?: string; country: string; firstName: string; isDefault: boolean; lastName: string; phone?: string; postalCode: string; province: string; }
defaultAddress.address1
string
defaultAddress.address2?
string
defaultAddress.city
string
defaultAddress.company?
string
defaultAddress.country
string
defaultAddress.firstName
string
defaultAddress.isDefault
boolean
defaultAddress.lastName
string
defaultAddress.phone?
string
defaultAddress.postalCode
string
defaultAddress.province
string
email?
string
emailMarketingConsent?
"SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"
firstName?
string
language?
string
lastName?
string
market?
string
metafields?
object[]
note?
string
phone?
string
smsMarketingConsent?
"SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"
status?
"DISABLED" | "ACTIVE" | "DECLINED"
tags?
string[]
taxExempt?
"PENDING" | "NONE" | "EXEMPT"
storeId?
string
Store ID (optional, uses current store if not provided)
Returns
Promise<{ addresses: object[]; createdAt: Date; currency?: string; defaultAddress?: { address1: string; address2?: string; city: string; company?: string; country: string; firstName: string; id: string; isDefault: boolean; lastName: string; phone?: string; postalCode: string; province: string; }; email: string; emailMarketingConsent: "SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"; firstName: string; id: string; language?: string; lastName: string; market?: string; note?: string; phone?: string; rfmSegment?: "CHAMPIONS" | "LOYAL" | "POTENTIAL_LOYALISTS" | "NEW_CUSTOMERS" | "PROMISING" | "NEED_ATTENTION" | "AT_RISK" | "CANT_LOSE" | "HIBERNATING" | "LOST"; smsMarketingConsent: "SUBSCRIBED" | "UNSUBSCRIBED" | "NOT_SUBSCRIBED"; stats?: { averageOrderValue: number; lastOrderDate?: Date; lastOrderId?: string; ordersCount: number; totalSpent: number; }; status: "DISABLED" | "ACTIVE" | "DECLINED"; tags: string[]; taxExempt: "PENDING" | "NONE" | "EXEMPT"; updatedAt: Date; }>
Updated customer