---
type: api
title: Delete events from a calendar
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-ml-delete-calendar-event
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-ml-delete-calendar-event
products:
  - Elasticsearch
---

# Delete events from a calendar

Availability: Generally available since 6.2

## Paths

- `DELETE` `/_ml/calendars/{calendar_id}/events/{event_id}`

#### Path parameters

- `calendar_id` (string) — required
  A string that uniquely identifies a calendar.
- `event_id` (string) — required
  Identifier for the scheduled event.
You can obtain this identifier by using the get calendar events API.

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st
```

#### JavaScript

```javascript
const response = await client.ml.deleteCalendarEvent({
  calendar_id: "planned-outages",
  event_id: "LS8LJGEBMTCMA-qz49st",
});
```

#### Python

```python
resp = client.ml.delete_calendar_event(
    calendar_id="planned-outages",
    event_id="LS8LJGEBMTCMA-qz49st",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ml().deleteCalendarEvent(d -> d
    .calendarId("planned-outages")
    .eventId("LS8LJGEBMTCMA-qz49st")
);
```

#### C#

```c#
var response = await client.MachineLearning.DeleteCalendarEventAsync(calendarId: "planned-outages", eventId: "LS8LJGEBMTCMA-qz49st");
```

#### PHP

```php
$resp = $client->ml()->deleteCalendarEvent([
    "calendar_id" => "planned-outages",
    "event_id" => "LS8LJGEBMTCMA-qz49st",
]);
```

#### Ruby

```ruby
response = client.ml.delete_calendar_event(
  calendar_id: "planned-outages",
  event_id: "LS8LJGEBMTCMA-qz49st"
)
```

## Response examples

#### Ml delete calendar event response example1

A successful response when deleting a calendar event.

```json
{
  "acknowledged": true
}
```

