Search.../
  1. REST
Generate a test token to explore our APIs

Update Contact

Updates a contact.

Each time the contact is updated, revision increments by 1. The existing revision must be included when updating the contact. This ensures you're working with the latest contact information, and it prevents unintended overwrites.

Syntax

function UpdateContact(contactId: string, revision: integer, allowDuplicates: boolean, info: _com_wixpress_contacts_core_api_v4_ContactInfo, fieldMask: _google_protobuf_FieldMask): UpdateContact<_com_wixpress_contacts_core_api_v4_UpdateContactResponse>

Update Contact Parameters

NAME
TYPE
DESCRIPTION
contactId
Required
string

ID of the contact to update.

revision
Required
integer

Revision number. When updating, include the existing revision to prevent conflicting updates.

allowDuplicates
boolean

Controls whether the call will succeed if the new contact information contains an email or a phone number already used by another contact.

If set to true, the call will succeed even if an email address or phone number is used by another contact. If set to false, the call will fail if the given email address is used by another contact or, if the email address is not given and the given phone number is used by another contact.

Defaults to false.

info
Required
object

Contact info.

Returns

Updated contact.

Return Type:

object
NAME
TYPE
DESCRIPTION
contact
object

Updated contact.

Was this helpful?

Update Contact

Updates only the given fields (company and addresses).

Request

curl

Copy Code
1curl -X PATCH \
2 'https://www.wixapis.com/contacts/v4/contacts/8046df3c-7575-4098-a5ab-c91ad8f33c47' \
3 -H 'Authorization: <AUTH>' \
4 -H 'Content-Type: application/json' \
5 -d '{
6 "info": {
7 "name": {
8 "first": "Ignored",
9 "last": "Changed"
10 },
11 "company" : "Wix",
12 },
13 "revision": 5,
14 "allowDuplicates": false,
15 "fieldMask": {
16 "paths" : [
17 "info.company",
18 "info.name.last"
19 ]
20 }
21 }'

Response

json

1{"contact": {
2 "id": "8046df3c-7575-4098-a5ab-c91ad8f33c47",
3 "revision": 6,
4 "source": {
5 "sourceType": "WIX_APP",
6 "appId": "9da8bff7-68c9-49d4-8cfd-ba534fd34d68"
7 },
8 "createdDate": "2019-10-30T17:22:10.299Z",
9 "updatedDate": "2020-10-02T08:43:25.765Z",
10 "lastActivity": {
11 "activityDate": "2019-10-30T17:22:10.299Z",
12 "activityType": "CONTACT_CREATED"
13 },
14 "primaryInfo": {
15 "email": "email@example.com",
16 "phone": "097495550"
17 },
18 "picture": {
19 "id": "WixMedia image ID",
20 "url": "https://www.wix.com/contacts-server/api/v1/metasite/avatar/8046df3c-7575-4098-a5ab-c91ad8f33c47/2528bd01086244efb191c1302d986566/",
21 "height": 50,
22 "width": 50
23 },
24 "info": {
25 "name": {
26 "first": "Some",
27 "last": "Changed"
28 },
29 "emails": {"items": [
30 {
31 "id": "d8f0d88c-af92-4237-833f-56aaaa2b5168",
32 "tag": "MAIN",
33 "email": "email@example.com",
34 "primary": true
35 },
36 {
37 "id": "5b430771-e6f1-4bea-9eb5-ad7472270605",
38 "tag": "MAIN",
39 "email": "email2@example.com"
40 }
41 ]},
42 "phones": {"items": [
43 {
44 "id": "e5214c79-af80-4eff-87f2-408b0be4e710",
45 "tag": "HOME",
46 "countryCode": "IL",
47 "phone": "097495550",
48 "e164Phone": "+97297495550",
49 "primary": true
50 },
51 {
52 "id": "59323148-ecf2-4bbe-a7eb-c1b01f43845e ",
53 "tag": "MOBILE",
54 "countryCode": "UA",
55 "phone": "0443955571",
56 "e164Phone": "+380443955571",
57 "primary": false
58 }
59 ]},
60 "addresses": {"items": [
61 {
62 "id": "3f8bba59-150f-4ee7-9c58-632cbdae222c",
63 "tag": "HOME",
64 "address": {
65 "country": "US",
66 "subdivision": "US-ME",
67 "city": "Richmond",
68 "postalCode": "04357",
69 "addressLine": "1772 Fantages Way",
70 "addressLine2": "Apt 17"
71 }
72 },
73 {
74 "id": "be0b1932-e081-46b0-8dfa-a9f2409fa3a8",
75 "tag": "WORK",
76 "address": {
77 "country": "US",
78 "subdivision": "US-ME",
79 "city": "Richmond",
80 "postalCode": "04357",
81 "streetAddress": {
82 "number": "5",
83 "name": "Wingate"
84 },
85 "addressLine2": "the code to the building is: *1234"
86 }
87 }
88 ]},
89 "company": "Wix",
90 "jobTitle": "Developer",
91 "birthdate": "1980-12-01",
92 "locale": "en-us",
93 "labelKeys": {"items": ["custom.label-a"]},
94 "extendedFields": {"items": {
95 "custom.color": "Blue",
96 "custom.number": 12,
97 "custom.date": "2020-01-01",
98 "custom.url": "http://domain.com",
99 "emailSubscriptions.effectiveEmail": "email@example.com",
100 "emailSubscriptions.subscriptionStatus": "NOT_SET",
101 "contacts.displayByFirstName": "Some One",
102 "contacts.displayByLastName": "One Some"
103 }},
104 "locations": {"items": [
105 "d009f926-3273-11eb-adc1-0242ac120002",
106 "cf2ca920-6ac7-451f-a19b-d0382ab3892f",
107 "c5d3ff84-c18c-40c1-b6ac-9e003d6c5643"
108 ]}
109 }
110}}