Search.../

deleteLabel( )

Deletes a label from the site and removes it from contacts it applies to.

Description

The deleteLabel() function returns a Promise that resolves when the specified label is deleted.

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

Syntax

function deleteLabel(key: string, [options: AuthOptions]): Promise<void>

deleteLabel Parameters

NAME
TYPE
DESCRIPTION
key
string

Label key to delete.

options
Optional
AuthOptions

Authorization options.

Returns

Return Type:

Promise<void>

Was this helpful?

Delete a label

Copy Code
1import { contacts } from 'wix-crm-backend';
2
3export function myDeleteLabelFunction() {
4 const labelKey = "custom.new-lead";
5 const options = {
6 suppressAuth: false
7 };
8
9 return contacts.deleteLabel(labelKey, options)
10 .then(() => {
11 console.log("Label deleted");
12 })
13 .catch((error) => {
14 console.error(error);
15 });
16}