---
type: api
title: Get info about events in calendars
description: ## Required authorization
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch-serverless/operation/operation-ml-get-calendar-events
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch-serverless/operation/operation-ml-get-calendar-events
products:
  - Elasticsearch Serverless
---

# Get info about events in calendars

## Paths

- `GET` `/_ml/calendars/{calendar_id}/events`

#### Path parameters

- `calendar_id` (string) — required
  A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using `_all` or `*` or by omitting the calendar identifier.

## Required authorization

- Cluster privileges: `monitor_ml`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs use 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}"
  ```
  
  For more information about where to find API keys for the Elasticsearch endpoint (${ES_URL}) for a project, go to [Get started with Elasticsearch Serverless](https://www.elastic.co/docs/solutions/search/serverless-elasticsearch-get-started).

## Query string parameters

- `end` (union oneOf) — optional
  Specifies to get events with timestamps earlier than this time.
  One of: `string` or `number`
- `from` (number · default: 0) — optional
  Skips the specified number of events.
- `job_id` (string) — optional
  Specifies to get events for a specific anomaly detection job identifier or job group. It must be used with a calendar identifier of `_all` or `*`.
- `size` (number · default: 100) — optional
  Specifies the maximum number of events to obtain.
- `start` (union oneOf) — optional
  Specifies to get events with timestamps after this time.
  One of: `string` or `number`

## Response

`application/json`

- `count` (number)
- `events` (object[])
  - `calendar_id` (string)
    A string that uniquely identifies a calendar.
  - `event_id` (string)
  - `description` (string)
    A description of the scheduled event.
  - `end_time` (union)
    The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format.
  - `start_time` (union)
    The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format.
  - `skip_result` (boolean · default: true)
    When true the model will not create results for this calendar period.
  - `skip_model_update` (boolean · default: true)
    When true the model will not be updated for this calendar period.
  - `force_time_shift` (number)
    Shift time by this many seconds. For example adjust time for daylight savings changes
## Code examples

#### Console

```console
GET _ml/calendars/planned-outages/events
```

#### JavaScript

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

#### Python

```python
resp = client.ml.get_calendar_events(
    calendar_id="planned-outages",
)
```

#### curl

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

#### Java

```java
client.ml().getCalendarEvents(g -> g
    .calendarId("planned-outages")
);
```

#### C#

```c#
var response = await client.MachineLearning.GetCalendarEventsAsync(calendarId: "planned-outages");
```

#### PHP

```php
$resp = $client->ml()->getCalendarEvents([
    "calendar_id" => "planned-outages",
]);
```

#### Ruby

```ruby
response = client.ml.get_calendar_events(
  calendar_id: "planned-outages"
)
```

