API call description
- For recurring events, all past recurring event instances are returned, but future instances are not. For example, if a daily recurring event starts on January 1 and the query is run on January 4, the instances from January 1 to January 4 are returned, but instances after January 4 are not.
- To determine whether an event is an instance of a recurring event, check whether the
recurrenceIdof the returned event object is empty. - By default, deleted events are not returned. To return them, set
showDeleted=true. When a deleted event is returned, calling the Get event details API returns the instanceNotExist error.
Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/calendar/users/{userId}/calendars/{calendarId}/events |
| HTTP Method | GET |
| Supported app types | appType-Internal app appType-Third-party enterprise app appType-Third-party personal app |
| Required permissions | permission-Calendar.Event.Read-Read permission for events in the Calendar app |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Obtain it as follows: - For an internal app, call the Get the access token of an internal app API. - For a third-party enterprise app, call the Get the access token of an organization authorized to a third-party app API. - For a third-party personal app, call the Get user token API. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| userId | String | Yes | The unionId of the target user. - For an internal app or a third-party enterprise app, call the Query user details API to obtain the unionid value. - For a third-party personal app, call the Get the user profile from Contacts API to obtain the unionId value. |
| calendarId | String | Yes | The ID of the calendar to which the event belongs. The value is uniformly set to primary, indicating the user’s primary calendar. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| timeMin | String | No | The minimum value of the event start time, in ISO-8601 date-time format. Optional. The maximum difference between timeMin and timeMax is one year. |
| timeMax | String | No | The maximum value of the event start time, in ISO-8601 date-time format. Optional. The maximum difference between timeMin and timeMax is one year. |
| showDeleted | Boolean | No | Whether to return deleted events: - true: Return - false (default): Do not return |
| maxResults | Integer | No | The maximum number of records to return. Maximum value: 100. Default value: 100. |
| maxAttendees | Integer | No | The number of attendees to query per event. Default value: 100. Maximum value: 100. If an event has more than 100 attendees and you need to retrieve all of them, use the Get event attendees API. |
| nextToken | String | No | The pagination cursor. If a single query cannot return all results, a pagination token is returned. Pass this token in the next query to retrieve subsequent data. When the pagination token returns null, all data has been retrieved. |
| syncToken | String | No | The sync token, used for incremental data synchronization. After a query has returned all data (if there is a large amount of data, the results are returned in pages, and the caller must use nextToken repeatedly until nextToken returns null in the last page), a syncToken is returned. Pass this token in the next query to retrieve the incremental data changed between the two queries. If timeMax is passed in, syncToken is not returned. |
| seriesMasterId | String | No | The ID of the master event of a recurring event. Empty for non-recurring events. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| nextToken | String | The pagination token. |
| events | Array | The events. |
| id | String | The event ID. |
| summary | String | The event title. |
| description | String | The event description. |
| start | Object | The event start time. |
| date | String | The event start date, in yyyy-MM-dd format. |
| dateTime | String | The event start time, in ISO-8601 date-time format. |
| timeZone | String | The time zone of the event start time, in tz database name format. Reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones |
| originStart | Object | The original start time when the recurring sequence was first created. Not returned for regular single events. |
| dateTime | String | The date and time information in ISO 8601 format, always in UTC. For example, midnight UTC on January 1, 2023, is 2023-01-01T00:00:00Z. |
| end | Object | The event end time. |
| date | String | The event end date, in yyyy-MM-dd format. |
| dateTime | String | The event end time, in ISO-8601 date-time format. |
| timeZone | String | The time zone of the event end time. Must be the same as the time zone of the start time. In tz database name format. Reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones |
| isAllDay | Boolean | Whether this is an all-day event. - true: Yes - false: No |
| recurrence | Object | The event recurrence rule. |
| pattern | Object | The recurrence pattern. |
| type | String | The recurrence rule type. - daily: Repeat every interval days - weekly: Repeat on daysOfWeek every interval weeks - absoluteMonthly: Repeat on day dayOfMonth every interval months - relativeMonthly: Repeat on daysOfWeek of the index week every interval months - absoluteYearly: Repeat every interval years |
| dayOfMonth | Integer | When type=absoluteMonthly, specifies the day of the month. |
| daysOfWeek | String | Lowercase English words specifying the days of the week. Use commas to separate multiple values. |
| index | String | When type=relativeMonthly, specifies which week of the month. - first - second - third - fourth - last last indicates the last week of the month. |
| interval | Integer | The recurrence interval. The unit varies by type. For example, when type=daily, it represents an interval of N days; when type=absoluteYearly, it represents an interval of N years. |
| firstDayOfWeek | String | The first day of the week. Possible values: sunday, monday, tuesday, wednesday, thursday, friday, saturday. Default value: “sunday”. |
| range | Object | The recurrence range. |
| type | String | The recurrence range type. - noEnd: Never ends - endDate: Repeats until the specified end date - numbered: Ends after a specified number of occurrences |
| endDate | String | The recurrence end date. |
| numberOfOccurrences | Integer | The number of repetitions. |
| attendees | Array | The event attendees. |
| id | String | The user unionId. |
| displayName | String | The user name. |
| responseStatus | String | The reply status. |
| self | Boolean | Whether this is the currently signed-in user. - true: Yes - false: No |
| isOptional | Boolean | Whether this is an optional attendee. - true: Yes - false: No |
| organizer | Object | The event organizer. |
| id | String | The user unionId. |
| displayName | String | The user name. |
| responseStatus | String | The reply status. |
| self | Boolean | Whether this is the currently signed-in user. - true: Yes - false: No |
| location | Object | The event location. |
| displayName | String | The display name. |
| meetingRooms | Array of String | The meeting rooms. |
| seriesMasterId | String | The ID of the master event of a recurring event. Empty for non-recurring events. |
| createTime | String | The created time. |
| updateTime | String | The update time. |
| status | String | The event status. |
| onlineMeetingInfo | Object | The online meeting. |
| type | String | The online meeting type. Currently supported: - dingtalk: DingTalk Video Meeting |
| conferenceId | String | The meeting ID. |
| url | String | The URL for joining the meeting. |
| extraInfo | Map | Other extended information. |
| reminders | Array | The event reminders. |
| method | String | The reminder method. |
| minutes | String | Send a reminder N minutes before the event starts. |
| extendedProperties | Object | The event extended properties. |
| sharedProperties | Object | The shared fields. |
| sourceOpenCid | String | When the event is created from a group chat, this field indicates the source group of the event. |
| belongCorpId | String | The organization ID of the organization to which the event belongs. |
| meetingRooms | Array | The meeting rooms. |
| roomId | String | The meeting room roomId. |
| responseStatus | String | The meeting room response status: - accepted: Accepted - tentative: Pending approval - declined: Approval rejected |
| displayName | String | The meeting room name. |
| categories | Array | The event categories. |
| displayName | String | The event category name. |
| richTextDescription | Object | The Rich Text field. |
| text | String | The Rich Text content. |
| syncToken | String | The incremental sync token. |
Response body example
Error codes
If an error is returned when calling this API, refer to the Global error codes document to find the solution based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | invalidParameter | forwardErrorMessage | Invalid parameter |