# Return all events

> **GET** `https://api.us.nylas.com/v3/grants/{grant_id}/events`

Source: https://developer.nylas.com/docs/reference/api/events/get-all-events/

Returns all events on the user's calendars.

**Authentication:** NYLAS_API_KEY, ACCESS_TOKEN

## Parameters

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `attendees` | string | No | (Not supported for virtual calendars) Filter for events that include the specified attendees. This parameter accepts a comma-delimited list of email addresses. |
| `busy` | boolean | No | (Not supported for iCloud) Filter for events with the specified `busy` status. |
| `calendar_id` | string | Yes | Filter for the specified calendar ID.  (Not supported for iCloud) You can use `primary` to query the user's primary calendar. |
| `description` | string | No | Filter for events matching the specified description. The filter is case insensitive and will match partial descriptions. |
| `end` | integer | No | Filter for events that end at or before the specified time, in seconds using the Unix timestamp format. For example, if you filter for events that end at 5:00p.m., and the calendar includes an event that runs from 4:30–5:30p.m., Nylas returns that event.  Defaults to one month from the time you make the request.  The `end` value cannot be earlier than `start`. For iCloud accounts, the difference between `start` and `end` can't be greater than one year. |
| `event_type` | string | No | (Google only) Filter for events with the specified event type. You can pass this query parameter multiple times to select or exclude multiple event types. For example, `event_type=default&event_type=outOfOffice` returns all events that are default or `OOO`, and excludes any events that are `focusTime` or that have a `workingLocation`.  If you don't specify an event type, Nylas uses `default` to filter for regular events that don't have another specific type. |
| `expand_recurring` | boolean | No | **This parameter is deprecated. Use the [Import Events endpoint](/docs/reference/api/events/import-events/) instead**.  When `true`, Nylas returns all recurring events within the specified time range, including individual occurrences of the recurring event. Otherwise, Nylas only returns the parent event and any event overrides (individual occurrences that have been edited) in the time range. |
| `ical_uid` | string | No | (Not supported for iCloud) Filter for events with the specified `ical_uid`. You _cannot_ apply other filters if you use this parameter. |
| `limit` | integer | No | The maximum number of objects to return. See [Pagination](/docs/reference/api/#pagination) for more information. |
| `location` | string | No | Filter for events with the specified location. The filter is case insensitive and will match partial locations. |
| `master_event_id` | string | No | (Not supported for iCloud) Filter for instances of recurring events with the specified `master_event_id`.  `master_event_id` is _not_ respected by metadata filtering.  When using `master_event_id` to fetch recurring events with a Google grant, the order of the results will not be sorted chronologically. Instead, Nylas returns the unchanged occurrences first, followed by the modified occurrences. For example, if you have a recurring event with the following occurrences: - 2025-01-01 - 2025-01-02 - 2025-01-03  But you modify the time of the second occurrence to 2025-01-02, the results will be: - 2025-01-01 - 2025-01-03 - 2025-01-02 (modified) |
| `metadata_pair` | string | No | Pass a metadata key/value pair (for example, `?metadata_pair=key1:value`) to search for metadata associated with objects. See [Metadata](/docs/reference/api/#metadata) for more information. |
| `page_token` | string | No | An identifier that specifies which page of data to return. You can get this value from the `next_cursor` response field. See [Pagination](/docs/reference/api/#pagination) for more information. |
| `select` | string | No | Specify fields that you want Nylas to return, as a comma-separated list (for example, `select=id,updated_at`). This allows you to receive only the portion of object data that you're interested in. You can use `select` to optimize response size and reduce latency by limiting queries to only the information that you need. |
| `show_cancelled` | boolean | No | (Not supported for iCloud or EWS) If `true`, Nylas includes events whose `status` is `cancelled`.  Different providers have different semantics for cancelled events:  - **Google**: An event is considered cancelled after a user deletes it from their calendar, until it's eventually hard-deleted and is no longer readable. - **Microsoft**: An event is considered cancelled if the user is invited to an event and the organizer deletes it. The cancelled version of the event stays on the participants' calendars until they delete it manually. |
| `start` | integer | No | Filter for events that start at or after the specified time, in seconds using the Unix timestamp format. For example, if you filter for events that start at 9:00a.m., and the calendar includes an event that runs from 8:30–9:30a.m., Nylas returns that event.  Defaults to the time that you make the request.  The `start` value cannot be later than `end`. For iCloud accounts, the difference between `start` and `end` can't be greater than one year. |
| `tentative_as_busy` | boolean | No | (Microsoft and EWS only) When `true`, Nylas treats tentative events as busy. |
| `title` | string | No | Filter for events that match the specified title. The filter is case insensitive and will match partial titles. |
| `updated_after` | integer | No | (Google, Microsoft, and EWS only) Filter for events that have been updated after the specified time, in seconds using the Unix timestamp format.  `updated_after` is _not_ respected by metadata filtering. |
| `updated_before` | integer | No | (Google, Microsoft, and EWS only) Filter for events that have been updated before the specified time, in seconds using the Unix timestamp format.  `updated_before` is _not_ respected by metadata filtering. |

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `grant_id` | string | Yes | ID of the grant to access. You can also use the email address associated with the grant, or use `/me/` to refer to the grant associated with an access token. |

## Responses

### 200 - Events Response

- `request_id` (string) - The request ID.
- `data` (array)
  - `busy` (boolean) - If `true`, shows the event's time block as `busy` on shared or public calendars. This may be
called "transparency" in some systems.
  - `calendar_id` (string,null) - The calendar ID associated with the event. If you used the `calendar_id=primary` query parameter in
your request, Nylas returns the real calendar ID instead of `primary`.

For Microsoft calendars, there are some cases where the event Nylas returns isn't associated with
a calendar ID. This happens most often when the event is created in a shared calendar.

This field may be `null` for certain event types (for example, virtual calendar events).
  - `conferencing` (object) - An object that contains event conferencing details. Nylas appends the conference information to the
Event `description`.
    - `provider` (string)
    - **Auto-conferencing**
      - `autocreate` (object) - The autocreate settings you specified for the meeting, plus the details created by the
conferencing provider. The autocreated conference details are also appended to the Event
description.
    - **Google Meet**
      - `details` (object) - An object that contains Google Meet conferencing details.
        - `url` (string) - The URL for the Google Meet conference.
        - `phone` (array) - The phone number associated with the Google Meet conference.
        - `pin` (string) - The PIN associated with the Google Meet conference, if applicable.
    - **Zoom Meeting**
      - `details` (object) - An object that contains Zoom conferencing details.
        - `url` (string) - The URL for the Zoom conference.
        - `meeting_code` (string) - A unique ID associated with the Zoom conference.
        - `password` (string) - The password for the Zoom conference, if applicable.
    - **Microsoft Teams**
      - `details` (object) - An object that contains Microsoft Teams conferencing details.
        - `url` (string) - The URL for the Microsoft Teams conference.
    - **WebEx**
      - `details` (object) - An object that contains WebEx conferencing details.
        - `url` (string) - The URL for the WebEx conference.
        - `password` (string) - The password for the WebEx conference, if applicable.
        - `pin` (string) - The PIN for the WebEx conference, if applicable.
        - `phone` (array) - The phone number associated with the WebEx conference.
    - **GoToMeeting**
      - `details` (object) - An object that contains GoToMeeting conferencing details.
        - `url` (string) - The URL for the GoToMeeting conference.
        - `meeting_code` (string) - A unique ID associated with the GoToMeeting conference.
        - `password` (string) - The password for the GoToMeeting conference, if applicable.
        - `phone` (array) - The phone number associated with the GoToMeeting conference.
  - `created_at` (integer,null) - When the event was created, in seconds using the Unix timestamp format.
  - `description` (string,null) - A brief description of the event (for example, its agenda). The description might be returned
as an HTML string, depending on how the provider formats it.
For Google accounts, this field accepts a maximum of 8,192 characters.
  - `text_description` (string,null) - A brief text description of the event (for example, its agenda). If the description is HTML-formatted,
this field will contain the text version of the description.
  - `hide_participants` (boolean) - (Not supported for iCloud or EWS events) When `true`, hides the event's list of participants.
  - `grant_id` (string) - The ID of grant for the connected user.
  - `html_link` (string) - (Not supported for EWS events) A link to the event on the provider.
  - `ical_uid` (string,null) - A unique ID that you can use to identify events across calendaring systems, in
[iCalendar format](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.4.7).
Recurring events might share the same ID.

Can be `null` for events synced before the year 2020.
  - `id` (string) - The ID of the event. Event IDs are usually unique to each user, except for Google which maintains the same event ID for an event regardless of the user querying it.
  - `location` (string,null) - The location of the event (for example, a physical address or the name of a meeting room).
  - `master_event_id` (string,null) - If the event is an instance of a recurring event series, this field lists the ID of the parent
event. If the parent event belongs to a different calendar that you don't have access to, or it's
been deleted or cancelled, you can't retrieve it using this ID.
  - `metadata` (object) - The metadata associated with the object. For more information, see
[Metadata](/docs/reference/api/#metadata).
  - `object` (string) - The type of object.
  - `organizer` (object) - An object that contains information about an event's organizer.
    - `name` (string) - The organizer's full name.
    - `email` (string) - The organizer's email address. 

For an event in a Google calendar, Nylas returns the `email` based on the calender type.
- For a primary calendar, `email` is the same as the `calendar_id`.
- For a non-primary calendar, `email` is set to the actual ID of the calendar.
  - `participants` (array) - An array of participants invited to the event. The organizer doesn't need to be explicitly
included in this list.
    - `comment` (string) - A note or comment about the participant (for example, their nickname).
    - `email` (string) - The participant's email address. For Microsoft Graph, this field can be missing.
    - `name` (string) - The participant's name.
    - `phone_number` (string) - The participant's phone number.
    - `status` (string) - The participant's RSVP status.
  - `resources` (array) - An array of room resource bookings added to the event.
    - `email` (string) **(required)** - The resource's email address.
    - `name` (string) - The resource's full name.
  - `read_only` (boolean) - If `true`, indicates that the event is read-only. The provider sets the `read_only` value based on
the connected calendar, and you can't modify it.

In cases where you _can_ update this field on a cloned event (for example, an event imported to your
calendar from an email invitation), `read_only` is `true`.

If the calendar is read-only, all events on the calendar have `read_only` set to `true`.
  - `reminders` (object) - A list of reminders to generate for the event. If not defined, Nylas uses the provider's default
settings.
    - `use_default` (boolean,null) - When `true`, the event uses the calendar's default reminder settings.
This field may be `null` if reminders are not explicitly configured.

- **Google**: Generates a `popup`-style reminder 10 minutes before the event begins.
- **Microsoft**: Generates a reminder 15 minutes before the event begins.
- **iCloud**: Does not generate a reminder.
- **EWS**: Generates a `display`-style reminder 15 minutes before the event begins.
    - `overrides` (array,null) - A list of reminders for the event to use when `use_default` is `false`. If this field is empty
or omitted, and `use_default` is `false`, the event does not send reminders. If `true`, Nylas
generates both the default event reminder and any reminders in the `overrides` list.

You cannot set reminder overrides if `use_default` is `true`.

For Microsoft Graph, EWS, and iCloud, you can set only one reminder per event.

This field may be `null` if no reminder overrides have been set. Treat `null` the same as an
empty array.
  - `recurrence` (array) - An array of `RRULE` and `EXDATE` strings. Nylas includes this field only if the event is the main
(master) event. See [RFC-5545](https://tools.ietf.org/html/rfc5545#section-3.8.5) for more details.
You can use [this tool](https://jkbrzt.github.io/rrule/) to learn more about the `RRULE` spec.

Events inherit their timezone from the `when` object. Nylas recommends that you use the `when`
object to specify the event's start and end time.

Provider specifics:
- On some providers, `EXDATE` might not include exception or cancelled event timestamps. When this
happens, Nylas represents those event instances as separate objects in its responses.
- Virtual calendars don't support `DTSTART` or `TZID`.
- iCloud accounts do _not_ support changing an event from recurring to non-recurring. You can create,
update, or delete information on recurring events.
- Microsoft Graph adds one day to the `UNTIL` date.
  - `status` (string) - (Not supported for iCloud) The status of the event. You can't set this field when creating or updating
an event. If you're the organizer of the event and you want to reply "maybe" or "no" to the
invitation, use the
[Send RSVP endpoint](/docs/reference/api/events/send-rsvp/)
instead.

For Google events, a `cancelled` status indicates that the event was an occurrence of a recurring
event, and that the occurrence has been cancelled by the event organizer.

For Microsoft and EWS events, a `cancelled` status indicates that the event was organized by someone
else, and the organizer cancelled or deleted the event.
  - `title` (string) - The name of the event.
  - `updated_at` (integer,null) - When the event was last updated, in seconds using the Unix timestamp format.
  - `visibility` (string,null) - (Not supported for iCloud events) Specifies whether the event is `public` or `private`. If not
defined, Nylas uses the account's default provider settings. For Google and Microsoft, event visibility is `public` by default.

For virtual calendar events, you can explicitly set `visibility` to `private` or `public` on create and update requests. If not set, virtual calendar events default to `public` behavior.
  - `when` (object,null) - An object that represents the time and duration of an event. Nylas might format `when` as one of three
sub-objects: `timespan`, `date`, or `datespan`. These sub-objects allow Nylas to capture and represent
specific points in time.

`timespan` objects include optional timezone support.

This field may be `null` when event timing data is unavailable (for example, when using field selection
that excludes the underlying time fields).
  - `original_start_time` (integer) - (Not supported for virtual calendars) The original start time of the event, in seconds using the Unix timestamp
format. This field is present only if the event is an instance of a recurring event.
  - `notetaker` (object)
    - `id` (string) - The Notetaker bot ID. Read-only; returned in responses but not required in create or update requests.
    - `meeting_settings` (object) - A collection of settings for the Notetaker bot.
      - `action_items` (boolean) - When `true`, Notetaker generates a list of action items from the meeting. If `action_items` is
`true`, `video_recording`, `audio_recording`, and `transcription` must also be `true`.
      - `action_items_settings` (object)
        - `custom_instructions` (string) - A custom prompt to pass to Nylas' AI model and specify settings for the list of action items
it generates. `action_items` must be `true` to use this field.
      - `audio_recording` (boolean) - When `true`, Notetaker records the meeting's audio.
      - `leave_after_silence_seconds` (integer) - The number of seconds of silence after which the Notetaker bot automatically leaves
the meeting. This helps end recordings when meetings have concluded but participants
haven't disconnected the call. Must be between 10 and 3600 seconds (1 hour).
      - `summary` (boolean) - When `true`, Notetaker generates a summary of the meeting. If `summary` is `true`,
`video_recording`, `audio_recording`, and `transcription` must also be `true`.
      - `summary_settings` (object)
        - `custom_instructions` (string) - A custom prompt to pass to Nylas' AI model and specify settings for the summary it generates.
`summary` must be `true` to use this field.
      - `transcription` (boolean) - When `true`, Notetaker transcribes the meeting's audio. If `transcription` is `true`,
`video_recording` and `audio_recording` must also be `true`.
      - `video_recording` (boolean) - When `true`, Notetaker records the meeting's video.
      - `transcription_settings` (object) - Optional settings that tune how Notetaker transcribes audio. `transcription` must be
`true` for these settings to take effect. Provide any combination of the fields below.

The fields fall into two independent groups:

- **Language hints** (`expected_languages`, `fallback_language`) constrain automatic
  language detection. This declares the languages you expect; it does not translate
  transcripts or force the recording into a specific language.
- **Keyword hints** (`keywords`, `use_speaker_names_as_keywords`) bias recognition toward
  domain-specific terms such as names, acronyms, and product names.

Set on individual Notetakers, on calendar sync, or on event sync. When set on a calendar,
events inherit the value unless the event's own request overrides it. Send `null` or `{}`
to clear inherited settings and return to default transcription behavior.

See [Set transcription languages](/docs/v3/notetaker/#set-transcription-languages) for
supported language codes and validation rules.
        - `expected_languages` (array) - Language codes the audio is expected to contain. Optional. When provided, it must
contain at least one supported code and cannot be `null` or empty. When omitted,
transcription considers all supported languages.
        - `fallback_language` (string) - Language to use if Notetaker does not detect one of the `expected_languages`. Optional.
When `expected_languages` is set, the fallback must be one of those codes. When
`expected_languages` is omitted, transcription considers all supported languages and
the fallback may be any supported code. When `fallback_language` is omitted, the
transcriber auto-detects the language. The field is not stored, so responses do not
return it.
        - `keywords` (array) - Domain-specific terms that bias transcription toward recognizing them correctly, such
as names, acronyms, and product names. Optional. Up to 200 terms; each term must be
1 to 200 characters and cannot contain control characters. Cannot be `null`.
        - `use_speaker_names_as_keywords` (boolean) - When `true`, Notetaker adds known speaker names to the keyword set so they are
transcribed accurately. Optional. Cannot be `null`.
    - `name` (string) - The display name for the Notetaker bot.
- `next_cursor` (string,null) - A cursor pointing to the next page of results for the request.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 504 - Provider Failure

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --compressed --request GET \
  --url 'https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/events?calendar_id=<CALENDAR_ID>&start=<TIMESTAMP>&end=<TIMESTAMP>' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json'
```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function fetchAllEventsFromCalendar() {
  try {
    const events = await nylas.events.list({
      identifier: "<NYLAS_GRANT_ID>",
      queryParams: {
        calendarId: "<CALENDAR_ID>",
      },
    });

    console.log("Events:", events);
  } catch (error) {
    console.error("Error fetching calendars:", error);
  }
}

fetchAllEventsFromCalendar();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>"
)

grant_id = "<NYLAS_GRANT_ID>"

events = nylas.events.list(
    grant_id,
    query_params={
      "calendar_id": "<CALENDAR_ID>"
    }
)

print(events)
```

### Ruby SDK

```ruby
require 'nylas'

nylas = Nylas::Client.new(api_key: "<NYLAS_API_KEY>")

query_params = {
	calendar_id: "<CALENDAR_ID>"
}

# Read events from our main calendar in the specified date and time
events, _request_ids = nylas.events.list(identifier: "<NYLAS_GRANT_ID>", query_params: query_params)

events.each {|event|
	case event[:when][:object]
		when 'timespan'
			start_time = Time.at(event[:when][:start_time]).strftime("%d/%m/%Y at %H:%M:%S")
			end_time = Time.at(event[:when][:end_time]).strftime("%d/%m/%Y at %H:%M:%S")
			event_date = "The time of the event is from: #{start_time} to #{end_time}"
		when 'datespan'
			start_time = event[:when][:start_date]
			end_time = event[:when][:end_date]
			event_date = "The date of the event is from: #{start_time} to: #{end_time}"
		when 'date'
			start_time = event[:when][:date]
			event_date = "The date of the event is: #{start_time}"
		end
		event[:participants].each {|participant|
			participant_details += "Email: #{participant[:email]} " \
			"Name: #{participant[:name]} Status: #{participant[:status]} - "
		}
		print "Id: #{event[:id]} | Title: #{event[:title]} | #{event_date} | " 
		puts "Participants: #{participant_details.chomp(' - ')}"
		puts "\n"
}
```

### Kotlin SDK

```kotlin
import com.nylas.NylasClient
import com.nylas.models.*

import java.util.*

fun main(args: Array<String>) {
  val nylas: NylasClient = NylasClient(apiKey = "<NYLAS_API_KEY>")

  val eventquery: ListEventQueryParams = ListEventQueryParams(calendarId = "<CALENDAR_ID>")

  // Get a list of events
  val myevents: List<Event> = nylas.events().list(
      "<NYLAS_GRANT_ID>", 
      queryParams = eventquery).data

  // Loop through the events
  for(event in myevents){
    print("Id: " + event.id + " | ");
    print("Title: " + event.title);

    // Get the details of Date and Time of each event.
    when(event.getWhen().getObject().toString()) {
      "DATE" -> {
        val datespan = event.getWhen() as When.Date

        print(" | The date of the event is: " + datespan.date);
      }
      "DATESPAN" -> {
        val datespan = event.getWhen() as When.Datespan

        print(" | The date of the event is: " + datespan.startDate);
      }
      "TIMESPAN" -> {
        val timespan = event.getWhen() as When.Timespan
        val startDate = Date(timespan.startTime.toLong() * 1000)
        val endDate = Date(timespan.endTime.toLong() * 1000)

        print(" | The time of the event is from: $startDate to $endDate");
      }
    }

    print(" | Participants: ");

    // Get a list of the event participants
    val participants = event.participants

    // Loop through and print their email, name and status
    for(participant in participants) {
      print(" Email: " + participant.email + " Name: " + participant.name +
          " Status: " + participant.status)
    }
    
    println("\n")
  }
}
```

### Java SDK

```java
import com.nylas.NylasClient;
import com.nylas.models.When;

import com.nylas.models.*;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Objects;

public class read_calendar_events {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build();

    // Build the query parameters to filter our the results
    ListEventQueryParams listEventQueryParams = new ListEventQueryParams.Builder("<CALENDAR_ID>").build();

    // Read the events from our main calendar
    List<Event> events = nylas.events().list("<NYLAS_GRANT_ID>", listEventQueryParams).getData();

    for (Event event : events) {
      System.out.print("Id: " + event.getId() + " | ");
      System.out.print("Title: " + event.getTitle());

      // Dates are handled differently depending on the event type
      switch (Objects.requireNonNull(event.getWhen().getObject()).getValue()) {
        case "datespan" -> {
          When.Datespan date = (When.Datespan) event.getWhen();

          System.out.print(" | The date of the event is from: " + 
              date.getStartDate() + " to " + 
              date.getEndDate());
        }
        case "date" -> {
          When.Date date = (When.Date) event.getWhen();
          
          System.out.print(" | The date of the event is: " +date.getDate());
        }
        case "timespan" -> {
          When.Timespan timespan = (When.Timespan) event.getWhen();

          String initDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").
          format(new java.util.Date((timespan.getStartTime() * 1000L)));

          String endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").
          format(new java.util.Date((timespan.getEndTime() * 1000L)));

          System.out.print(" | The time of the event is from: " + 
          initDate + " to " + endDate);
        }
      }

      System.out.print(" | Participants: ");

      for(Participant participant : event.getParticipants()){
        System.out.print(" Email: " + participant.getEmail() +
            " Name: " + participant.getName() +
            " Status: " + participant.getStatus());
      }

      System.out.println("\n");
    }
  }
}
```
