---
title: "Sync User Microsoft365 Calendars"
method: POST
path: "/calendars/microsoft365-calendars/sync"
tags: ["Calendar"]
---

# Sync User Microsoft365 Calendars

`POST /calendars/microsoft365-calendars/sync`

Sync Microsoft 365 calendars for a user.

Fetches all calendars from the specified user's Microsoft 365 account and:
1. Creates/updates Microsoft365Calendar records in the database
2. Creates/updates corresponding Calendar records
3. Deletes calendars that no longer exist in Microsoft 365

- **user_id**: Optional user ID to sync calendars for. If not provided, syncs current user's calendars.

Returns the list of synced calendars.

## Query parameters

- `user_id` string, uuid, nullable — Optional user ID to sync calendars for. If not provided, syncs current user's calendars.

## Response `200`

Successful Response

- SyncMicrosoft365CalendarsResponse — Response model for syncing Microsoft 365 Calendars
  - `message` string, required
  - `synced_count` integer, required
  - `calendars` Microsoft365CalendarItem[], required
    - `microsoft365_calendar_id` string, uuid, required
    - `microsoft365_calendar_unique_id` string, required
    - `calendar_id` string, uuid, nullable, required
    - `name` string, nullable, required
    - `color` string, nullable, required
    - `is_default_calendar` boolean, required
    - `can_edit` boolean, required
    - `owner_name` string, nullable, required
    - `owner_email` string, nullable, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/openintake/apis/fastapi.md) · [All operations](https://skmtc.dev/openintake/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/openintake/fastapi/revisions/b642b91e0a5c/schema)
