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

# OneDrive

> Sync documents from a user's Microsoft OneDrive into a Circuit index.

The OneDrive feed connects an index to Microsoft OneDrive through delegated OAuth. After connecting, Circuit imports the files you pick and keeps them in sync as they change.

## What you can do

* **Sync specific files or folders**: Use OneDrive's native file picker to choose exactly what enters the index. Files outside the selection are not imported.
* **Sync from shared content**: Include files and folders shared with you across your organization, not only files you own.
* **Stay in sync automatically**: Circuit re-checks the source periodically. Updates and deletions are mirrored to the index.

## Before you start

* A Microsoft work, school, or personal account with access to the files you want to sync.
* For organizations using Microsoft Entra ID (formerly Azure AD) with restrictions on third-party apps, your Entra administrator may need to approve Circuit in advance. See [For IT and security teams](#for-it-and-security-teams) below.
* An index in Circuit where the OneDrive files should live. See [Indexes](/admin/indexes) if you need to create one.

## Connect OneDrive

<Steps>
  <Step title="Open the index's Integrations tab">
    In Circuit, open the index that should receive the OneDrive files, then choose **Integrations** > **New integration**.
  </Step>

  <Step title="Choose Import from OneDrive">
    Select **Import from OneDrive**. Circuit redirects you to Microsoft's sign-in page.
  </Step>

  <Step title="Sign in to Microsoft">
    Sign in with the Microsoft account that owns or has access to the files you want to sync.
  </Step>

  <Step title="Review and consent to the requested permissions">
    Microsoft shows a consent screen listing the Graph permissions Circuit requests. Review them (see [What Circuit accesses](#what-circuit-accesses) below) and click **Accept**.
  </Step>

  <Step title="Pick what to sync">
    After consent, Circuit opens the OneDrive picker. Select the files and folders that should be imported into the index. Files outside this selection are never accessed.
  </Step>

  <Step title="Start the import">
    Click **Done**. Circuit imports the selected content. Depending on volume, the initial import takes a few minutes to a few hours. Subsequent updates run in the background.
  </Step>
</Steps>

## What Circuit accesses

Circuit requests four Microsoft Graph delegated permissions:

```
Files.Read
Files.Read.All
Files.ReadWrite
offline_access
```

| Permission        | Why Circuit needs it                                                                                                                                                                                                                      |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Files.Read`      | Read the content and metadata of your files so Circuit can import them.                                                                                                                                                                   |
| `Files.Read.All`  | Let you pick shared files and folders you have access to across your organization, not only ones you own.                                                                                                                                 |
| `Files.ReadWrite` | Required by the picker to surface the files Circuit needs to import. Circuit only reads OneDrive content. It does not create, modify, or delete files through this integration.                                                           |
| `offline_access`  | Issue a refresh token so Circuit can keep the feed in sync in the background without asking you to reauthenticate. Microsoft access tokens are short-lived (about an hour), so without this scope you would need to reconnect frequently. |

<Note>
  Circuit only reads from the files and folders you select in the picker. Files outside the selected scope are not imported, even though the granted permissions technically allow broader access.
</Note>

## For IT and security teams

The OneDrive feed authenticates through a single Circuit-published enterprise application in your Entra tenant. In tenants that require admin approval for third-party applications, users will be blocked at the consent screen until an administrator grants tenant-wide consent for Circuit.

To grant consent:

1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com) as a Cloud Application Administrator or higher.
2. Go to **Entra ID** > **Enterprise apps** > **All applications** and search for **Circuit**.
3. Open **Permissions** under **Security** and review the requested scopes.
4. Click **Grant admin consent for `your tenant`**.

For the full Entra walkthrough, the same enterprise application across Microsoft integrations, and how to restrict the app to specific users or groups, see [Integration security and admin consent](/it/integration-security).

## Disconnect or rotate access

* **From Circuit**: open the index's **Integrations** tab, select the OneDrive feed, and click **Remove**. Circuit deletes the stored refresh token and stops syncing. Already-imported documents stay in the index until you delete them.
* **From Microsoft**: at [myapps.microsoft.com](https://myapps.microsoft.com) > **Manage your applications**, find Circuit and remove its permissions. Circuit will lose access on the next sync attempt.

## Troubleshooting

<AccordionGroup>
  <Accordion title="&#x22;Need admin approval&#x22; or &#x22;this app needs permission to access resources in your organization&#x22;">
    Your Entra tenant requires admin consent for third-party apps. Ask your Entra administrator to grant tenant-wide consent (see [For IT and security teams](#for-it-and-security-teams)).
  </Accordion>

  <Accordion title="The picker shows fewer files than expected">
    The picker only shows what your Microsoft account can access. Files in shared drives or other users' OneDrives appear only if those users have shared them with you. Ask the file owner to share the folder, or include the file in a SharePoint site that Circuit can read (see [SharePoint](/admin/integrations/feeds/sharepoint)).
  </Accordion>

  <Accordion title="Sync stops working after a password change or MFA reset">
    The refresh token is invalidated. Open the feed in Circuit and click **Reconnect**.
  </Accordion>

  <Accordion title="A file was updated in OneDrive but the index still shows the old content">
    Updates are picked up on the next sync cycle, usually within a few hours. If a file remains out of date for longer, force a re-sync from the feed's settings.
  </Accordion>
</AccordionGroup>

## Reference

* **OAuth flow**: Microsoft identity platform, authorization code
* **Scopes requested**: `Files.Read`, `Files.Read.All`, `Files.ReadWrite`, `offline_access`
* **Redirect URI**: `https://app.circuit.ai/api/onedrive-oauth`
* **Application name shown on consent screen**: Circuit
* **Microsoft's own docs**: [Microsoft Graph file permissions](https://learn.microsoft.com/en-us/graph/permissions-reference#files-permissions), [OneDrive picker overview](https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/)
