deleteLabel( )


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

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.

Method Declaration
Copy
function deleteLabel(key: string, options: AuthOptions): Promise<void>;
Method Parameters
keystringRequired

Label key to delete.


optionsAuthOptions

Authorization options.

Delete a label
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myDeleteLabelFunction = webMethod(Permissions.Anyone, () => { const labelKey = "custom.new-lead"; const options = { suppressAuth: false, }; return contacts .deleteLabel(labelKey, options) .then(() => { console.log("Label 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?