Update customer attributes

patch/v1/customers/{id}
Requires any one of these rolesAbout roles
org.permission.customer.update
Legacyorg.user.customer.write

The API key or user must hold at least one of them. Legacy roles still work; prefer the others for new keys.

Updates customer attributes.

Note

This endpoint is subject to Object Rate Limiting, which limits how many updates single user can make to a single customer. To learn more, see Rate limiting.

Company

If you omit the company, the customer will no longer be linked to the company.

Custom Attributes

Custom attributes are optional and allow you to specify custom key-value pairs.

Kustomer uses a naming convention for custom attributes to specify the field data type with a name suffix:

Naming Suffix

  • Num number or null
  • At date-time or null
  • Str string or null, length: [ 0 .. 1024 ] characters
  • Txt string or null, length: [ 0 .. 1024 ] characters
  • Bool boolean or null
  • Url string or null, format: uri
About this resource

Customers

A customer is one person your team supports. Every conversation, message, note and custom object about that person hangs off their customer record, and agents see it all on a single timeline.

Kustomer is organized around the customer rather than the ticket. When someone emails, chats or calls for the first time, Kustomer creates a customer for them and matches later contact on the same email address, phone number or social handle back to that record. In the agent desktop the customer is the profile and the timeline of everything that has happened with them: conversations, orders and other custom objects, and tracked events. You can also create customers yourself, usually to sync people from your own database or CRM before they ever contact support.

Identifiers and matching

A customer carries several kinds of contact identifiers, each a list of objects with a type and an optional verified flag: emails, phones, whatsapps, socials and externalIds. Values in these lists must be unique across your org, because Kustomer uses them to route new inbound messages to the right person; a write that would give a second customer the same email, phone or external ID is rejected. When people genuinely share a contact point, such as a family email address, use sharedEmails, sharedPhones, sharedSocials or sharedExternalIds, which have no uniqueness rule.

externalId is a shortcut for your own ID for the person. Set it on create and you can look the customer up later by it, which makes syncs idempotent. You can also look customers up by email or phone.

What the record holds

Besides name, contact identifiers, locations, locale, timeZone and tags, a customer has a company (the company they belong to) and custom attributes under custom. Kustomer maintains several read-only summaries for you: conversationCounts (open, snoozed, done and all), lastConversation, lastMessageIn, lastActivityAt and preview, a snippet of the latest message.

Merging duplicates

Duplicates happen, for example when the same person writes from a work and a personal email. A merge combines a source customer into a target. Conversations, messages, notes and custom objects move to the target; contact identifiers, tags and custom attributes are combined (the target wins when both have the same custom attribute); and the source is deleted. A merge reports status as pending, running, success or error. Merging a customer into itself, or starting a merge while another one for the same pair is in progress, fails with 409 Conflict. There is no unmerge endpoint.

Which endpoint to use

To Call
Create, read, update or delete one customer POST /v1/customers, GET, PUT, PATCH or DELETE /v1/customers/{id}
Find a customer by your own ID GET /v1/customers/externalId={externalId}
Find a customer by contact details GET /v1/customers/email={email} or GET /v1/customers/phone={phone}
Page through customers by created or updated date GET /v1/customers
Import, update or delete up to 100 customers per request POST, PUT or DELETE /v1/customers/bulk
Merge a duplicate into another customer POST /v1/customers/merges
Check a merge, or list a customer's merges GET /v1/customers/merges/{id} or GET /v1/customers/{id}/merges

PUT merges the attributes you send into the record unless you add replace=true, but leaving out company unlinks the customer from their company, so always resend it. PATCH also accepts a JSON Patch body (Content-Type: application/json-patch+json), which is handy for appending one email or phone without resending the list; pass rev to make the write depend on the revision you last read. Customer updates are subject to object limits. GET /v1/customers only filters on createdAt and updatedAt; use search for anything richer. Bulk requests run asynchronously, as described in Bulk operations.

Path parameters

idstringrequired
Example "5f8efdd5d3de932f344ca367"

Query parameters

revnumber
Example 37

Request body

application/jsonrequired
namestringnullable
max length 256
companystringnullable
externalIdstringnullable
min length 1 · max length 256
usernamestringnullable
max length 256
signedUpAtstring<date-time>nullable
lastActivityAtstring<date-time>nullable
lastCustomerActivityAtstring<date-time>nullable
lastSeenAtstring<date-time>nullable
avatarUrlstring<uri>nullable
array<external_id>
max items 10 · unique items
array<external_id>
max items 10 · unique items
array<email>
max items 10 · unique items
array<email>
max items 10 · unique items
array<phone>
max items 10 · unique items
array<phone>
max items 10 · unique items
array<whatsapp>
max items 10 · unique items
array<facebook_id>
max items 10 · unique items
array<instagram_id>
max items 10 · unique items
array<social>
max items 10 · unique items
array<social>
max items 10 · unique items
array<url>
max items 10 · unique items
array<location>
max items 10 · unique items
localestringnullable
max length 16
timeZonestringnullable
max length 64
tagsarray<tag_name>
max items 20 · unique items
objectsentiment
customobjectcustom_attrs
birthdayAtstring<date-time>nullable
genderstringnullable
One of"m""f"
createdAtstring<date-time>
importedAtstring<date-time>
revnumber
defaultLangstringlangnullable
max length 100

Responses

OK

objectrequired