Skip to main content
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 to understand basic operations
  • Ensure you have LLM Providers configured — the script calls cognee.recall(), which needs an LLM for the final completion
  • Read Datasets — the folder is synced into the my_dropbox dataset
  • Create a Dropbox app at 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

What Just Happened

Step 1: Create the Dropbox Source

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

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

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

Dropbox

Connect an account over OAuth instead, plus what gets indexed and the sync’s limits.

dlt (Data Load Tool)

The dlt ingestion path the connector builds on, including write dispositions.

remember()

Every option remember() accepts when ingesting a source.