Skip to main content
Deletes a calendar connection permanently. This will stop all calendar syncing and remove the associated OAuth credentials.

Method Signature

await client.calendar.delete(params: BaseCalendarParams): Promise<void>

Parameters

id
string
required
The unique identifier of the calendar connection to delete.

Response

Returns void on successful deletion. No response body is returned.

Examples

Basic Deletion

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

await client.calendar.delete({
  id: 'cal_1234567890abcdef'
});

console.log('Calendar deleted successfully');

Delete with Confirmation

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const calendarId = 'cal_1234567890abcdef';

// Retrieve calendar details first
const calendar = await client.calendar.retrieve({ id: calendarId });

console.log(`About to delete calendar for ${calendar.oauth_email}`);

// Confirm deletion
const confirmed = confirm('Are you sure you want to delete this calendar?');

if (confirmed) {
  await client.calendar.delete({ id: calendarId });
  console.log('Calendar deleted');
} else {
  console.log('Deletion cancelled');
}

Error Handling

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const calendarId = 'cal_1234567890abcdef';

try {
  await client.calendar.delete({ id: calendarId });
  console.log('Calendar deleted successfully');
} catch (error) {
  if (error.status === 404) {
    console.error('Calendar not found - may already be deleted');
  } else {
    console.error('Failed to delete calendar:', error.message);
  }
}

Delete Disconnected Calendars

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

// Get all disconnected calendars
const response = await client.calendar.list({
  status: 'disconnected'
});

console.log(`Found ${response.data.length} disconnected calendars`);

// Delete each disconnected calendar
for (const calendar of response.data) {
  await client.calendar.delete({ id: calendar.id });
  console.log(`Deleted disconnected calendar: ${calendar.oauth_email}`);
}

console.log('Cleanup complete');

Delete by Email

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const emailToDelete = '[email protected]';

// Find calendar by email
const response = await client.calendar.list({
  email: emailToDelete
});

if (response.data.length > 0) {
  const calendar = response.data[0];
  await client.calendar.delete({ id: calendar.id });
  console.log(`Deleted calendar for ${emailToDelete}`);
} else {
  console.log('No calendar found for that email');
}

Batch Deletion

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const calendarIds = [
  'cal_1234567890abcdef',
  'cal_abcdef1234567890',
  'cal_fedcba0987654321'
];

// Delete multiple calendars in parallel
await Promise.all(
  calendarIds.map(id => client.calendar.delete({ id }))
);

console.log(`Deleted ${calendarIds.length} calendars`);

Safe Deletion with Retry

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const calendarId = 'cal_1234567890abcdef';

async function safeDelete(id: string, retries = 3) {
  for (let i = 0; i < retries; i++) {
    try {
      await client.calendar.delete({ id });
      console.log('Calendar deleted successfully');
      return true;
    } catch (error) {
      if (error.status === 404) {
        console.log('Calendar already deleted');
        return true;
      }
      if (i === retries - 1) {
        throw error;
      }
      console.log(`Retry ${i + 1}/${retries}...`);
      await new Promise(resolve => setTimeout(resolve, 1000));
    }
  }
  return false;
}

await safeDelete(calendarId);

Delete Old Calendars

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

// Get calendars older than 90 days
const ninetyDaysAgo = new Date();
ninetyDaysAgo.setDate(ninetyDaysAgo.getDate() - 90);

const response = await client.calendar.list({});

// Filter and delete old calendars
for (const calendar of response.data) {
  const createdAt = new Date(calendar.created_at);
  if (createdAt < ninetyDaysAgo && calendar.status === 'disconnected') {
    await client.calendar.delete({ id: calendar.id });
    console.log(`Deleted old calendar: ${calendar.oauth_email}`);
  }
}

Notes

  • Deletion is permanent and cannot be undone
  • All calendar sync data will be removed
  • OAuth credentials are securely deleted
  • Returns a 404 error if the calendar has already been deleted
  • Consider archiving important calendar data before deletion
  • Deleting a calendar does not revoke OAuth permissions - users should revoke access in their Google/Microsoft account settings

Build docs developers (and LLMs) love