Getting Invalid value in 'emails' parameter

After creating a virtual-calendar connector, creating a grant via the api, and creating a calendar. Call the free/busy api results in the following error.

const res = await nylas.calendars.getFreeBusy({
      identifier: import.meta.env.NYLAS_GRANT_ID,
      requestBody: {
        startTime: start,
        endTime: end,
        emails: ["catering-for-pickup"]

NylasApiError: Invalid value in 'emails' parameter: catering-for-pickup

Does this api not work with virtual calendars?

Using a fully qualified emails (against what the docs suggest for virtual accounts) result in -

Grant created: {
  requestId: '8b64856c-d652-4346-b96c-6c74709e1ffa',
  data: {
    id: '1683d7a2-ab8e-4fa3-855d-8f90aa64ba75',
    grantStatus: 'valid',
    provider: 'virtual-calendar',
    scope: [ 'calendar' ],
    email: '',
    ip: '',
    userAgent: 'Nylas Node SDK v7.2.1',
    createdAt: 1711084277,
    updatedAt: 1711084277
Virtual Calendar: {
  requestId: 'ef8304e1-c852-4b57-ae89-a49a0770f273',
  data: {
    description: 'Catering for Pickup',
    name: 'catering-for-pickup',
    grantId: '1683d7a2-ab8e-4fa3-855d-8f90aa64ba75',
    id: 'd76350e3-63fd-46db-8d9f-5987f87957b6',
    object: 'calendar',
    isPrimary: true,
    readOnly: false,
    isOwnedByUser: true
    email: '',
    object: 'error',
    error: 'no primary virtual calendar found',
    timeSlots: null

While I’m not sure why it says there is no primary calendar, it seems the waters are getting muddied by having non emails in the emails field for connections. You may be trying to do too much by having an OAuth system also trying to handle non OAuth related requests. May be better to just have dedicated fields for virtual calendars?

@vacarsu thanks for the message, let me circle back shortly (early next week at the latest)!

@vacarsu - I’m taking a look into this, so I can reproduce your similar issue, let me investigate this further against the docs and implementation to clarify.

@vacarsu - thanks for raising this, will let you know when we ship an update allowing virtual calendars to use the free/busy endpoint :+1:

@vacarsu - we just made a fix to ensure virtual calendars can use the free/busy endpoint, can you check things on your end?