nextmail.calendar
Every method in this namespace: its signature, its parameters, what it returns and an example.
Methods
Calendar events found in mail, expanded into occurrences.
calendar.listEvents()calendar.listAllEvents()calendar.iterateEvents()calendar.getEvent()calendar.getEventIcs()calendar.createEvent()calendar.updateEvent()calendar.deleteEvent()calendar.cancelEvent()calendar.respondToEvent()calendar.declineProposal()calendar.hideEvent()calendar.unhideEvent()calendar.freeBusy()calendar.listCalendars()calendar.getCalendar()calendar.createCalendar()calendar.updateCalendar()calendar.deleteCalendar()calendar.setCalendarMember()calendar.removeCalendarMember()calendar.listCalendarLogins()calendar.createCalendarLogin()calendar.revokeCalendarLogin()calendar.createCalendarLoginProfileLink()calendar.listTodos()calendar.listAllTodos()calendar.iterateTodos()calendar.getTodo()calendar.createTodo()calendar.updateTodo()calendar.deleteTodo()calendar.listFeeds()calendar.createFeed()calendar.resetFeed()calendar.deleteFeed()calendar.listSubscriptions()calendar.createSubscription()calendar.updateSubscription()calendar.refreshSubscription()calendar.deleteSubscription()calendar.importIcs()calendar.listImports()calendar.listAllImports()calendar.iterateImports()calendar.getImport()calendar.undoImport()
calendar.listEvents()
List one page of event occurrences inside a time window
listEvents(options: CalendarRangeOptions): Promise<Page<CalendarOccurrenceResource>>Expands your events into their occurrences between from and to and returns one page of them, sorted by start time and then by event id. A recurring series gives one row per instance in the window, with its excluded dates left out, and every row points back to its event through eventId. The window is required because a repeating series has no end to list up to. Follow nextCursor while hasMore is true, with the same from, to and timezone, to read every occurrence, or let listAllEvents and iterateEvents do that walk.
to must be after from and at most 366 days later. A missing from or to is a 422 invalid_parameter, while a value that does not parse, a reversed or overlong window, or an unknown zone is a 400 invalid_parameter naming the field. Both bounds take a Date or an ISO 8601 string, and the SDK converts a Date with toISOString().
timezone is an IANA zone and defaults to UTC on the server. It is used to expand any event stored without a zone of its own, which is what decides the day an all day event lands on.
Parameters
options.fromDate | stringRequiredStart of the window.
options.toDate | stringRequiredEnd of the window, after
fromand at most 366 days later.options.timezonestringIANA zone such as
Europe/London, at most 64 characters. Defaults toUTC.options.includeTeambooleanAdds the events of the rest of the workspace, apart from the ones marked private. Only a key of the workspace owner sees more with it. Defaults to
false.options.qstringWords to look for in the title, the place and the organiser, at most 200 characters. Only events that hold every word come back, so pass a long window to find an event by name, and the same
qwith every cursor.options.calendarIdsArray<string>Only the events in these calendars, by the ids
listCalendarsgives. Events from calendar subscriptions are left out when you name calendars.options.limitnumberOccurrences per page, a whole number from 1 to 100. The server defaults to 25.
options.cursorstringThe
nextCursorof the previous page, sent with the same window. It is opaque, so never build one yourself.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
Page<CalendarOccurrenceResource> with items, hasMore and nextCursor. Each item has eventId, uid, start, end, allDay, summary, location, status, transparency, isOrganizer, organizerEmail, recurring, myPartstat and attendeeCount.
Example
const from = new Date()const to = new Date(from.getTime() + 7 * 24 * 60 * 60 * 1000) const page = await nextmail.calendar.listEvents({ from, to, timezone: 'Europe/London', limit: 50 }) for (const occurrence of page.items) { console.log(occurrence.start, occurrence.summary, occurrence.myPartstat ?? 'not invited')} console.log(page.hasMore, page.nextCursor)Notes
The list holds your own events: the ones you made and the ones an address of yours organises or attends. For the workspace owner and their keys, an address counts as theirs unless it was given to a teammate, and
includeTeam: trueadds the rest of the workspace, apart from events somebody marked private. A member's app and a narrowed key always get their own view.myPartstatis the response recorded for one of your own addresses, or for the addresses a narrowed key covers, and null when none of them is an attendee.A narrowed key only sees occurrences whose organiser is one of the addresses it covers or where one of them is an attendee.
Cancelled events are not filtered out. Check
statusforCANCELLED.Nothing in the window is dropped. A series repeats at most once a day, so one series gives at most one row per day of the window, and every one of them is reachable through the pages.
The cursor holds the start time and event id of the last row, so an event deleted or moved between pages never breaks the walk. A cursor this list did not hand out is a 400
invalid_cursor.
Also available in
calendar.listAllEvents()
Collect every occurrence inside a time window into one array
listAllEvents(options: CalendarRangeOptions): Promise<Array<CalendarOccurrenceResource>>Walks every page of listEvents for one window and resolves with all of its occurrences, sorted by start time and then by event id. It follows nextCursor until hasMore is false, sending the same from, to and timezone with each request.
A window of up to 366 days of a busy calendar can hold thousands of occurrences, so prefer iterateEvents when you can stop early.
Parameters
options.fromDate | stringRequiredStart of the window.
options.toDate | stringRequiredEnd of the window, after
fromand at most 366 days later.options.timezonestringIANA zone such as
Europe/London, at most 64 characters. Defaults toUTC.options.includeTeambooleanAdds the events of the rest of the workspace, apart from the ones marked private. Only a key of the workspace owner sees more with it. Defaults to
false.options.qstringWords to look for in the title, the place and the organiser, at most 200 characters. Only events that hold every word come back.
options.calendarIdsArray<string>Only the events in these calendars, by the ids
listCalendarsgives. Events from calendar subscriptions are left out when you name calendars.options.limitnumberPage size for each request, 1 to 100. The server defaults to 25.
options.cursorstringStarts the walk from this cursor instead of the start of the window.
options.signalAbortSignalCancels the request in flight and the walk with it.
options.apiKeystringOverrides the client API key for every page of this walk.
Returns
Array<CalendarOccurrenceResource> holding every occurrence in the window, earliest first.
Example
const occurrences = await nextmail.calendar.listAllEvents({ from: '2026-10-01T00:00:00Z', to: '2026-11-01T00:00:00Z', limit: 100}) const busy = occurrences.filter((occurrence) => occurrence.transparency === 'OPAQUE') console.log(`${busy.length} busy blocks in October`)Notes
If any page fails the promise rejects and the occurrences already fetched are discarded.
Also available in
calendar.iterateEvents()
Stream the occurrences inside a time window one at a time
iterateEvents(options: CalendarRangeOptions): AsyncGenerator<CalendarOccurrenceResource, void, undefined>Returns an async generator over the occurrences in one window that yields them individually, earliest first, and fetches the next page only when the current one is drained. Nothing is requested until you consume it, and breaking out of the loop stops further requests, which makes it the way to find the next free slot or the next meeting without reading the whole window.
The walk ends when hasMore is false, when the server stops offering a cursor, or when it repeats one.
Parameters
options.fromDate | stringRequiredStart of the window.
options.toDate | stringRequiredEnd of the window, after
fromand at most 366 days later.options.timezonestringIANA zone such as
Europe/London, at most 64 characters. Defaults toUTC.options.includeTeambooleanAdds the events of the rest of the workspace, apart from the ones marked private. Only a key of the workspace owner sees more with it. Defaults to
false.options.qstringWords to look for in the title, the place and the organiser, at most 200 characters. Only events that hold every word come back.
options.calendarIdsArray<string>Only the events in these calendars, by the ids
listCalendarsgives. Events from calendar subscriptions are left out when you name calendars.options.limitnumberPage size per request, 1 to 100. The server defaults to 25.
options.cursorstringStarts the walk from this cursor instead of the start of the window.
options.signalAbortSignalCancels the request in flight and ends the iteration.
options.apiKeystringOverrides the client API key for every page of this walk.
Returns
AsyncGenerator<CalendarOccurrenceResource, void, undefined> yielding one occurrence per step.
Example
const from = new Date()const to = new Date(from.getTime() + 30 * 24 * 60 * 60 * 1000) for await (const occurrence of nextmail.calendar.iterateEvents({ from, to })) { if (occurrence.myPartstat === null) continue console.log('next meeting', occurrence.start, occurrence.summary) break}Notes
An aborted
options.signalrejects the pending page request, which throws out of thefor awaitloop.
Also available in
calendar.getEvent()
Read an event with its attendees
getEvent(id: string, options?: RequestScope): Promise<CalendarEventResource>Returns a stored event with its attendees and their responses. What the server understood from the iCalendar data is structured here: recurrence holds the RRULE text, exdates the excluded instances, organizer the organiser and alarms the reminders as { minutesBefore, action }. The raw iCalendar source is not included, and getEventIcs serves the event as a document.
id is the event id, the eventId on an occurrence, and not the iCalendar uid. A recurring series is one event however many occurrences it has, so start and end describe its first instance. messageId and threadId link the event to mail in the mailbox when there is any.
Attendees come back in the order they were added, each with partstat, role, rsvp, cutype and respondedAt. A narrowed key gets a 404 unless one of the addresses it covers organises the event or is on the attendee list, and a key that holds a whole domain covers every address on it.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventResource with id, uid, sequence, summary, description, location, url, start, end, allDay, timezone, recurrence, exdates, status, transparency, visibility, organizer, isOrganizer, source, messageId, threadId, alarms, attendees, createdAt and updatedAt.
Example
const { items: [first] } = await nextmail.calendar.listEvents({ from: '2026-09-14T00:00:00Z', to: '2026-09-21T00:00:00Z' }) if (first) { const event = await nextmail.calendar.getEvent(first.eventId) console.log(event.summary, event.recurrence ?? 'one off') console.log(event.attendees.map((attendee) => `${attendee.email}: ${attendee.partstat}`))}Notes
status,transparencyandvisibilitycarry iCalendar values, and default toCONFIRMED,OPAQUEandPUBLIC.An attendee's
partstatdefaults toNEEDS-ACTIONandroletoREQ-PARTICIPANTuntil a response is recorded.
Also available in
calendar.getEventIcs()
Download an event as an iCalendar document
getEventIcs(id: string, options?: RequestScope): Promise<string>Resolves with the event serialised as an .ics document, as a raw string rather than parsed JSON. The server sends it as text/calendar; charset=utf-8 with a download filename built from the event's uid, and the SDK requests that type and returns the body untouched.
The document declares METHOD:PUBLISH, and the content type carries no method parameter. That is deliberate: a REQUEST document makes a calendar client offer accept and decline and reply to the organiser, and this endpoint has no authority to invite anyone. Import it to show what the event currently is, not to send an invitation.
It holds one VEVENT with the attendees and their participation status, the recurrence rule, excluded dates and alarms. Lines end in CRLF and long lines are folded. DTSTAMP is the time of the request, so two downloads of an unchanged event differ on that line.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
string, the iCalendar text from BEGIN:VCALENDAR to END:VCALENDAR.
Example
const ics = await nextmail.calendar.getEventIcs('cal_8d3f0a2b9c4e41f7a6b5c2d1')const summary = ics.split('\r\n').find((line) => line.startsWith('SUMMARY:')) console.log(summary)Notes
Errors still come back as JSON and throw
NextmailApiError, so a failure never resolves as a string.Timed events are written in the zone they were created in, as local times with a
TZIDand aVTIMEZONEthat carries the rules of that zone, and all day events asDATEvalues.A narrowed key gets a 404 on the same terms as
getEvent.
Also available in
calendar.createEvent()
Put an event on the calendar
createEvent(body: CalendarEventCreate, options?: RequestScope): Promise<CalendarEventResource>Creates an event, as New event on the Calendar page of the app does. start and end take a Date or ISO 8601 with a zone, and timezone is the IANA zone the event belongs to, which decides what an all-day event means.
With attendees, an invitation goes to each of them by email from from, which has to be an address the key may send as, so the call also needs emails:send. Send sendInvites: false to keep it to your own calendar.
Parameters
body.summarystringRequiredThe title, 1 to 255 characters.
body.startDate | stringRequiredWhen it starts, a
Dateor ISO 8601 with a zone.body.endDate | stringRequiredWhen it ends, after
startand at most two years later.body.descriptionstringNotes about the event, up to 8,000 characters.
body.locationstringWhere it is: a room, an address or a link.
body.urlstringA link that belongs to the event.
body.meetingUrlstringThe link to the video call, such as a Zoom, Meet or Teams address. The invitation carries it, so guests get a Join button in their calendar too.
body.allDaybooleanWhether it fills whole days.
startandendthen mark the days.body.timezonestringThe IANA zone the event belongs to,
UTCunless you say.body.recurrencestringAn RRULE such as
FREQ=WEEKLY;BYDAY=MOwhen it repeats.body.attendeesArray<CalendarAttendeeInput>Up to 200 people to invite, each
{ email, name?, optional? }.body.remindersArray<CalendarReminderInput>Up to five reminders, each
{ minutesBefore, action? }.body.transparencyCalendarTransparencyOPAQUEshows you busy andTRANSPARENTfree.body.visibilityCalendarVisibilityPUBLIC,PRIVATEorCONFIDENTIAL.body.sendInvitesbooleanFalse keeps the change to your own calendar, and sends nothing.
body.fromstringThe address the invitations come from. It has to be one the key may send as.
body.calendarIdstringThe calendar to put it in: one you keep, or one you are a member of with write access. Your default calendar unless you say.
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventResource for the new event, with its attendees and their responses.
Example
const event = await nextmail.calendar.createEvent({ summary: 'Planning', start: '2026-10-12T09:00:00Z', end: '2026-10-12T09:30:00Z', attendees: [{ email: '[email protected]' }], from: '[email protected]'}) console.log(event.id, event.attendees.length)Notes
The SDK does not retry it, because a second call makes a second event and invites everybody again.
A key that may not send as
fromis refused with 403from_address_forbidden, and an event with attendees and nofromwith 422invalid_parameter. Invitations withoutemails:sendare a 403insufficient_scope.
Also available in
calendar.updateEvent()
Change an event
updateEvent(id: string, patch: CalendarEventPatch, options?: RequestScope): Promise<CalendarEventResource>Changes an event you organise. A field you leave out keeps its value, and attendees replaces the whole list. Everyone invited gets the updated invitation by email from from, so a change to an event with attendees needs emails:send too, unless sendInvites is false.
For a repeating event, scope says which dates change, as the app asks when you edit one date: occurrence changes only the date that starts at occurrenceStart, following that date and every one after it, and series all of them. With following the later dates become a new series with its own id, which is what comes back, and the old one ends the day before.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.patch.summarystringThe title, 1 to 255 characters.
patch.startDate | stringWhen it starts, a
Dateor ISO 8601 with a zone.patch.endDate | stringWhen it ends, after
startand at most two years later.patch.descriptionstringNotes about the event, up to 8,000 characters.
patch.locationstringWhere it is: a room, an address or a link.
patch.urlstringA link that belongs to the event.
patch.meetingUrlstringThe link to the video call. An empty string takes it off.
patch.allDaybooleanWhether it fills whole days.
startandendthen mark the days.patch.timezonestringThe IANA zone the event belongs to,
UTCunless you say.patch.recurrencestringAn RRULE such as
FREQ=WEEKLY;BYDAY=MOwhen it repeats.patch.attendeesArray<CalendarAttendeeInput>Up to 200 people to invite, each
{ email, name?, optional? }. It replaces the whole list.patch.remindersArray<CalendarReminderInput>Up to five reminders, each
{ minutesBefore, action? }.patch.transparencyCalendarTransparencyOPAQUEshows you busy andTRANSPARENTfree.patch.visibilityCalendarVisibilityPUBLIC,PRIVATEorCONFIDENTIAL.patch.sendInvitesbooleanFalse keeps the change to your own calendar, and sends nothing.
patch.fromstringThe address the invitations come from. It has to be one the key may send as.
patch.calendarIdstringMoves the event, with every date of a repeating one, to this calendar: one you keep, or one you are a member of with write access. A move on its own tells nobody.
patch.scopeCalendarEditScopeoccurrence,followingorseries: which dates of a repeating event change. Left out, the change reaches the event or date the id names.patch.occurrenceStartDate | stringThe start of the date you mean, as
listEventsgives it. Needed withoccurrenceandfollowing.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventResource as it stands after the change, with sequence one higher.
Example
const event = await nextmail.calendar.updateEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', { start: '2026-10-12T10:00:00Z', end: '2026-10-12T10:30:00Z'}) console.log(event.start, event.sequence)Notes
The SDK does not retry it, because a retry after a lost response sends the update to everybody again.
An event organised by somebody else is refused with 403
not_organizer: answer it withrespondToEventinstead. An event the key does not reach is a 404.
Also available in
calendar.deleteEvent()
Remove an event from the calendar
deleteEvent(id: string, options?: CalendarEventDeleteOptions): Promise<DeletedCalendarEventResource>Removes an event for good, as Remove does in the app. Nobody else is told, so call off a meeting with others in it with cancelEvent instead. For a repeating event, scope occurrence with occurrenceStart removes one date, and following that date and every one after it.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.options.scopeCalendarEditScopeoccurrence,followingorseries: which dates of a repeating event go.options.occurrenceStartDate | stringThe start of the date you mean, as
listEventsgives it. Needed withoccurrenceandfollowing.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedCalendarEventResource: { object, id, deleted: true }.
Example
await nextmail.calendar.deleteEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', { scope: 'occurrence', occurrenceStart: '2026-10-19T09:00:00Z'})Notes
An event organised by somebody else is refused with 403
not_organizer, and an event that is gone or that the key does not reach is a 404. An event you may not remove can still be taken off your own calendar withhideEvent.
Also available in
calendar.cancelEvent()
Call off a meeting
cancelEvent(id: string, body?: CalendarEventCancel, options?: RequestScope): Promise<CalendarEventResource>Cancels a meeting you organise, as Cancel meeting does in the app. It stays on the calendar with status CANCELLED, and everyone invited is told it is off by email from from, so a meeting with attendees also needs emails:send.
For a repeating meeting, scope occurrence with occurrenceStart calls off one date, and following that date and every one after it. Guests get the matching update.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.body.fromstringThe address the cancellation comes from. It has to be one the key may send as.
body.scopeCalendarEditScopeoccurrence,followingorseries: which dates of a repeating meeting are called off.body.occurrenceStartDate | stringThe start of the date you mean, as
listEventsgives it. Needed withoccurrenceandfollowing.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventResource with status CANCELLED.
Example
const event = await nextmail.calendar.cancelEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', { from: '[email protected]' }) console.log(event.status)Notes
The SDK does not retry it, because a retry sends the cancellation again.
An event organised by somebody else is refused with 403
not_organizer.
Also available in
calendar.respondToEvent()
Answer an invitation
respondToEvent(id: string, body: CalendarEventAnswer, options?: RequestScope): Promise<CalendarEventResource>Accepts, declines or tentatively accepts an invitation, as the buttons of an invitation do in the app. The answer goes to the organiser by email from the invited address the key may send as, or from respondingAs when the invitation went to more than one of yours, so it needs emails:send as well.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.body.responseCalendarResponseRequiredACCEPTED,DECLINEDorTENTATIVE.body.respondingAsstringWhich of your invited addresses answers, when there is more than one.
body.proposedStartDate | stringA new start to propose with your answer, sent together with
proposedEnd.body.proposedEndDate | stringThe end of the proposed time.
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventResource with your answer on your attendee row.
Example
const event = await nextmail.calendar.respondToEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', { response: 'ACCEPTED' }) console.log(event.attendees.map((attendee) => `${attendee.email}: ${attendee.partstat}`))Notes
An event that invited none of the addresses the key may send as is refused with 403
not_invited, and a cancelled meeting with 409event_cancelled.When the organiser cannot be reached, nothing changes and the call is a 409
reply_not_sent.With
proposedStartandproposedEndthe organiser gets a counter-proposal, as Propose a new time sends from Google Calendar and Outlook, and decides whether to move the meeting.
Also available in
calendar.declineProposal()
Decline a proposed time
declineProposal(id: string, body: CalendarProposalDecline, options?: RequestScope): Promise<CalendarEventResource>Keeps the original time of a meeting you organise after a guest proposed another one, as Decline in the proposal on the event does in the app. The guest is told by email from from, or from the organising address, so it needs emails:send as well. To take the proposed time instead, change the event with updateEvent.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.body.attendeestringRequiredThe guest whose proposal you decline, by email address.
body.fromstringThe address the answer is sent from, when it is not the organising address.
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventResource with the guest's proposedStart and proposedEnd cleared.
Example
const event = await nextmail.calendar.getEvent('cal_3f9a1c7e5b2d48a06c1e9f4b')const proposer = event.attendees.find((attendee) => attendee.proposedStart) if (proposer) await nextmail.calendar.declineProposal(event.id, { attendee: proposer.email })Notes
A guest who has not proposed a new time is refused with 404
proposal_not_found, and an event somebody else organises with 403not_organizer.
Also available in
calendar.hideEvent()
Hide an event from your calendar
hideEvent(id: string, options?: RequestScope): Promise<CalendarEventHiddenResource>Takes an event off your own calendar and leaves it for everyone else, as Hide from my calendar does in the app. Use it for an invitation that reached you through a shared address, or an event you may not remove. It hides every date of a repeating event, and stops its reminders for you. unhideEvent brings it back.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventHiddenResource: { object, id, uid, hidden: true }.
Example
const hidden = await nextmail.calendar.hideEvent('cal_3f9a1c7e5b2d48a06c1e9f4b') console.log(hidden.hidden)Notes
Hiding an event that is already hidden changes nothing, so it is safe to repeat. An event the key does not reach is a 404.
It hides the event for the person the key or app acts for, and nobody else.
listEventsleaves it out from then on, andgetEventstill finds it, withhiddentrue.
Also available in
calendar.unhideEvent()
Show a hidden event again
unhideEvent(id: string, options?: RequestScope): Promise<CalendarEventHiddenResource>Puts an event you hid back on your calendar, as Show on my calendar does on the invitation in the app.
Parameters
idstringRequiredEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarEventHiddenResource: { object, id, uid, hidden: false }.
Example
await nextmail.calendar.unhideEvent('cal_3f9a1c7e5b2d48a06c1e9f4b')Notes
An event that was not hidden stays as it was, so it is safe to repeat.
Also available in
calendar.freeBusy()
Free and busy times
freeBusy(options: CalendarFreeBusyOptions): Promise<CalendarFreeBusyResource>When the people you name are busy, as Find a time in the event editor of the app shows it. An address of the workspace shows the busy times of the person who holds it, from their events, the invitations they have not declined, their subscribed calendars and their bookings, without any detail. Any other address comes back with known false.
With durationMinutes, suggestions lists up to five times when everyone known is free, on weekdays between 09:00 and 17:00 in timezone. from and to take a Date or an ISO 8601 string and may be at most 31 days apart.
Parameters
options.emailsArray<string>RequiredThe addresses to look up, at most 20.
options.fromDate | stringRequiredThe start of the window.
options.toDate | stringRequiredThe end of the window, at most 31 days after
from.options.timezonestringThe IANA zone the suggested times keep to working hours in,
UTCunless you say.options.durationMinutesnumberThe length of the meeting, 5 to 480 minutes. Send it to get
suggestions.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarFreeBusyResource with people, each { email, known, busy } with its busy times as { start, end }, and suggestions in the same shape.
Example
const from = new Date()const to = new Date(from.getTime() + 7 * 24 * 60 * 60 * 1000) const times = await nextmail.calendar.freeBusy({ emails: ['[email protected]', '[email protected]'], from, to, timezone: 'Europe/London', durationMinutes: 30}) for (const time of times.suggestions) console.log(time.start)Notes
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because the answer reads whole calendars.It reads the calendars as they are now and holds nothing, so a suggested time can be gone a moment later.
Also available in
calendar.listCalendars()
List your calendars
listCalendars(options?: CalendarListOptions): Promise<Array<CalendarResource>>Every calendar you keep, your default one among them, then the calendars other members of the workspace gave you access to, as the calendar list beside the Calendar page shows them. Each event is in one calendar, new events and invitations go to your default calendar, and calendar apps that sync over CalDAV show each calendar as one of its own. Your to-do lists are calendars too: kind: 'todos' lists them instead.
Parameters
options.kindCalendarKindeventsfor your calendars of events, ortodosfor your to-do lists, fromCALENDAR_KINDS.eventsunless you say.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
Array<CalendarResource>, the ones you keep first. A calendar you keep lists its members; one you are a member of has members: null and the access its keeper gave you.
Example
const calendars = await nextmail.calendar.listCalendars() for (const calendar of calendars) { console.log(calendar.name, calendar.access, calendar.isDefault ? '(default)' : '')}Notes
A key or app limited to some addresses is refused with 422
capability_unsupported, because calendars belong to a person, not to an address.An API key lists the calendars of the workspace owner, and an app those of the person who connected it.
Also available in
calendar.getCalendar()
Get one calendar
getCalendar(id: string, options?: RequestScope): Promise<CalendarResource>One calendar you keep or are a member of, with its members when you keep it.
Parameters
idstringRequiredThe calendar id,
cln_followed by 24 hex characters, aslistCalendarsgives it.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarResource.
Example
const calendar = await nextmail.calendar.getCalendar('cln_3f9a1c7e5b2d48a06c1e9f4b') console.log(calendar.name, calendar.members?.length ?? 0)Notes
A calendar you neither keep nor are a member of is a 404
calendar_not_found.
Also available in
calendar.createCalendar()
Create a calendar
createCalendar(body: CalendarCreate, options?: RequestScope): Promise<CalendarResource>Makes a new calendar of yours, such as Work or Family, as New calendar does in the app. Put events in it with calendarId on createEvent, or move them there with updateEvent. With kind: 'todos' it is a to-do list instead, for createTodo.
Parameters
body.namestringRequiredThe name the apps show, 1 to 100 characters.
body.kindCalendarKindeventsfor a calendar of events, ortodosfor a to-do list, fromCALENDAR_KINDS.eventsunless you say.body.colorCalendarColorThe colour its events are drawn in, from
CALENDAR_COLORS. Blue unless you say.body.descriptionstring | nullWhat the calendar is for, up to 1,000 characters.
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarResource for the new calendar, which is never your default one.
Example
const calendar = await nextmail.calendar.createCalendar({ name: 'Family', color: 'green' }) await nextmail.calendar.createEvent({ summary: 'School play', start: '2026-12-04T17:00:00Z', end: '2026-12-04T19:00:00Z', calendarId: calendar.id})Notes
One person may keep 50 calendars and 50 to-do lists. One more is refused with 409
calendar_limit.
Also available in
calendar.updateCalendar()
Change a calendar
updateCalendar(id: string, patch: CalendarPatch, options?: RequestScope): Promise<CalendarResource>Renames a calendar you keep, describes it, gives it another colour, moves it in your list or makes it your default. For a calendar you are a member of, color and position are your own and change only for you.
Parameters
idstringRequiredThe calendar id,
cln_followed by 24 hex characters, aslistCalendarsgives it.patch.namestringThe new name, 1 to 100 characters.
patch.colorCalendarColorThe new colour, from
CALENDAR_COLORS.patch.descriptionstring | nullWhat the calendar is for. null clears it.
patch.positionnumberIts place in your list, from 0 at the top. The calendars you keep and the ones you are a member of are ordered apart.
patch.isDefaultbooleantruemakes it your default calendar, where new events and invitations go.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarResource as it stands now.
Example
await nextmail.calendar.updateCalendar('cln_3f9a1c7e5b2d48a06c1e9f4b', { name: 'Work', color: 'purple', isDefault: true })Notes
Renaming or describing a calendar you are a member of is a 403
calendar_not_owned.isDefault: falseon your default calendar is a 409calendar_is_default: make another calendar the default instead.
Also available in
calendar.deleteCalendar()
Delete a calendar
deleteCalendar(id: string, options?: CalendarDeleteOptions): Promise<DeletedCalendarResource>Deletes a calendar you keep and the events in it, as Delete calendar does in the app. Everyone invited to an upcoming meeting you organised in it is sent a cancellation from the address that invited them, as cancelEvent does, unless notifyGuests is false. A meeting that came in through a calendar import is cancelled quietly unless notifyGuests is true. Its members lose it, and calendar links that publish it stop working. A to-do list goes with its to-dos. For a calendar you are a member of, you leave it, it stays with its keeper and nobody is told.
Parameters
idstringRequiredThe calendar id,
cln_followed by 24 hex characters, aslistCalendarsgives it.options.notifyGuestsbooleanfalsedeletes it without telling anyone. Left out ortrue, the guests of its upcoming meetings are sent a cancellation, andtruetells the guests of imported meetings too.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedCalendarResource with deleted: true and cancelledMeetings, how many meetings had their guests told.
Example
const gone = await nextmail.calendar.deleteCalendar('cln_3f9a1c7e5b2d48a06c1e9f4b') console.log(`${gone.cancelledMeetings} meetings cancelled`)Notes
Your default calendar cannot be deleted: that is a 409
calendar_is_default.Sending the cancellations needs
emails:sendas well. A key without it passesnotifyGuests: false.
Also available in
calendar.setCalendarMember()
Give a member access to a calendar
setCalendarMember(id: string, memberId: string, body: MemberAccessSet, options?: RequestScope): Promise<CalendarMemberResource>Gives a member of the workspace access to a calendar you keep, or changes what they may do. With read they see its events beside their own calendars; with write they also add, change, move and remove them. Their phones and computers show it as a calendar of its own over CalDAV. Events marked private stay out of their view.
Parameters
idstringRequiredThe calendar id,
cln_followed by 24 hex characters, aslistCalendarsgives it.memberIdstringRequiredThe member id of the person, as
members.listgives it.body.accessCollectionAccessRequiredreadorwrite, fromCOLLECTION_ACCESS_LEVELS.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarMemberResource with the access the member now has.
Example
await nextmail.calendar.setCalendarMember('cln_3f9a1c7e5b2d48a06c1e9f4b', 'q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E', { access: 'write' })Notes
Setting it again changes the access, so retrying is safe.
A calendar may have 100 members. One more is a 409
calendar_member_limit.Someone outside the workspace is a 422
member_not_found, and yourself a 422member_is_keeper.
Also available in
calendar.removeCalendarMember()
Take away a member's access to a calendar
removeCalendarMember(id: string, memberId: string, options?: RequestScope): Promise<DeletedCalendarMemberResource>Takes away a member's access to a calendar you keep. Your own member id leaves a calendar you are a member of.
Parameters
idstringRequiredThe calendar id,
cln_followed by 24 hex characters, aslistCalendarsgives it.memberIdstringRequiredThe member id of the person, as
members.listgives it.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedCalendarMemberResource with deleted: true.
Example
await nextmail.calendar.removeCalendarMember('cln_3f9a1c7e5b2d48a06c1e9f4b', 'q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E')Notes
Removing someone who is not a member is a 422
member_not_found.
Also available in
calendar.listCalendarLogins()
List calendar sign-ins
listCalendarLogins(options?: CalendarLoginListOptions): Promise<Array<CalendarLoginResource>>The calendar sign-ins one person holds, newest first: their names, usernames, the last four letters of each password, who made each one and when a calendar or contacts app last used it. The passwords are never shown again.
A calendar sign-in belongs to a person, not to an address. Its username is cal- and ten letters and digits, never an address, so it can never take one, and it signs calendar and contacts apps in over CalDAV and CardDAV to that person's calendars, the calendars and address books other members gave them access to, and their contacts. IMAP, POP3 and SMTP refuse it, and nothing it does sends mail.
Parameters
options.memberstringThe user id of a member, as
members.listgives it, for the owner or someone whose role manages members. Leave it out for your own, which an API key makes for the workspace owner and an access token for the person who connected the app. Another member's takesmembers:writeinstead ofaccount:read.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
Array<CalendarLoginResource>, newest first. Revoked sign-ins are left out.
Example
const logins = await nextmail.calendar.listCalendarLogins() for (const login of logins) { console.log(login.name, login.username, login.lastUsedAt ?? 'never used')}Notes
A key or app limited to some addresses is refused with 422
capability_unsupported, because a sign-in covers the whole calendar and address book.Someone outside the workspace is a 422
member_not_found, and another member's sign-ins without the authority to manage members a 403insufficient_authority.
Also available in
calendar.createCalendarLogin()
Create a calendar sign-in
createCalendarLogin(body: CalendarLoginCreate, options?: RequestScope): Promise<CreatedCalendarLoginResource>Makes a calendar sign-in and returns its username, its password in password, the CalDAV and CardDAV servers in servers and an Apple configuration profile in appleProfile. That is the only time the password is shown, so hand it over or store it then.
A calendar sign-in belongs to a person, not to an address. Its username is cal- and ten letters and digits, never an address, so it can never take one, and it signs calendar and contacts apps in over CalDAV and CardDAV to that person's calendars, the calendars and address books other members gave them access to, and their contacts. IMAP, POP3 and SMTP refuse it, and nothing it does sends mail.
Besides account:write, or members:write for another member, the key or access token has to hold itself each of calendar:read, calendar:write, contacts:read and contacts:write that the person's role holds, because the sign-in carries them. Without one of them the call is refused with 403 insufficient_authority. It writes an entry in the workspace security log.
Parameters
body.namestringRequiredWhat to call it, such as the device it is for, 1 to 64 characters. It is trimmed.
body.memberstringThe user id of a member, as
members.listgives it, for the owner or someone whose role manages members. Leave it out for your own, which an API key makes for the workspace owner and an access token for the person who connected the app. The owner's own sign-ins are made only by the owner.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CreatedCalendarLoginResource: the CalendarLoginResource as listCalendarLogins returns it, plus password, shown this once, servers (CalendarLoginServers, with caldav and carddav null when the person's role does not reach the calendar or contacts) and appleProfile, an Apple configuration profile with the password inside. Saved as a .mobileconfig file and opened on an iPhone, iPad or Mac, it adds the calendars to Calendar and the contacts to Contacts in one step, and no mail account. It holds the password, so keep it like one.
Example
const created = await nextmail.calendar.createCalendarLogin({ name: 'Kitchen iPad' }) console.log(`Server ${created.servers.caldav?.url}`)console.log(`Sign in as ${created.username} with ${created.password}`)Notes
One person holds at most 20 calendar sign-ins in a workspace, and the 21st is refused with 422
calendar_login_limit_reached, so revoke one withrevokeCalendarLoginfirst. A role that reaches neither the calendar nor contacts is refused with 403calendar_login_no_reach.A key or an access token limited to particular addresses or domains is refused with 422
capability_unsupported.An OAuth access token needs a verification code for this call, and is refused with 403
step_up_requireduntil the app has verified one in the last 60 minutes.isStepUpRequiredon the error says so. An API key is never asked for a code.Not retried automatically by the SDK, since a lost attempt may already have made a sign-in. The success status is 201.
Also available in
calendar.revokeCalendarLogin()
Revoke a calendar sign-in
revokeCalendarLogin(id: string, options?: RequestScope): Promise<DeletedCalendarLoginResource>Revokes one calendar sign-in, so the calendar and contacts apps using it are signed out within minutes. The calendars and contacts stay. Your own takes account:write, and another member's takes members:write, held by the owner or someone whose role manages members. It writes an entry in the workspace security log.
Parameters
idstringRequiredThe sign-in id,
cdl_followed by 24 hex characters, aslistCalendarLoginsgives it.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedCalendarLoginResource with deleted: true.
Example
await nextmail.calendar.revokeCalendarLogin('cdl_6b1e0f9a3c7d48e25a0b9c14')Notes
A sign-in you may not manage, or one already revoked, is a 404
calendar_login_not_found.
Also available in
calendar.createCalendarLoginProfileLink()
Make a link that sets up calendars and contacts on an Apple device
createCalendarLoginProfileLink(body: CalendarLoginProfileLinkCreate, options?: RequestScope): Promise<CalendarLoginProfileLinkResource>Makes a one-time link that sets calendars and contacts up on an iPhone, iPad or Mac in one step. Opening it on the device downloads an Apple configuration profile with a new calendar sign-in inside, with CalDAV and CardDAV only and never mail. The link works once and expires within minutes, so hand it over straight away and treat it as a secret until it is used. It takes what createCalendarLogin takes.
Parameters
body.namestringRequiredWhat to call the sign-in it makes, such as the device it is for, 1 to 64 characters.
body.displayNamestringRequiredThe name the device shows for the profile, 1 to 160 characters.
body.descriptionstringRequiredThe line the device shows under that name, 1 to 160 characters.
body.memberstringThe user id of a member, as
members.listgives it, for the owner or someone whose role manages members. Leave it out for your own, which an API key makes for the workspace owner and an access token for the person who connected the app.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarLoginProfileLinkResource with the url, when it expiresAt and the member the sign-in will belong to.
Example
const link = await nextmail.calendar.createCalendarLoginProfileLink({ name: 'iPhone', displayName: 'Work calendar', description: 'Your calendars and contacts'}) console.log(`Open ${link.url} on the iPhone before ${link.expiresAt}`)Notes
A person can make 10 of these links, and of the links that set up an address on an Apple device, in an hour. One more is a 429
profile_link_rate_limited.An OAuth access token needs a verification code for this call, as
createCalendarLogindoes. An API key is never asked for a code.Not retried automatically by the SDK. The success status is 201.
Also available in
- API
POST /calendar/logins/profile-link- Python
calendar.create_calendar_login_profile_link()- Ruby
calendar.create_calendar_login_profile_link- PHP
calendar->createCalendarLoginProfileLink- Go
Calendar.CreateCalendarLoginProfileLink- Java
calendar().createCalendarLoginProfileLink- C#
Calendar.CreateCalendarLoginProfileLinkAsync
calendar.listTodos()
List to-dos
listTodos(options?: TodoListOptions): Promise<Page<TodoResource>>Returns one page of the to-dos in your to-do lists and in the ones other members of the workspace gave you access to, as the To-dos view of the Calendar page shows them. A to-do list is a calendar of kind todos, and calendar apps such as Reminders, Thunderbird and tasks.org sync each one over CalDAV.
Open to-dos come soonest due first, with the ones without a due date last. Done ones come most recently done first, and all lists the newest first. Paging is keyset. options.limit takes 1 to 500 and defaults to 100, and nextCursor goes back as options.cursor while hasMore is true. listAllTodos and iterateTodos do that walk for you.
Parameters
options.calendarIdsArray<string>Only the to-dos in these to-do lists, as
listCalendars({ kind: 'todos' })gives their ids. Every to-do list you keep or are a member of unless you say.options.stateTodoStateopenfor to-dos still to do,donefor completed and cancelled ones, orall, fromTODO_STATES.openunless you say.options.dueBeforeDate | stringOnly to-dos due before this moment.
options.dueAfterDate | stringOnly to-dos due at or after this moment.
options.limitnumberTo-dos per page, a whole number from 1 to 500. The server defaults to 100.
options.cursorstringThe
nextCursorfrom the previous page. Never build one yourself.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
Page<TodoResource> with items, hasMore and nextCursor.
Example
const page = await nextmail.calendar.listTodos({ dueBefore: new Date(Date.now() + 7 * 86_400_000) }) for (const todo of page.items) console.log(todo.due ?? 'someday', todo.title)Notes
A list id that is a calendar of events is a 422
calendar_wrong_kind, and one you cannot reach a 404calendar_not_found.A cursor that names no to-do in these lists is a 400
invalid_cursor.A key or app limited to some addresses is refused with 422
capability_unsupported, because to-do lists belong to a person, not to an address.
Also available in
calendar.listAllTodos()
Collect every to-do into one array
listAllTodos(options?: TodoListOptions): Promise<Array<TodoResource>>Follows nextCursor from page to page and resolves with every to-do that matches, in the order listTodos gives them.
Everything is held in memory before the promise settles. Prefer iterateTodos when you can stop early. limit sets the page size of each request, not the total.
Parameters
options.calendarIdsArray<string>Only the to-dos in these to-do lists, as
listCalendars({ kind: 'todos' })gives their ids. Every to-do list you keep or are a member of unless you say.options.stateTodoStateopenfor to-dos still to do,donefor completed and cancelled ones, orall, fromTODO_STATES.openunless you say.options.dueBeforeDate | stringOnly to-dos due before this moment.
options.dueAfterDate | stringOnly to-dos due at or after this moment.
options.limitnumberPage size per request, from 1 to 500, defaulting to 100 on the server.
options.cursorstringA cursor from an earlier page to start after.
options.signalAbortSignalCancels the request in flight and rejects the whole walk.
options.apiKeystringOverrides the client API key for every page of this walk.
Returns
Array<TodoResource> holding every matching to-do across all pages.
Example
const done = await nextmail.calendar.listAllTodos({ state: 'done' }) console.log(`${done.length} to-dos done`)Notes
A failure on any page rejects the whole call, and the to-dos already fetched are discarded.
Also available in
calendar.iterateTodos()
Stream to-dos one at a time
iterateTodos(options?: TodoListOptions): AsyncGenerator<TodoResource, void, undefined>Returns an async generator that yields to-dos one by one, in the order listTodos gives them, and requests the next page only once the current one is drained. Nothing is fetched until you consume it, and breaking out of the loop stops the requests.
Parameters
options.calendarIdsArray<string>Only the to-dos in these to-do lists, as
listCalendars({ kind: 'todos' })gives their ids. Every to-do list you keep or are a member of unless you say.options.stateTodoStateopenfor to-dos still to do,donefor completed and cancelled ones, orall, fromTODO_STATES.openunless you say.options.dueBeforeDate | stringOnly to-dos due before this moment.
options.dueAfterDate | stringOnly to-dos due at or after this moment.
options.limitnumberPage size per request, from 1 to 500, defaulting to 100 on the server.
options.cursorstringA cursor from an earlier page to start after.
options.signalAbortSignalCancels the request in flight and rejects the whole walk.
options.apiKeystringOverrides the client API key for every page of this walk.
Returns
AsyncGenerator<TodoResource, void, undefined> yielding one to-do per step.
Example
for await (const todo of nextmail.calendar.iterateTodos()) { if (todo.priority === 0 || todo.priority > 4) continue console.log('urgent', todo.title)}Notes
The generator is lazy, so an abandoned loop costs only the pages you consumed.
Also available in
calendar.getTodo()
Get a to-do
getTodo(id: string, options?: RequestScope): Promise<TodoResource>One to-do in a to-do list you keep or are a member of.
Parameters
idstringRequiredThe to-do id,
tdo_followed by 24 hex characters, aslistTodosgives it.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
TodoResource.
Example
const todo = await nextmail.calendar.getTodo('tdo_8c1e0f3a9b7d42e65a1c0d9e') console.log(todo.title, todo.status, todo.due)Notes
A to-do that is gone, or that is in a list you cannot reach, is a 404
todo_not_found.
Also available in
calendar.createTodo()
Create a to-do
createTodo(body: TodoCreate, options?: RequestScope): Promise<TodoResource>Adds a to-do to a to-do list, as the quick add box of the To-dos view does in the app. It goes in your default to-do list unless you name one with calendarId: one you keep, or one you are a member of with write access. Calendar apps that sync the list show it on their next sync.
Parameters
body.titlestringRequiredWhat has to be done, 1 to 500 characters.
body.calendarIdstringThe to-do list to put it in. Your default to-do list unless you say.
body.notesstring | nullNotes on the to-do, up to 8,000 characters.
body.statusTodoStatusFrom
TODO_STATUSES:NEEDS-ACTION,IN-PROCESS,COMPLETEDorCANCELLED.body.startDate | string | nullWhen work on it can start, in the same form as
due.body.dueDate | string | nullWhen it is due: a day as
YYYY-MM-DD, or a moment as aDateor an ISO 8601 date-time.body.timezonestring | nullThe IANA time zone a moment is written in for calendar apps, such as
Europe/Berlin. UTC unless you say.body.prioritynumberFrom 1, the most urgent, to 9, the least. 0 means none.
body.percentCompletenumber | nullHow far along it is, from 0 to 100.
body.categoriesArray<string>Up to 20 labels of up to 64 characters each.
body.parentIdstring | nullMakes it a step of another to-do in the same list.
body.recurrencestring | nullAn RRULE, such as
FREQ=WEEKLY;BYDAY=MO, that makes it repeat from its start or due date.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
TodoResource for the new to-do.
Example
const list = (await nextmail.calendar.listCalendars({ kind: 'todos' })).find((one) => one.isDefault) await nextmail.calendar.createTodo({ title: 'Renew the passport', calendarId: list?.id, due: '2026-11-20', priority: 1})Notes
startanddueare both days or both moments, and a to-do cannot be due before it starts: otherwise a 400invalid_time.A to-do list holds at most 5,000 to-dos. One more is a 409
todo_limit.calendarIdthat names a calendar of events is a 422calendar_wrong_kind.
Also available in
calendar.updateTodo()
Change a to-do
updateTodo(id: string, patch: TodoPatch, options?: RequestScope): Promise<TodoResource>Changes a to-do, checks it off or opens it again, as the To-dos view does in the app. Send only the fields that change, and null to clear one. status COMPLETED stamps completedAt, and on a repeating to-do it moves the to-do to its next date and keeps it open instead. calendarId moves it, with its steps, to another to-do list.
Parameters
idstringRequiredThe to-do id,
tdo_followed by 24 hex characters.patch.titlestringWhat has to be done, 1 to 500 characters.
patch.calendarIdstringMoves it, with its steps, to this to-do list.
patch.notesstring | nullNotes on the to-do, up to 8,000 characters.
patch.statusTodoStatusFrom
TODO_STATUSES:NEEDS-ACTION,IN-PROCESS,COMPLETEDorCANCELLED.patch.startDate | string | nullWhen work on it can start, in the same form as
due.patch.dueDate | string | nullWhen it is due: a day as
YYYY-MM-DD, or a moment as aDateor an ISO 8601 date-time.patch.timezonestring | nullThe IANA time zone a moment is written in for calendar apps, such as
Europe/Berlin. UTC unless you say.patch.prioritynumberFrom 1, the most urgent, to 9, the least. 0 means none.
patch.percentCompletenumber | nullHow far along it is, from 0 to 100.
patch.categoriesArray<string>Up to 20 labels of up to 64 characters each.
patch.parentIdstring | nullMakes it a step of another to-do in the same list.
patch.recurrencestring | nullAn RRULE, such as
FREQ=WEEKLY;BYDAY=MO, that makes it repeat from its start or due date.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
TodoResource as it stands now.
Example
await nextmail.calendar.updateTodo('tdo_8c1e0f3a9b7d42e65a1c0d9e', { status: 'COMPLETED' })Notes
A to-do in a list you are a member of with read access is a 403
calendar_read_only.parentIdthat names a to-do in another list, or one of its own steps, is a 422todo_parent_invalid.
Also available in
calendar.deleteTodo()
Delete a to-do
deleteTodo(id: string, options?: RequestScope): Promise<DeletedTodoResource>Deletes a to-do and its steps. Calendar apps that sync the list drop them on their next sync.
Parameters
idstringRequiredThe to-do id,
tdo_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedTodoResource: { object, id, deleted: true, removed }, where removed counts every to-do that went: the one you named and its steps.
Example
const gone = await nextmail.calendar.deleteTodo('tdo_8c1e0f3a9b7d42e65a1c0d9e') console.log(`${gone.removed} to-dos deleted`)Notes
A to-do in a list you are a member of with read access is a 403
calendar_read_only.
Also available in
calendar.listFeeds()
List calendar links
listFeeds(options?: RequestScope): Promise<Array<CalendarFeedResource>>Resolves the secret links that publish your calendar to other calendar apps, as Share in the calendar settings of the app lists them. Anyone with a link can read what it shows, so treat url and webcalUrl like passwords.
Parameters
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
Array<CalendarFeedResource>, each with id, name, mode, url, webcalUrl and when calendar apps last read it.
Example
const feeds = await nextmail.calendar.listFeeds() for (const feed of feeds) console.log(feed.name, feed.mode, feed.url)Notes
A key limited to particular addresses or domains is refused with 422
capability_unsupported, because a link covers the whole calendar.
Also available in
calendar.createFeed()
Create a calendar link
createFeed(body: CalendarFeedCreate, options?: RequestScope): Promise<CalendarFeedResource>Makes a secret link that publishes your calendar as an iCalendar feed, for Google Calendar (From URL), Outlook (Subscribe from web) or Apple Calendar (New subscription). full shows every detail, busy only the times you are busy. The calendar app reads the link again on its own schedule, usually every few hours.
Parameters
body.namestringRequiredThe name calendar apps show for the calendar, up to 100 characters.
body.modeCalendarFeedModeRequiredfullfor every detail,busyfor busy times only.body.calendarIdstringThe one calendar you keep that the link publishes. Left out, it publishes every calendar you keep or are a member of, with the events you are invited to.
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarFeedResource with the new url and webcalUrl.
Example
const feed = await nextmail.calendar.createFeed({ name: 'Work (busy)', mode: 'busy' }) console.log('Paste into Google Calendar:', feed.url)Notes
One person may keep 10 links. One more is refused with 409
calendar_feed_limit.
Also available in
calendar.resetFeed()
Reset a calendar link
resetFeed(id: string, options?: RequestScope): Promise<CalendarFeedResource>Replaces the secret in a calendar link, so the old address stops working everywhere it was shared. Paste the new address into the calendar apps you still want to update.
Parameters
idstringRequiredCalendar link id,
cfd_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarFeedResource with its new url and webcalUrl.
Example
const feed = await nextmail.calendar.resetFeed('cfd_3f9a1c7e5b2d48a06c1e9f4b') console.log(feed.url)Notes
A link that is not yours is a 404
calendar_feed_not_found.
Also available in
calendar.deleteFeed()
Delete a calendar link
deleteFeed(id: string, options?: RequestScope): Promise<DeletedCalendarFeedResource>Turns a calendar link off for good. Calendar apps that subscribed to it stop getting updates.
Parameters
idstringRequiredCalendar link id,
cfd_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedCalendarFeedResource with deleted: true.
Example
await nextmail.calendar.deleteFeed('cfd_3f9a1c7e5b2d48a06c1e9f4b')Notes
A link that is not yours is a 404
calendar_feed_not_found.
Also available in
calendar.listSubscriptions()
List calendar subscriptions
listSubscriptions(options?: RequestScope): Promise<Array<CalendarSubscriptionResource>>Resolves the other calendars you subscribe to by link, such as a Google or Outlook calendar address, a team rota or public holidays, as Other calendars in the app lists them. Their events show on your calendar, read-only.
Parameters
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
Array<CalendarSubscriptionResource>, each with name, url, color, status, lastError and how many events it holds.
Example
const subscriptions = await nextmail.calendar.listSubscriptions() for (const subscription of subscriptions) console.log(subscription.name, subscription.status, subscription.eventCount)Notes
statusisfailingwhile reads fail and are retried, andstoppedafter ten failures in a row until you refresh it.
Also available in
calendar.createSubscription()
Subscribe to a calendar
createSubscription(body: CalendarSubscriptionCreate, options?: RequestScope): Promise<CalendarSubscriptionResource>Adds a calendar by its iCalendar link: an https, http or webcal address, such as the secret address of a Google calendar or a published Outlook calendar. It is read at once, then again about every half hour. name defaults to the name the calendar gives itself.
Parameters
body.urlstringRequiredThe calendar link,
https,httporwebcal.body.namestringThe name to show, up to 100 characters.
body.colorCalendarColorThe colour of its events, from
CALENDAR_COLORS.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarSubscriptionResource with its first events read.
Example
const holidays = await nextmail.calendar.createSubscription({ url: 'webcal://example.com/holidays.ics', color: 'green',}) console.log(holidays.name, holidays.eventCount)Notes
An address that does not answer with a calendar is refused with 422
calendar_subscription_unreadable, and one you already subscribe to with 409calendar_subscription_exists.One person may subscribe to 20 calendars.
Also available in
calendar.updateSubscription()
Change a calendar subscription
updateSubscription(id: string, patch: CalendarSubscriptionPatch, options?: RequestScope): Promise<CalendarSubscriptionResource>Renames a subscription or gives it another colour.
Parameters
idstringRequiredSubscription id,
csb_followed by 24 hex characters.patch.namestringThe new name, up to 100 characters.
patch.colorCalendarColorThe new colour, from
CALENDAR_COLORS.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarSubscriptionResource as it stands now.
Example
await nextmail.calendar.updateSubscription('csb_3f9a1c7e5b2d48a06c1e9f4b', { name: 'Team rota', color: 'purple' })Notes
A subscription that is not yours is a 404
calendar_subscription_not_found.
Also available in
calendar.refreshSubscription()
Refresh a calendar subscription
refreshSubscription(id: string, options?: RequestScope): Promise<CalendarSubscriptionResource>Reads a subscribed calendar again now instead of waiting for the next half-hourly read, and restarts one that stopped after repeated failures.
Parameters
idstringRequiredSubscription id,
csb_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
CalendarSubscriptionResource after the read, with status and lastError.
Example
const subscription = await nextmail.calendar.refreshSubscription('csb_3f9a1c7e5b2d48a06c1e9f4b') if (subscription.lastError) console.log('Could not read it:', subscription.lastError)Notes
A calendar read less than a minute ago is refused with 429
calendar_subscription_refresh_too_soon.
Also available in
calendar.deleteSubscription()
Unsubscribe from a calendar
deleteSubscription(id: string, options?: RequestScope): Promise<DeletedCalendarSubscriptionResource>Removes a subscription and every event it brought onto your calendar.
Parameters
idstringRequiredSubscription id,
csb_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
Returns
DeletedCalendarSubscriptionResource with deleted: true.
Example
await nextmail.calendar.deleteSubscription('csb_3f9a1c7e5b2d48a06c1e9f4b')Notes
A subscription that is not yours is a 404
calendar_subscription_not_found.
Also available in
calendar.importIcs()
Import a calendar file
importIcs(data: RawBody, options?: CalendarImportOptions): Promise<CalendarImportResource>Sends an iCalendar (.ics) file as the request body and queues it. Its events become events of your own that you can edit, and nobody on them is sent anything, now or when you change them later, unless you ask for that on the change. Poll getImport until status is completed.
The file may be 10 MB and hold 25,000 events. Several calendars in one file are merged, and the report keeps their names. An event whose UID is already in the workspace is skipped and counted, never overwritten, so sending the same file twice adds nothing.
data is a Blob, an ArrayBuffer or a Uint8Array, and it goes out as text/calendar.
Parameters
dataRawBodyRequiredThe .ics file: a
Blob,ArrayBufferorUint8Array.options.filenamestringThe name to show for the file in the list of imports, at most 255 characters.
options.calendarIdstringThe calendar the events go into: one you keep, or one you are a member of with write access. Your default calendar unless you say.
options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client API key for this call only.
Returns
CalendarImportResource with status: queued.
Example
import { readFile } from 'node:fs/promises' const queued = await nextmail.calendar.importIcs(await readFile('work.ics'), { filename: 'work.ics' }) console.log(queued.id, queued.status)Notes
A body that is not an iCalendar file is a 400
not_a_calendar_file, an empty one a 400item_import_empty, and one holding more than 25,000 events a 400too_many_events.A file over 10 MB is a 413
item_import_too_large.To send text you already hold, such as what
getEventIcsreturns, encode it first withnew TextEncoder().encode(text).An upload that outlasts the client
timeoutMsfails as a network error, so raise it on the client for a large file on a slow connection.Not retried automatically.
Also available in
calendar.listImports()
List calendar imports
listImports(options?: ListOptions): Promise<Page<CalendarImportResource>>Returns one page of the calendar files and calendars brought in, newest first, each with what it added and what it left out. Beside the files sent with importIcs it lists the calendars that came with a mailbox import, and those carry the id of that import in parentImportId.
Paging is keyset. options.limit takes 1 to 100 and defaults to 25, and nextCursor goes back as options.cursor while hasMore is true. listAllImports and iterateImports do that walk for you.
Parameters
options.limitnumberImports per page, a whole number from 1 to 100. The server defaults to 25.
options.cursorstringThe
nextCursorfrom the previous page. Never build one yourself.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client API key for this call only.
Returns
Page<CalendarImportResource> with items, hasMore and nextCursor.
Example
const page = await nextmail.calendar.listImports({ limit: 50 }) for (const item of page.items) console.log(item.fileName, item.status, item.counts.imported, item.counts.skipped)Notes
sourceisfilefor an upload.takeout,caldavandmicrosoftcame with a mailbox import.A cursor that names no import is a 400
invalid_cursor.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client
maxRetries, and on a 429 only when it carries aRetry-Afterof a minute or less.
Also available in
calendar.listAllImports()
Collect every calendar import into one array
listAllImports(options?: ListOptions): Promise<Array<CalendarImportResource>>Follows nextCursor from page to page and resolves with every calendar import, newest first.
Everything is held in memory before the promise settles. Prefer iterateImports when you can stop early. limit sets the page size of each request, not the total.
Parameters
options.limitnumberPage size per request, from 1 to 100, defaulting to 25 on the server.
options.cursorstringA cursor from an earlier page to start after.
options.signalAbortSignalCancels the request in flight and rejects the whole walk.
options.apiKeystringOverrides the client API key for every page of this walk.
Returns
Array<CalendarImportResource> holding every import across all pages.
Example
const imports = await nextmail.calendar.listAllImports() const added = imports.reduce((sum, item) => sum + item.counts.imported, 0) console.log(`${added} events came from ${imports.length} imports`)Notes
A failure on any page rejects the whole call, and the imports already fetched are discarded.
Also available in
calendar.iterateImports()
Stream calendar imports one at a time
iterateImports(options?: ListOptions): AsyncGenerator<CalendarImportResource, void, undefined>Returns an async generator that yields calendar imports one by one, newest first, and requests the next page only once the current one is drained. Nothing is fetched until you consume it, and breaking out of the loop stops the requests.
Parameters
options.limitnumberPage size per request, from 1 to 100, defaulting to 25 on the server.
options.cursorstringA cursor from an earlier page to start after.
options.signalAbortSignalCancels the request in flight and rejects the whole walk.
options.apiKeystringOverrides the client API key for every page of this walk.
Returns
AsyncGenerator<CalendarImportResource, void, undefined> yielding one import per step.
Example
for await (const item of nextmail.calendar.iterateImports()) { if (item.status !== 'running') continue console.log('still running', item.id, item.counts.total) break}Notes
The generator is lazy, so an abandoned loop costs only the pages you consumed.
Also available in
calendar.getImport()
Get a calendar import
getImport(id: string, options?: RequestScope): Promise<CalendarImportResource>Resolves one calendar import with its counts and its report: the calendars it read, how many events it left out and why, and up to 20 of the events it left out. Poll it after importIcs until status is completed or failed.
counts.imported is what was added and counts.skipped what was left out, which report.skipped breaks down by reason: uid-taken for an event that was already here, no-start for one with no start time, invalid for one that could not be read and empty for a file or calendar that held no events.
Parameters
idstringRequiredCalendar import id,
iimp_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client API key for this call only.
Returns
CalendarImportResource with status, counts, report, undoable and when it started, finished and was undone.
Example
const item = await nextmail.calendar.getImport('iimp_3f9c2a7b1e4d8f60a5c7b92d') console.log(item.status, item.counts.imported, item.counts.skipped, item.report.skipped['uid-taken'] ?? 0) for (const sample of item.report.samples) console.log(sample.name, sample.reason)Notes
An id that names no calendar import is a 404
item_import_not_found.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client
maxRetries, and on a 429 only when it carries aRetry-Afterof a minute or less.
Also available in
calendar.undoImport()
Remove what a calendar import added
undoImport(id: string, options?: RequestScope): Promise<CalendarImportResource>Deletes every event the import added, changed since or not, and marks the import undone. Nobody is told. Events that were skipped because they were already here are not touched.
Parameters
idstringRequiredCalendar import id,
iimp_followed by 24 hex characters.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client API key for this call only.
Returns
CalendarImportResource with status: undone and undoneAt set.
Example
const undone = await nextmail.calendar.undoImport('iimp_3f9c2a7b1e4d8f60a5c7b92d') console.log(undone.status, undone.undoneAt, undone.counts.imported)Notes
An import that is still running, or was already removed, is a 409
item_import_not_undoable.undoableon the import says whether the call would remove anything.An id that names no calendar import is a 404
item_import_not_found.Not retried automatically.