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

# Dropbox Ingestion

> Sync a Dropbox folder into cognee memory incrementally, with deleted and moved-out files forgotten

A minimal guide to syncing one Dropbox folder into cognee from your own script. Text, Markdown, CSV and PDF files and Paper docs in the folder and its subfolders become documents; a re-run fetches only what changed, and files deleted or moved out of the folder are forgotten.

## Before You Start

* Complete [Quickstart](https://docs.cognee.ai/getting-started/quickstart.md) to understand basic operations
* Ensure you have [LLM Providers](https://docs.cognee.ai/setup-configuration/llm-providers.md) configured — the script calls `cognee.recall()`, which needs an LLM for the final completion
* Read [Datasets](https://docs.cognee.ai/core-concepts/further-concepts/datasets.md) — the folder is synced into the `my_dropbox` dataset
* Create a Dropbox app at [dropbox.com/developers/apps](https://www.dropbox.com/developers/apps) with the scopes `files.metadata.read`, `files.content.read` and `account_info.read`, and generate an access token for your account on its settings page (it lasts about four hours)
* Set `DROPBOX_ACCESS_TOKEN` to that token
* Set `DROPBOX_FOLDER_ID` to the folder's id — the `id` that Dropbox's `/2/files/get_metadata` returns for the folder's path, like `id:a4ayc_80_OEAAAAAAAAAXw` — or leave it empty to sync the whole Dropbox
* No extra to install: the connector's client is `httpx`, a core dependency

## Code in Action

```python theme={null}
import asyncio
import os

import cognee
from cognee.tasks.ingestion.connectors import dropbox_account_id, dropbox_source


async def main():
    token = os.environ["DROPBOX_ACCESS_TOKEN"]
    folder_id = os.environ.get("DROPBOX_FOLDER_ID", "")

    source = dropbox_source(
        folder_id=folder_id,
        # Binds the sync state to the account, so another account can never reuse it.
        account_id=dropbox_account_id(token),
        token=token,
        # One name per folder and account: it names the staging table and the cursor.
        resource_name="dropbox_example",
    )
    await cognee.remember(
        source,
        dataset_name="my_dropbox",
        primary_key="id",
        write_disposition="merge",
        max_rows_per_table=0,
    )
    print("Sync counts:", source.cognee_sync_stats)

    answer = await cognee.recall("What did I decide about the Q4 plan?", datasets=["my_dropbox"])
    print(answer[0].text if answer else "No answer.")


if __name__ == "__main__":
    asyncio.run(main())
```

## What Just Happened

### Step 1: Create the Dropbox Source

```python theme={null}
source = dropbox_source(
    folder_id=folder_id,
    # Binds the sync state to the account, so another account can never reuse it.
    account_id=dropbox_account_id(token),
    token=token,
    # One name per folder and account: it names the staging table and the cursor.
    resource_name="dropbox_example",
)
```

`dropbox_source()` returns a dlt resource for one folder, read with your access token. `dropbox_account_id(token)` looks up the token's account so the sync state is tied to it, and `resource_name` names the staging table and the cursor that make later runs incremental — use one name per folder and account. It must start with `dropbox_` and hold only lowercase letters, digits and single underscores (at most 63 characters), or `dropbox_source()` raises `ValueError`.

### Step 2: Sync the Folder

```python theme={null}
await cognee.remember(
    source,
    dataset_name="my_dropbox",
    primary_key="id",
    write_disposition="merge",
    max_rows_per_table=0,
)
print("Sync counts:", source.cognee_sync_stats)
```

Passing the source to `remember()` extracts every supported file, chunks it, and builds the graph. `primary_key="id"` keys each row by its Dropbox file id and `write_disposition="merge"` upserts on that key; together with the stored cursor, running the script again processes only what changed and forgets deleted or moved-out files. `source.cognee_sync_stats` reports the run's counts — check them, since a normal return alone does not prove the sync finished: a run is complete when `failed == 0` and `complete == 1`.

### Step 3: Recall From the Folder

```python theme={null}
answer = await cognee.recall("What did I decide about the Q4 plan?", datasets=["my_dropbox"])
print(answer[0].text if answer else "No answer.")
```

Once synced, the folder's contents are ordinary cognee memory, so `recall()` scoped to the `my_dropbox` dataset can answer questions about them.

> [card] [Dropbox](https://docs.cognee.ai/integrations/dropbox-integration.md)
>
> Connect an account over OAuth instead, plus what gets indexed and the sync's limits.

> [card] [dlt (Data Load Tool)](https://docs.cognee.ai/integrations/dlt-integration.md)
>
> The dlt ingestion path the connector builds on, including write dispositions.

> [card] [remember()](https://docs.cognee.ai/python-api/remember.md)
>
> Every option `remember()` accepts when ingesting a source.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.