client.bookings()
Every method in this namespace: its signature, its parameters, what it returns and an example.
Methods
Public links where somebody books a meeting on a person's calendar: create a booking page, change its hours, questions and rules, pause or delete it, read the times it offers, list the meetings guests booked, and approve, decline or cancel one. An API key acts for the workspace owner, and an app for the person who connected it.
bookings().listPages
List the booking pages of the person
List<Map<String, Object>> listPages(RequestOptions options)Returns every booking page of the person, oldest first. A booking page is a public link, /book/<slug>, where somebody picks a free time and books a meeting on the calendar of that person. Each page comes with its settings in config, the link to hand to guests in url, and in counts how many of its bookings are upcoming and how many wait for approval.
status is active while the page takes bookings and paused while its link works but offers no times. problem says what stops a page from taking bookings and is null when nothing does. away lists the out of office periods that close the page. A person holds at most 25 pages, so the list comes whole and is never paged.
Parameters
options.apiKeyStringOverrides the client's API key for this call only.
Returns
A list of booking page maps, each with id, slug, name, status, url, problem, config, counts, away, createdAt and updatedAt.
Example
List<Map<String, Object>> pages = client.bookings().listPages(); for (Map<String, Object> page : pages) { System.out.println(page.get("name") + " " + page.get("url") + " " + page.get("status") + " " + page.get("counts"));}Notes
A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
problemissenderwhenconfig.fromEmailcan no longer send,hourswhen no hours are open at all, andhostwhen the person left the workspace.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
bookings().getPage
Read one booking page by id
Map<String, Object> getPage(String id, RequestOptions options)Looks up a single booking page and returns it in the same shape as a row of listPages, with every setting in config: the meeting lengths, where the meeting happens, the weekly hours and the dates with their own hours, the notice, the buffers and the daily limit, whether a booking waits for approval, the address its emails come from, the questions a guest is asked, how the page looks and what a guest may change afterwards.
config.availability.weekly holds seven lists, Sunday first, of the hours open on that weekday, each as minutes after midnight in config.availability.timezone. problem says what stops the page from taking bookings, and away lists the out of office periods of config.fromEmail that are running or still to come. While config.busy.outOfOffice is true the page offers no times inside them.
Parameters
idStringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, aslistPagesreturns it.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with id, slug, name, status, url, problem, config, counts, away, createdAt and updatedAt.
Example
Map<String, Object> page = client.bookings().getPage("bkp_5c1e9a7b3d2f48e6a0b4c7d1"); System.out.println(page.get("url") + " " + page.get("status") + " " + page.get("problem"));System.out.println(page.get("config"));Notes
A missing page throws a
NotFoundException, whoseisNotFound()is true and whosecode()isbooking_page_not_found. A page that belongs to somebody else in the workspace is missing too.A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
bookings().createPage
Create a booking page
Map<String, Object> createPage(Map<String, Object> body, RequestOptions options)Creates a booking page and returns it as it is stored. The page takes bookings at once, at the link in url. Only name is required: the page starts with weekdays from 09:00 to 17:00, 30 minute meetings, four hours of notice, times up to 60 days ahead and the first address the person may send from. Anything in config replaces that default, and what it leaves out keeps it.
slug is the last part of the public link, /book/<slug>. Left out, it is made from the name. timezone says which time zone the working hours are read in when config.availability.timezone is not sent.
The times a page offers are its working hours with everything taken out that makes the person busy: their calendar events, invitations they have not declined, calendars they subscribed to, bookings they already have, the gaps the page keeps around meetings, and the days they are out of office. A booking is a calendar event organised by config.fromEmail, and the guest is told by email from that address, so the call needs emails:send beside calendar:write.
Parameters
body.nameStringRequiredWhat the page is called, shown to guests as its heading, such as
Intro call. Trimmed, 1 to 80 characters.body.slugStringThe last part of the public link: 3 to 60 lowercase letters and digits, with single hyphens between words. It is unique across OpenEmail. Left out, it is made from the name.
body.timezoneStringThe IANA time zone the working hours are read in, such as
Europe/Berlin, whenconfig.availability.timezoneis not sent. Defaults toUTC.body.config.descriptionStringText shown under the name of the page, up to 2,000 characters. Basic Markdown works: bold, italic, links and lists. Defaults to none.
body.config.hostNameStringThe name guests see as the person they meet, up to 80 characters. Defaults to the name of the account.
body.config.durationsList<Integer>The meeting lengths a guest can pick, in minutes: 1 to 4 of them, each a multiple of 5 between 5 and 720. Defaults to
List.of(30).body.config.location.kindStringWhere the meeting happens:
videowith a fixed link invalue,phone, where the guest is asked for a number,in-personwith the address invalue, ornone. Defaults tonone.body.config.location.valueStringThe
https://link of avideomeeting or the address of anin-personone, up to 500 characters. It is dropped forphoneandnone.body.config.availability.timezoneStringThe IANA time zone the hours of the page are read in. Defaults to
timezone.body.config.availability.weeklyList<List<Map<String, Object>>>Seven lists, Sunday first, of the hours open on that weekday. Each range is a map with
startandendin minutes after midnight, soBody.of("start", 540, "end", 1020)is 09:00 to 17:00. An empty list closes the day, and a day takes at most 6 ranges. Defaults to 09:00 to 17:00 from Monday to Friday.body.config.availability.overridesList<Map<String, Object>>Dates with their own hours, at most 180, each a map with
dateandranges.dateisYYYY-MM-DDin the time zone of the page, and an emptyrangescloses that date. Defaults to none.body.config.rules.noticeMinutesintHow many minutes ahead a booking has to be made, from 0 to 43,200. Defaults to 240.
body.config.rules.horizonDaysintHow many days ahead the page offers times, from 1 to 365. Defaults to 60.
body.config.rules.intervalMinutesint or nullMinutes between two start times: 5, 10, 15, 20, 30, 45, 60, 90 or 120. Null, the default, steps by the length of the meeting.
body.config.rules.bufferBeforeMinutesintMinutes kept free before every meeting, from 0 to 240. Defaults to 0.
body.config.rules.bufferAfterMinutesintMinutes kept free after every meeting, from 0 to 240. Defaults to 0.
body.config.rules.dailyLimitint or nullThe most bookings the page takes on one day, from 1 to 50. Null, the default, sets no limit.
body.config.approvalbooleanTrue holds each new booking as a request until
approveordeclineanswers it. False, the default, confirms it at once.body.config.fromEmailStringThe address the booking emails are sent from and the calendar events are organised by. It has to be one the owner of the page may send from. Defaults to the first such address.
body.config.notifyHostbooleanWhether
fromEmailgets an email about each new, moved or cancelled booking. Defaults to true.body.config.questionsList<Map<String, Object>>What the guest is asked besides their name and email, at most 10, each a map with
id,kind,label,requiredandoptions.idis a stable key for the answers: 4 to 16 lowercase letters and digits, unique on the page.kindistext,long-text,phone,choiceorcheckbox.optionsholds the answers of achoicequestion, from 2 to 12, and is empty for the other kinds. Defaults to none.body.config.confirmationStringText shown to the guest after booking and added to the confirmation email, up to 1,000 characters. Defaults to none.
body.config.redirectUrlStringAn
https://page to send the guest to after booking, or an empty string for none, which is the default.body.config.appearance.accentStringThe colour of buttons and the picked day, as
#rrggbb. Defaults to#18181b.body.config.appearance.themeStringautofollows the device of the guest, andlightordarkforces one. Defaults toauto.body.config.appearance.showAvatarbooleanWhether the page shows the photo of the person, or their initials when they have none. Defaults to true.
body.config.guestChanges.cancelbooleanWhether a guest may cancel from the link in their emails. Defaults to true.
body.config.guestChanges.reschedulebooleanWhether a guest may move the meeting from the link in their emails. Defaults to true.
body.config.guestChanges.cutoffMinutesintHow many minutes before the meeting those changes close, from 0 to 20,160. Defaults to 0.
body.config.busy.addressesList<String> or nullThe addresses whose invitations block time unless declined, at most 50. Null, the default, checks every address the person holds.
body.config.busy.subscriptionsbooleanWhether events from calendars the person subscribed to block time. Defaults to true.
body.config.busy.outOfOfficebooleanWhether the page offers no times while
fromEmailis out of office. Defaults to true.body.config.seo.titlestringThe title of the browser tab and of a search result, up to 120 characters. Empty, the default, uses the name of the page and the host.
body.config.seo.descriptionstringThe summary under the title in a search result, up to 300 characters. Empty, the default, uses the start of the description.
body.config.seo.indexablebooleanWhether search engines may list the page. Defaults to false, which asks them not to.
body.config.extraGuestsintHow many other people a guest may add to a booking, 0 to 10. Each one gets the invitation and every later change. Defaults to 0, which hides the field.
options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with the new id, status active, the slug and url of its link, and config with every default filled in.
Example
Map<String, Object> page = client.bookings().createPage(Body.of( "name", "Intro call", "timezone", "Europe/Berlin", "config", Body.of( "description", "A first conversation about your project.", "durations", List.of(30, 60), "location", Body.of("kind", "video", "value", "https://meet.example.com/ada"), "rules", Body.of("bufferAfterMinutes", 15), "approval", true ))); System.out.println(page.get("id") + " " + page.get("url") + " " + page.get("config"));Notes
A booking page belongs to one person. An API key acts as the workspace owner and makes a page of the owner, and a connected app makes a page of the person who connected it.
A person holds at most 25 pages. One more is a 403
booking_page_limit_reached.A
sluganother page already uses is a 409booking_link_taken. A slug that is not a valid link, afromEmailthe person may not send from, avideolocation without a link, anin-personone without an address and two questions with the sameidare 422invalid_booking_page, with the reason in the message. A few slugs such asmanageandadminare reserved.A value of the wrong type or length, a range that ends before it starts and a time zone in
config.availabilitythat is not known are 422invalid_parameterwithparam()naming the field. A key besidename,slug,timezoneandconfigis 422unknown_parameter.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.Not retried automatically. A slug made from the name gets a few random characters when the plain one is taken, so a retry after a lost response can leave two pages. List them and delete the spare.
Also available in
bookings().updatePage
Change the name, the link, the status or any setting of a booking page
Map<String, Object> updatePage(String id, Map<String, Object> patch, RequestOptions options)Changes a booking page and returns it as it is stored. Send only what changes: a field left out stays as it is, and a patch with nothing in it is a 422.
config is merged, not replaced. A top-level value such as approval or fromEmail replaces the stored one. Inside location, availability, rules, appearance, guestChanges, busy and seo each field is merged on its own, so a config of Body.of("rules", Body.of("dailyLimit", 4)) leaves the notice and the buffers alone. A list is replaced whole: send every entry of durations, questions, availability.weekly or availability.overrides again, not only the ones that change.
Set status to paused to stop offering times without losing the link, and to active to offer them again. Bookings already made keep their time whatever changes. A new slug moves the page to a new link and the old one stops working, so links already handed out break.
Parameters
idStringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, aslistPagesreturns it.patch.nameStringNew name, shown to guests as the heading of the page. Trimmed, 1 to 80 characters. Left out, the name stays.
patch.slugStringNew last part of the public link: 3 to 60 lowercase letters and digits, with single hyphens between words. It is unique across OpenEmail. Left out, the link stays.
patch.statusStringactivetakes bookings.pausedkeeps the link working but offers no times. Left out, it stays.patch.config.descriptionStringText shown under the name of the page, up to 2,000 characters. Basic Markdown works: bold, italic, links and lists. An empty string clears it.
patch.config.hostNameStringThe name guests see as the person they meet, up to 80 characters.
patch.config.durationsList<Integer>The meeting lengths a guest can pick, in minutes, replacing the list the page had: 1 to 4 of them, each a multiple of 5 between 5 and 720.
patch.config.location.kindStringWhere the meeting happens:
videowith a fixed link invalue,phone, where the guest is asked for a number,in-personwith the address invalue, ornone.patch.config.location.valueStringThe
https://link of avideomeeting or the address of anin-personone, up to 500 characters. It is dropped forphoneandnone.patch.config.availability.timezoneStringThe IANA time zone the hours of the page are read in, such as
Europe/Berlin.patch.config.availability.weeklyList<List<Map<String, Object>>>All seven lists again, Sunday first, of the hours open on that weekday. Each range is a map with
startandendin minutes after midnight, soBody.of("start", 540, "end", 1020)is 09:00 to 17:00. An empty list closes the day, and a day takes at most 6 ranges.patch.config.availability.overridesList<Map<String, Object>>Every date with its own hours again, at most 180, each a map with
dateandranges.dateisYYYY-MM-DDin the time zone of the page, and an emptyrangescloses that date. An empty list removes them all.patch.config.rules.noticeMinutesintHow many minutes ahead a booking has to be made, from 0 to 43,200.
patch.config.rules.horizonDaysintHow many days ahead the page offers times, from 1 to 365.
patch.config.rules.intervalMinutesint or nullMinutes between two start times: 5, 10, 15, 20, 30, 45, 60, 90 or 120. Null steps by the length of the meeting.
patch.config.rules.bufferBeforeMinutesintMinutes kept free before every meeting, from 0 to 240.
patch.config.rules.bufferAfterMinutesintMinutes kept free after every meeting, from 0 to 240.
patch.config.rules.dailyLimitint or nullThe most bookings the page takes on one day, from 1 to 50. Null sets no limit.
patch.config.approvalbooleanTrue holds each new booking as a request until
approveordeclineanswers it. False confirms it at once. Requests already waiting keep waiting.patch.config.fromEmailStringThe address the booking emails are sent from and the calendar events are organised by. It has to be one the owner of the page may send from.
patch.config.notifyHostbooleanWhether
fromEmailgets an email about each new, moved or cancelled booking.patch.config.questionsList<Map<String, Object>>Every question again, at most 10, each a map with
id,kind,label,requiredandoptions.idis a stable key for the answers: 4 to 16 lowercase letters and digits, unique on the page.kindistext,long-text,phone,choiceorcheckbox.optionsholds the answers of achoicequestion, from 2 to 12, and is empty for the other kinds. An empty list asks nothing more.patch.config.confirmationStringText shown to the guest after booking and added to the confirmation email, up to 1,000 characters. An empty string clears it.
patch.config.redirectUrlStringAn
https://page to send the guest to after booking, or an empty string for none.patch.config.appearance.accentStringThe colour of buttons and the picked day, as
#rrggbb.patch.config.appearance.themeStringautofollows the device of the guest, andlightordarkforces one.patch.config.appearance.showAvatarbooleanWhether the page shows the photo of the person, or their initials when they have none.
patch.config.guestChanges.cancelbooleanWhether a guest may cancel from the link in their emails.
patch.config.guestChanges.reschedulebooleanWhether a guest may move the meeting from the link in their emails.
patch.config.guestChanges.cutoffMinutesintHow many minutes before the meeting those changes close, from 0 to 20,160.
patch.config.busy.addressesList<String> or nullThe addresses whose invitations block time unless declined, at most 50. Null checks every address the person holds.
patch.config.busy.subscriptionsbooleanWhether events from calendars the person subscribed to block time.
patch.config.busy.outOfOfficebooleanWhether the page offers no times while
fromEmailis out of office.patch.config.seo.titlestringThe title of the browser tab and of a search result, up to 120 characters. An empty string goes back to the name of the page and the host.
patch.config.seo.descriptionstringThe summary under the title in a search result, up to 300 characters. An empty string goes back to the start of the description.
patch.config.seo.indexablebooleanWhether search engines may list the page.
patch.config.extraGuestsintHow many other people a guest may add to a booking, 0 to 10. Each one gets the invitation and every later change. 0 hides the field.
options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with the unchanged id, and everything else as it is now.
Example
Map<String, Object> page = client.bookings().updatePage("bkp_5c1e9a7b3d2f48e6a0b4c7d1", Body.of( "config", Body.of( "durations", List.of(45), "rules", Body.of("bufferAfterMinutes", 15, "dailyLimit", 4) ))); System.out.println(page.get("status") + " " + page.get("config"));Notes
A missing page is a 404
booking_page_not_found, and so is a page that belongs to somebody else in the workspace.A
sluganother page already uses is a 409booking_link_taken. A slug that is not a valid link, afromEmailthe person may not send from, avideolocation without a link, anin-personone without an address and two questions with the sameidare 422invalid_booking_page, with the reason in the message.An empty patch, a value of the wrong type or length, a range that ends before it starts and a time zone that is not known are 422
invalid_parameter. A key besidename,slug,statusandconfigis 422unknown_parameter.A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK retries this call after a network failure, since the same patch sent twice leaves the same page.
Also available in
bookings().deletePage
Delete a booking page
Map<String, Object> deletePage(String id, RequestOptions options)Deletes a booking page for good. Its public link stops working and the list of its bookings goes with it, so list no longer shows them and guests can no longer move or cancel through the links in their emails. The meetings already booked stay on the calendar, where calendar().cancelEvent can still call one off.
There is no undo. To stop offering times and keep the page, its link and its bookings, use updatePage with status paused.
Parameters
idStringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, aslistPagesreturns it.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with object set to booking_page, id and deleted set to true.
Example
Map<String, Object> removed = client.bookings().deletePage("bkp_5c1e9a7b3d2f48e6a0b4c7d1"); System.out.println(removed.get("id") + " " + removed.get("deleted"));Notes
It sends no email, so it needs
calendar:writealone. Guests are not told that the page is gone.The SDK does not retry a delete. A 404
booking_page_not_foundon your own second attempt after a lost response means the first one worked.A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
bookings().listTimes
List the times a booking page offers
Map<String, Object> listTimes(String id, RequestOptions options)Returns the start times a guest could book on a page inside a window, in order. They are the hours of the page with everything taken out that makes the person busy: their calendar events, invitations they have not declined, calendars they subscribed to, bookings they already have, the gaps the page keeps around meetings, its daily limit, its notice and the out of office periods that close it.
The window starts at from, or now, and ends at to, or 14 days later. It covers at most 62 days, and a later to is cut back to that. durationMinutes picks which meeting length the times are for and has to be one of the durations of the page. Left out, the shortest is used. Both bounds take an Instant or an ISO 8601 string, and the SDK sends an Instant as an ISO 8601 instant in UTC.
A paused page still answers, so the times can be checked before it is turned on. A page with a problem offers nothing.
Parameters
idStringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, aslistPagesreturns it.options.fromInstant or StringThe start of the window. Defaults to now.
options.toInstant or StringThe end of the window, later than
from. Defaults to 14 days afterfrom, and counts for at most 62 days after it.options.durationMinutesintThe meeting length in minutes, one of the
durationsof the page. Defaults to the shortest.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with pageId, the timezone of the page, the durationMinutes the times are for, and times, a list of every open start time in the window as an ISO 8601 instant in UTC.
Example
Instant from = Instant.now();Instant to = from.plus(Duration.ofDays(7));Map<String, Object> open = client.bookings().listTimes("bkp_5c1e9a7b3d2f48e6a0b4c7d1", RequestOptions.create().set("from", from).set("to", to).set("durationMinutes", 30)); System.out.println(open.get("timezone") + " " + open.get("durationMinutes")); if (open.get("times") instanceof List<?> times) { for (Object time : times) { System.out.println(time); }}Notes
A
tothat is not later thanfromand adurationMinutesthe page does not offer are 422invalid_parameter. A missing page is a 404booking_page_not_found.The times are instants, so show them to a person in a time zone:
timezonenames the one the hours of the page are read in.It reads the calendar as it is now and holds nothing. A time it lists can be gone a moment later, when a guest books it.
A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
bookings().list
List the meetings guests booked, a page at a time
Page list(RequestOptions options)Returns one page of bookings: the meetings guests booked on the booking pages of the person, or on one page with pageId. listAll collects every page and iterate walks them lazily. A booking is a calendar event with the guest invited, so it shows wherever the calendar does, and a meeting moved or cancelled in the calendar reads as moved or cancelled here.
view picks which bookings are listed. upcoming, the default, holds the confirmed meetings that are not over. pending holds the requests that wait for approve or decline, on a page whose config.approval is true. past holds the meetings that are over and the requests nobody answered in time, and ended holds the ones that were declined or cancelled. upcoming and pending come soonest first, past and ended latest first.
Each booking names its page in pageId and pageName, the guest in guest, what they answered in answers and its calendar event in eventId.
Parameters
options.viewStringWhich bookings to list:
upcoming,pending,pastorended. Defaults toupcoming.options.pageIdStringOnly the bookings of this booking page, by its id. Left out, the bookings of every page of the person are listed.
options.limitintPage size, from 1 to 100. The server defaults to 30.
options.cursorStringThe
nextCursorof the previous page, passed back as it came. Leave it out for the first page.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A Page of booking maps, with items, hasMore and nextCursor. Each item has id, pageId, pageName, status, expired, past, start, end, durationMinutes, guest, answers, location, eventId, endedBy, endReason, rescheduleCount, guestMailFailed and createdAt.
Example
Page page = client.bookings().list(RequestOptions.of("view", "pending")); for (Map<String, Object> booking : page) { System.out.println(booking.get("id") + " " + booking.get("pageName") + " " + booking.get("guest") + " " + booking.get("start"));} if (page.hasMore()) { System.out.println("Next page: " + page.nextCursor());}Notes
statusispendingwhile a booking waits for approval,confirmedonce the meeting stands,declinedwhen a request was turned down andcancelledwhen a confirmed meeting was called off.expiredis true for a request nobody answered before its time came, andpastonce the meeting is over.A
pageIdthat is not a page of the person answers 404booking_page_not_found, and a cursor this list did not hand out 400invalid_cursor.The cursor marks how far into the view the last page reached. A booking that enters or leaves the view between two pages shifts the rows after it, so read the view again when an exact list matters.
An API key acts as the workspace owner and reads the bookings of the owner, and a connected app reads the bookings of the person who connected it. One guest address holds at most 3 upcoming bookings on a page.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
- API
GET /bookings- TypeScript
bookings.list()- Python
bookings.list()- Ruby
bookings.list- PHP
bookings->list- Go
Bookings.List- C#
Bookings.ListAsync- CLI
openemail bookings list
bookings().listAll
Collect every booking of a view into one list
List<Map<String, Object>> listAll(RequestOptions options)Walks every page of list and returns all bookings of one view in one list, in the order of that view: upcoming and pending soonest first, past and ended latest first. One request per page. Give pageId to collect only the bookings of one booking page.
Parameters
options.viewStringWhich bookings to collect:
upcoming,pending,pastorended. Defaults toupcoming.options.pageIdStringOnly the bookings of this booking page, by its id. Left out, the bookings of every page of the person are collected.
options.limitintPage size for each request, from 1 to 100. The server defaults to 30.
options.cursorStringStarts the walk after this cursor instead of the first page.
options.apiKeyStringOverrides the client's API key for every page of this walk.
Returns
A list of booking maps holding every booking of the view.
Example
List<Map<String, Object>> bookings = client.bookings().listAll(RequestOptions.of("view", "upcoming").limit(100)); for (Map<String, Object> booking : bookings) { if (Boolean.TRUE.equals(booking.get("guestMailFailed"))) { System.out.println(booking.get("id") + " " + booking.get("guest") + " " + booking.get("start")); }}Notes
If any page fails, the exception is thrown and the bookings already fetched are discarded.
The
pastandendedviews grow without end, so preferiteratethere and stop when you have read far enough back.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
bookings().iterate
Stream the bookings of a view one at a time
PagedIterable iterate(RequestOptions options)Returns a PagedIterable that yields the bookings of one view one at a time, in the order of that view, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and breaking out of the for stops the requests.
Parameters
options.viewStringWhich bookings to walk:
upcoming,pending,pastorended. Defaults toupcoming.options.pageIdStringOnly the bookings of this booking page, by its id. Left out, the bookings of every page of the person are walked.
options.limitintPage size for each request, from 1 to 100. The server defaults to 30.
options.cursorStringStarts the walk after this cursor instead of the first page.
options.apiKeyStringOverrides the client's API key for every page of this walk.
Returns
A PagedIterable that yields one booking map per step.
Example
for (Map<String, Object> booking : client.bookings().iterate(RequestOptions.of("view", "ended"))) { System.out.println(booking.get("start") + " " + booking.get("pageName") + " " + booking.get("endedBy") + " " + booking.get("endReason"));}Notes
The
PagedIterableis lazy, so an abandoned loop costs only the pages you consumed.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
- API
GET /bookings- TypeScript
bookings.iterate()- Python
bookings.iterate()- Ruby
bookings.iterate- PHP
bookings->iterate- Go
Bookings.Iterate- C#
Bookings.IterateAsync
bookings().get
Read one booking by id
Map<String, Object> get(String id, RequestOptions options)Looks up a single booking and returns it in the same shape as a row of list: the booking page it was made on, the guest with the time zone they booked in, what they answered to the questions of the page, where the meeting happens as the guest was told, the calendar event it is and how it ended if it did.
A booking follows its calendar event. Reading one first catches up with the calendar, so a meeting that was moved there shows its new start and end, and one that was cancelled or deleted there reads cancelled, or declined when it still waited for approval. endedBy says whether the host or the guest declined or cancelled it, and endReason holds the reason they gave. guestMailFailed is true when the last email to the guest could not be sent, and resendEmail tries again.
Parameters
idStringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, aslistreturns it.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with id, pageId, pageName, status, expired, past, start, end, durationMinutes, guest, answers, location, eventId, endedBy, endReason, rescheduleCount, guestMailFailed and createdAt.
Example
Map<String, Object> booking = client.bookings().get("bkg_2b8d4f6a1c3e5079b6d8f0a2"); System.out.println(booking.get("status") + " " + booking.get("start") + " " + booking.get("guest"));System.out.println(booking.get("answers"));Notes
A missing booking throws a
NotFoundException, whoseisNotFound()is true and whosecode()isbooking_not_found. A booking on a page that belongs to somebody else in the workspace is missing too.eventIdis the idcalendar().getEventreads. It is null once the booking ended and its event was removed.Each answer carries the
id,labelandkindof its question as it was asked, and itsvalueas text. Acheckboxanswersyesorno.An API key acts as the workspace owner and reads the bookings of the owner, and a connected app reads the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
- API
GET /bookings/{id}- TypeScript
bookings.get()- Python
bookings.get()- Ruby
bookings.get- PHP
bookings->get- Go
Bookings.Get- C#
Bookings.GetAsync- CLI
openemail bookings get
bookings().approve
Confirm a booking that waits for approval
Map<String, Object> approve(String id, RequestOptions options)Confirms a booking that waits for approval, on a booking page whose config.approval is true. The hold on the calendar becomes a confirmed meeting, and the guest is told by email, sent from the address of the page with the calendar invitation attached. It takes no body.
The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write. list with view pending reads the bookings that wait.
Parameters
idStringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, aslistreturns it.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with status confirmed, and guestMailFailed saying whether the email to the guest went out.
Example
Map<String, Object> booking = client.bookings().approve("bkg_2b8d4f6a1c3e5079b6d8f0a2"); System.out.println(booking.get("status") + " " + booking.get("start") + " " + booking.get("guestMailFailed"));Notes
A booking that is not waiting for approval answers 409
booking_not_pending, and one whose time has passed 409booking_ended. A missing one is a 404booking_not_found.The booking is confirmed even when the email cannot be sent.
guestMailFailedis then true, andresendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. A 409
booking_not_pendingon your own second attempt after a lost response means the first one worked or the guest withdrew, andgetsays which.
Also available in
bookings().decline
Turn down a booking that waits for approval
Map<String, Object> decline(String id, Map<String, Object> body, RequestOptions options)Turns down a booking that waits for approval and frees its time, so the page offers that time again. The guest is told by email, sent from the address of the page, with reason in it when one is given. Call decline with the id alone to decline without a reason.
The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write.
Parameters
idStringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, aslistreturns it.body.reasonString or nullA sentence for the guest, trimmed, at most 500 characters, included in the email they get. Left out or null, the email gives no reason.
options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with status declined, endedBy host and endReason holding the reason, or null.
Example
Map<String, Object> booking = client.bookings().decline("bkg_2b8d4f6a1c3e5079b6d8f0a2", Body.of("reason", "I am away that week. Please pick a time after the 20th.")); System.out.println(booking.get("status") + " " + booking.get("endReason"));Notes
A booking that is not waiting for approval answers 409
booking_not_pending. To call off a confirmed meeting, usecancel. A missing booking is a 404booking_not_found.A
reasonover 500 characters is 422invalid_parameter, and a key the body does not take is 422unknown_parameter.The booking is declined even when the email cannot be sent.
guestMailFailedis then true, andresendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. A 409
booking_not_pendingon your own second attempt after a lost response means the first one worked or somebody else answered, andgetsays which.
Also available in
bookings().cancel
Cancel a booked meeting
Map<String, Object> cancel(String id, Map<String, Object> body, RequestOptions options)Cancels a meeting that has not ended yet and cancels its calendar event. The guest is told by email, sent from the address of the page with the cancellation attached, and with reason in it when one is given. Call cancel with the id alone to cancel without a reason.
A booking that still waits for approval is declined instead, so it ends as declined, not cancelled. The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write.
Parameters
idStringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, aslistreturns it.body.reasonString or nullA sentence for the guest, trimmed, at most 500 characters, included in the email they get. Left out or null, the email gives no reason.
options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with status cancelled, or declined when it still waited for approval, endedBy host and endReason holding the reason, or null.
Example
Map<String, Object> booking = client.bookings().cancel("bkg_2b8d4f6a1c3e5079b6d8f0a2", Body.of("reason", "Something urgent came up. Please book another time.")); System.out.println(booking.get("status") + " " + booking.get("endedBy") + " " + booking.get("endReason"));Notes
A booking that was already declined or cancelled, or whose meeting is over, answers 409
booking_ended. A missing one is a 404booking_not_found.There is no undo. The time is free again and the guest has to book once more.
A
reasonover 500 characters is 422invalid_parameter, and a key the body does not take is 422unknown_parameter.The booking is cancelled even when the email cannot be sent.
guestMailFailedis then true, andresendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. A 409
booking_endedon your own second attempt after a lost response means the first one worked or the guest cancelled, andgetsays which.
Also available in
bookings().resendEmail
Send the guest the email about their booking again
Map<String, Object> resendEmail(String id, RequestOptions options)Sends the guest the email that matches where the booking stands now: the request while it waits for approval, the confirmation with its invitation once it is confirmed, or the notice that it was declined or cancelled, with the reason that was given. Use it when guestMailFailed is true. It takes no body and changes nothing else about the booking.
Parameters
idStringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, aslistreturns it.options.apiKeyStringOverrides the client's API key for this call only.
Returns
A map with guestMailFailed as it is after the send: false when the email went out, true when it failed again.
Example
Map<String, Object> booking = client.bookings().resendEmail("bkg_2b8d4f6a1c3e5079b6d8f0a2"); if (Boolean.TRUE.equals(booking.get("guestMailFailed"))) { System.out.println("Still not sent to " + booking.get("guest"));}Notes
A missing booking is a 404
booking_not_found.It answers 200 whether or not the email went out, so read
guestMailFailedto know.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.Not retried automatically: every call sends another email, so a retry after a lost response can reach the guest twice.