Search.../

deleteEvent( )

Deletes a Wix event.

Description

The deleteEvent() function returns a Promise that resolves when the specified Wix event is deleted.

Any event can be deleted regardless of its status or if attendees are registered.

Deleted events are not returned by the getEvent() or queryEvent() functions.

Only those with "Manage Events" permissions can delete Wix events.

Note: This function requires elevated permissions to run.

This function is not universal and runs only on the backend.

Syntax

function deleteEvent(eventId: string): Promise<void>

deleteEvent Parameters

NAME
TYPE
DESCRIPTION
eventId
string

Event ID.

Returns

Fulfilled - When the event is deleted. Rejected - Error message.

Return Type:

Promise<void>

Related Content:

Was this helpful?

Delete a Wix event

Copy Code
1import { wixEvents } from "wix-events-backend";
2import { elevate } from "wix-auth";
3
4/* Sample eventId value: '9d720f99-1b5a-4141-9877-d32985391e18';
5*/
6
7export async function myDeleteEventFunction(eventId) {
8 try {
9 const elevatedDeleteEvent = elevate(wixEvents.deleteEvent);
10 const deletedEvent = await elevatedDeleteEvent(eventId);
11 console.log('Success! Deleted event:', deletedEvent);
12 return deletedEvent;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17}
18
19/* Promise resolves to void */