deleteContact( )


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.

Note: This function replaces the deprecated wixCrmBackend.deleteContact(). The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.

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.

Note: Only visitors with Manage Contacts permissions can delete contacts. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function deleteContact(contactId: string, options: AuthOptions): Promise<void>;
Method Parameters
contactIdstringRequired

ID of the contact to delete.


optionsAuthOptions

Authorization options.

Delete a contact
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myDeleteContactFunction = webMethod(Permissions.Anyone, () => { const contactId = "43fd5f9e-d7d4-4a31-8bfc-3bdc180cc40a"; const options = { suppressAuth: false, }; return contacts .deleteContact(contactId, options) .then(() => { console.log("Contact deleted"); }) .catch((error) => { console.error(error); }); });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?