> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: cancelEvent(eventId: string) # Method package: wixEventsBackend # Method menu location: wixEventsBackend --> WixEvents --> cancelEvent # Method Link: https://dev.wix.com/docs/velo/apis/wix-events-backend/wix-events/cancel-event.md # Method Description: Cancels a Wix event and closes its registration. The `cancelEvent()` function returns a Promise that resolves to the newly-canceled Wix event after the specified Wix event is successfully canceled. This function does the following: + Changes the event status to `"CANCELED"`. You can also see this status change in the [Events collection](https://support.wix.com/en/article/velo-wix-events-events-collection-fields). + Sends cancellation emails and/or pushes notifications to registered guests, if Wix event [cancellation notifications are enabled](https://support.wix.com/en/article/wix-events-editing-default-emails). + Changes the registration status to `CLOSED`. Canceled Wix events cannot be "un-canceled." You can only delete and copy them. > **Tip**: You can copy a canceled Wix event if you want to reinstate it. Copying an event resets the event's status and registration status. When using the API, you do not need to cancel a Wix event before deleting it. When using the Wix Events app in the Editor, you must cancel the Wix event first. Only those with "Manage Events" permissions can cancel Wix events. > **Note**: This function requires [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) to run. > > This function is not [universal](https://www.wix.com/velo/reference/api-overview/api-versions#api-overview_api-versions_universal-modules) and runs only on the backend. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Cancel a Wix event ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { wixEvents } from 'wix-events-backend'; import { elevate } from 'wix-auth'; /* Sample eventId value: '9d720f99-1b5a-4141-9877-d32985391e18'; */ export const myCancelEventFunction = webMethod(Permissions.Anyone, async (eventId) => { try { const elevatedCancelEvent = elevate(wixEvents.cancelEvent); const canceledEvent = await elevatedCancelEvent(eventId); console.log('Success! Canceled event:', canceledEvent); return canceledEvent; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: { "about": "Learn to handcraft leather goods using saddle stitching techniques, from choosing the leather to sealing the edges.", "assignedContactsLabel": "custom.leather-crafting-101-a-course-by-christina-roth-1-", "calendarLinks": {}, "categories": [], "createdBy": "8a8b9b73-4da8-47a5-8268-4396e68a0605", "_createdDate": "2023-02-03T10:56:59.721Z", "description": "", "eventUrl": {}, "form": { "messages": { "checkout": {}, "registrationClosed": {}, "rsvp": { "noMessages": {}, "waitingMessages": {}, "yesMessages": {} } } }, "guestList": { "public": true }, "_id": "9d720f99-1b5a-4141-9877-d32985391e18", "language": "en", "location": { "address": { "formatted": "Tacoma, WA, USA", "location": { "latitude": 47.2528768, "longitude": -122.4442906 }, "city": "Tacoma", "subdivision": "WA", "country": "US", "streetAddress": { "name": "", "number": "", "apt": "" } }, "name": "Tacoma", "tbd": false, "type": "VENUE" }, "registration": { "rsvp": {}, "tickets": { "highestTicketPrice": {}, "lowestTicketPrice": {}, "tax": {} } }, "scheduling": { "formatted": "Time is TBD", "hideEndDate": false, "showTimeZone": false, "startDateFormatted": "", "startTimeFormatted": "", "tbd": true, "tbdMessage": "Time is TBD" }, "slug": "leather-crafting-101-a-course-by-christina-roth-1", "status": "CANCELED", "summary": { "rsvp": {}, "tickets": { "revenue": {}, "totalSales": {} } }, "title": "Leather Crafting 101, A course by Christina Roth (1)", "_updatedDate": "2023-11-08T11:56:16.000Z", "videoConferencing": { "session": {} } } */ ``` ---