When a new visitor first shares some of their contact information with your site, they're added to your Contact List. Once that happens, their details are available through the Contacts API.
Some examples of how a person can become a contact are:
- A site visitor fills in a form with their contact details.
- A site visitor signs up as a member of the site.
- A site collaborator imports a contact or adds a contact manually.
- A 3rd-party app creates a contact with the Contacts API.
Learn more about how you can manage your contact list.
With the Contacts APIs, you can:
- Manage site contacts.
- Manage contact labels.
- Manage extended field definitions.
Creates a new contact.
The createContact()
function returns a Promise
that resolves to the new contact when it is created.
The info
parameter object must include a name, phone number, or email address.
If all 3 of these parameters are missing,
the contact won't be created.
By default,
if the call contains an email already in use by another contact,
the new contact won't be created.
To override this behavior,
set allowDuplicates
in the options
object to true
.
Deletes a contact who is not a site member or contributor.
The deleteContact()
function returns a Promise
that resolves when the specified contact is deleted.
Deleting a contact permanently removes them from your Contact List.
If the contact is also a site member, the member must be deleted first, and then the contact can be deleted.
Retrieves a contact.
The getContact()
function returns a Promise
that resolves when the contact is found.
Getting Merged Contacts
When a source contact is merged
with a target contact, the source contact is deleted.
When calling getContact()
for a merged contact,
you can use the source or target contact ID.
In both cases, the target contact is returned.
This is supported only when calling getContact()
,
and only for merged contacts.
Deleted source contact IDs are not supported on any other function.
Permission Scopes
For app development, you must have one of the following permission scopes:Adds labels to a contact.
The labelContact()
function returns a Promise
that resolves when the specified labels are added to the contact.
- To create new labels: Use
findOrCreateLabel()
. - To find labels: Use
findOrCreateLabel()
,getLabel()
, orqueryLabels()
.
Merges source contacts into a target contact.
Merging contacts has these effects on the target contact:
- No target contact data is overwritten or deleted.
- Arrays (emails, phones, addresses, and labels) are merged from the source contacts.
- If merging more than one source contact, the 1st source is given precedence, then the 2nd, and so on.
Important: Merges cannot be undone. Use Preview Merge Contacts to test before merging.
Source contacts are deleted when merging. However, if a source contact is a site member or contributor, the merge fails because site contributors and members can't be deleted. Site members and contributors can be target contacts only.
After merging, if you call Get Contact with a deleted source contact ID, the target contact ID is returned. This is supported when calling Get Contact only. Deleted source contact IDs are not supported on any other endpoint.
Merging contacts triggers these webhooks:
- Contact Merged is triggered.
- Contact Updated is triggered for the target contact.
originatedFrom
is set tomerge
. - Contact Deleted is triggered for each source contact.
originatedFrom
is set tomerge
.
This function is not a universal function and runs only on the backend.
Permission Scopes
For app development, you must have one of the following permission scopes:Removes labels from a contact.
The unlabelContact()
function returns a Promise
that resolves when the specified labels are removed from the contact.
If a label is no longer needed
and you want to remove it from all contacts,
you can delete it with Labels
deleteLabel()
.
Updates a contact's properties.
The updateContact()
function returns a Promise that resolves
when the specified contact's information is updated.
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.