> 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

# DeleteEvent

# Package: marketingPlan

# Namespace: CalendarService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/calendar-event-v1/delete-event.md

## Permission Scopes:
Manage Marketing Plans: SCOPE.PROMOTE.MANAGE-MARKETING-PLAN

## Introduction

Deletes a calendar event.

Events from a connected calendar are read-only: deleting one returns a `FAILED_PRECONDITION`
error. Deleting an event ID that doesn't exist also returns a `FAILED_PRECONDITION` error.

---

## REST API

### Schema

```
 Method: deleteEvent
 Description: Deletes a calendar event.  Events from a connected calendar are read-only: deleting one returns a `FAILED_PRECONDITION` error. Deleting an event GUID that doesn't exist also returns a `FAILED_PRECONDITION` error.
 URL: https://www.wixapis.com/promote/marketing-plan-service/v1/events/{eventId}
 Method: DELETE
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  eventId
 Method parameters: 
   param name: eventId | type:   none | required: true 
 Return type: DeleteEventResponse
  - name: event | type: CalendarEvent | description: The deleted event.  
     - name: id | type: string | description: Unique event GUID. Assigned on creation.  | validation: format GUID
     - name: name | type: string | description: Display name of the event (for example, "Summer Sale" or "Independence Day").  | validation: maxLength 3000
     - name: date | type: string | description: Date and time of the event. Set this field for a one-time event. For a recurring event, set `recurringRule` instead. If both are sent, `recurringRule` takes precedence and `date` is ignored. If neither is sent, the request fails with `INVALID_ARGUMENT`.  | validation: format date-time
     - name: calendarId | type: string | description: GUID of the marketing calendar this event belongs to.  | validation: format GUID
     - name: recurringRule | type: RecurringRule | description: Recurrence rule for the event. Set this field for a recurring event (weekly, monthly, or yearly). If both `recurringRule` and `date` are sent, `recurringRule` takes precedence and `date` is ignored. `frequency` is required and must not be `UNKNOWN`; omitting it returns a `FAILED_PRECONDITION` error.  
        - name: frequency | type: Frequency | description: How often the event repeats.  
             - enum:
             -     WEEKLY: The event repeats every week.
             -     MONTHLY: The event repeats every month.
             -     YEARLY: The event repeats every year.
        - name: weekDay | type: integer | description: Day of the week the event falls on, where `0` is Monday and `6` is Sunday. Used with `WEEKLY` frequency.  | validation: minimum 0, maximum 6, format int32
        - name: monthDay | type: integer | description: Day of the month the event falls on. Used with `MONTHLY` frequency.  | validation: minimum 1, maximum 31, format int32
        - name: month | type: integer | description: Month of the year the event falls in, where `1` is January and `12` is December. Used with `YEARLY` frequency.  | validation: minimum 1, maximum 12, format int32
        - name: occurrencePosition | type: integer | description: Ordinal position of the occurrence within the period (for example, `2` means "the 2nd Monday of the month"). Used with `MONTHLY` frequency alongside `weekDay`.  | validation: minimum 1, maximum 5, format int32
        - name: startDate | type: string | description: Date from which the recurrence starts.  | validation: format date-time
     - name: recurringOccurrences | type: array<RecurringEventOccurrence> | description: Computed individual occurrences of a recurring event. Read-only; populated only in `QueryEvents` responses, and only for occurrences within the requested date range.  | validation: minItems 0, maxItems 100
        - name: date | type: string | description: Date and time of this occurrence.  | validation: format date-time
     - name: description | type: string | description: Optional description providing additional context about the event.  | validation: maxLength 3000


```

### Examples

### Delete an event
Delete a calendar event by its id.

```curl
curl -X DELETE \
'https://www.wixapis.com/promote/marketing-plan-service/v1/events/d7a341c4-196b-46e7-813c-2b0fc1847ec6' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.promoteGrowthToolsMarketingPlan.calendarEvents.deleteEvent(eventId)
 Description: Deletes a calendar event.  Events from a connected calendar are read-only: deleting one returns a `FAILED_PRECONDITION` error. Deleting an event GUID that doesn't exist also returns a `FAILED_PRECONDITION` error.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  eventId
 Method parameters: 
   param name: eventId | type: string | description: GUID of the event to delete. | required: true | validation: format GUID
 Return type: PROMISE<DeleteEventResponse>
  - name: event | type: CalendarEvent | description: The deleted event.  
     - name: _id | type: string | description: Unique event GUID. Assigned on creation.  | validation: format GUID
     - name: name | type: string | description: Display name of the event (for example, "Summer Sale" or "Independence Day").  | validation: maxLength 3000
     - name: date | type: Date | description: Date and time of the event. Set this field for a one-time event. For a recurring event, set `recurringRule` instead. If both are sent, `recurringRule` takes precedence and `date` is ignored. If neither is sent, the request fails with `INVALID_ARGUMENT`.  
     - name: calendarId | type: string | description: GUID of the marketing calendar this event belongs to.  | validation: format GUID
     - name: recurringRule | type: RecurringRule | description: Recurrence rule for the event. Set this field for a recurring event (weekly, monthly, or yearly). If both `recurringRule` and `date` are sent, `recurringRule` takes precedence and `date` is ignored. `frequency` is required and must not be `UNKNOWN`; omitting it returns a `FAILED_PRECONDITION` error.  
        - name: frequency | type: Frequency | description: How often the event repeats.  
             - enum:
             -     WEEKLY: The event repeats every week.
             -     MONTHLY: The event repeats every month.
             -     YEARLY: The event repeats every year.
        - name: weekDay | type: integer | description: Day of the week the event falls on, where `0` is Monday and `6` is Sunday. Used with `WEEKLY` frequency.  | validation: minimum 0, maximum 6, format int32
        - name: monthDay | type: integer | description: Day of the month the event falls on. Used with `MONTHLY` frequency.  | validation: minimum 1, maximum 31, format int32
        - name: month | type: integer | description: Month of the year the event falls in, where `1` is January and `12` is December. Used with `YEARLY` frequency.  | validation: minimum 1, maximum 12, format int32
        - name: occurrencePosition | type: integer | description: Ordinal position of the occurrence within the period (for example, `2` means "the 2nd Monday of the month"). Used with `MONTHLY` frequency alongside `weekDay`.  | validation: minimum 1, maximum 5, format int32
        - name: startDate | type: Date | description: Date from which the recurrence starts.  
     - name: recurringOccurrences | type: array<RecurringEventOccurrence> | description: Computed individual occurrences of a recurring event. Read-only; populated only in `QueryEvents` responses, and only for occurrences within the requested date range.  | validation: minItems 0, maxItems 100
        - name: date | type: Date | description: Date and time of this occurrence.  
     - name: description | type: string | description: Optional description providing additional context about the event.  | validation: maxLength 3000


```

### Examples

### Delete an event
```javascript
import { calendarEvents } from "@wix/promote-growth-tools-marketing-plan";

const eventId = "d7a341c4-196b-46e7-813c-2b0fc1847ec6";

async function deleteEvent() {
  const response = await calendarEvents.deleteEvent(eventId);
}

```

### deleteEvent (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { calendarEvents } from '@wix/promote-growth-tools-marketing-plan';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { calendarEvents },
  // Include the auth strategy and host as relevant
});


async function deleteEvent(eventId) {
  const response = await myWixClient.calendarEvents.deleteEvent(eventId);
};
```

---