> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syncline.run/llms.txt
> Use this file to discover all available pages before exploring further.

# DELETE /v1/calendars/{email}

> Disconnect a user's calendar from your platform

## Overview

Removes a calendar connection for a specific user. This revokes your platform's access to their calendar and sends a `user.calendar.disconnected` webhook to **all platforms** that had this user connected.

## Authentication

Requires **Platform API Key** in the `Authorization` header or `X-API-Key` header.

## Request

```bash theme={null}
DELETE https://api.syncline.run/v1/calendars/{email}
```

### Path Parameters

<ParamField path="email" type="string" required>
  Email address of the user whose calendar connection should be removed (URL-encoded)

  Example: `alice@example.com` → `alice%40example.com`
</ParamField>

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "message": "Calendar disconnected successfully",
  "email": "alice@example.com",
  "platform_id": "plat_xyz789"
}
```

### Response Fields

<ResponseField name="success" type="boolean">
  Whether the disconnection succeeded
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable success message
</ResponseField>

<ResponseField name="email" type="string">
  Email of the disconnected user
</ResponseField>

<ResponseField name="platform_id" type="string">
  Your platform's ID
</ResponseField>

## Multi-Platform Webhook Behavior

**IMPORTANT**: When a user is disconnected, the `user.calendar.disconnected` webhook is sent to **ALL platforms** that had this user connected, not just your platform.

### Example Scenario

1. `alice@example.com` is connected to 3 platforms:
   * Boardy (plat\_boardy)
   * Luma (plat\_luma)
   * Cal.com (plat\_calcom)

2. Boardy calls `DELETE /v1/calendars/alice@example.com`

3. **ALL 3 platforms** receive the `user.calendar.disconnected` webhook:

```json theme={null}
{
  "id": "wh_def456",
  "event_type": "user.calendar.disconnected",
  "timestamp": "2025-11-21T15:45:00Z",
  "platform_id": "plat_boardy", // OR plat_luma, OR plat_calcom
  "api_version": "v1",
  "data": {
    "user_email": "alice@example.com",
    "google_id": "105942374304",
    "disconnected_at": "2025-11-21T15:45:00Z",
    "reason": "user_requested"
  }
}
```

This allows all platforms to update their internal records when a user revokes access.

## Example

```javascript theme={null}
const userEmail = 'alice@example.com';
const encodedEmail = encodeURIComponent(userEmail);

const response = await fetch(`https://api.syncline.run/v1/calendars/${encodedEmail}`, {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const result = await response.json();
if (result.success) {
  console.log(`Disconnected ${result.email}`);
}
```

## Use Cases

### User Privacy Request

Allow users to revoke calendar access:

```javascript theme={null}
async function handleUserDisconnectRequest(userEmail) {
  const encodedEmail = encodeURIComponent(userEmail);
  const response = await fetch(
    `https://api.syncline.run/v1/calendars/${encodedEmail}`,
    {
      method: 'DELETE',
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    }
  );

  if (response.ok) {
    // Update UI to show disconnected state
    updateUserProfile(userEmail, { calendarConnected: false });
  }
}
```

### Account Deletion

Disconnect calendar when user deletes their account:

```javascript theme={null}
async function deleteUserAccount(userId, userEmail) {
  // 1. Disconnect calendar
  await disconnectCalendar(userEmail);

  // 2. Delete user from your database
  await db.users.delete({ id: userId });

  // 3. Cancel any pending meetings
  await cancelAllUserMeetings(userId);
}
```

### Administrative Removal

Platform admin removes a problematic user:

```javascript theme={null}
async function adminRemoveUser(userEmail, reason) {
  await disconnectCalendar(userEmail);
  await logAction({
    action: 'admin_disconnect',
    user: userEmail,
    reason: reason,
    timestamp: new Date()
  });
}
```

## Notes

* This action cannot be undone
* User must reconnect via OAuth to restore access
* Existing scheduled meetings are NOT automatically cancelled
* OAuth tokens are permanently revoked
* All platforms receive the disconnection webhook

## Webhook Notification

When a calendar is disconnected, Syncline sends a `user.calendar.disconnected` webhook to **all platforms**:

```json theme={null}
{
  "id": "wh_def456",
  "event_type": "user.calendar.disconnected",
  "timestamp": "2025-11-21T15:45:00Z",
  "platform_id": "plat_xyz789",
  "api_version": "v1",
  "data": {
    "user_email": "alice@example.com",
    "google_id": "105942374304",
    "disconnected_at": "2025-11-21T15:45:00Z",
    "reason": "user_requested"
  }
}
```

**Disconnect Reasons:**

* `user_requested` - User explicitly disconnected
* `token_expired` - OAuth token could not be refreshed
* `revoked` - User revoked access from Google

Learn more about [webhooks](/webhooks)

## Error Responses

<ResponseField name="401 Unauthorized" type="error">
  Invalid or missing API key
</ResponseField>

<ResponseField name="404 Not Found" type="error">
  No calendar connection found for this user and platform
</ResponseField>

<ResponseField name="500 Internal Server Error" type="error">
  Failed to disconnect calendar
</ResponseField>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="List Calendars" icon="list" href="/api-reference/list-calendars">
    View all connected calendars
  </Card>

  <Card title="Platform OAuth URL" icon="link" href="/api-reference/platform-oauth-url">
    Get reconnection URL for users
  </Card>
</CardGroup>
