Skip to Content
Python SDKQuickstart

Python SDK quickstart

Use the flashdrive Python package to upload files, search them, and update content from your application. It includes synchronous Flashdrive and asynchronous AsyncFlashdrive clients. Python 3.10 or later is required.

Install in your project

Check the current release information first. Automated requests send Flashdrive-Client: flashdrive-cli/1.0.0. Require schema flashdrive-releases.v1, API major 1, a stable sdk.latest_version, and SDK package and import name flashdrive. If the version is null, SDK installation is not yet available. Use MCP or the Console meanwhile. When available, follow sdk.install for that version and the environment guidance below.

The SDK requires pip 26.2.2 or later. Older pip trusts affected certificate authorities in its own bundle, so do not use an older pip to install packages or to upgrade itself. Create a virtual environment, activate it, and check its pip version:

python3 -m venv .venv source .venv/bin/activate python -m pip --version

On Windows PowerShell:

py -3 -m venv .venv .venv\Scripts\Activate.ps1 python -m pip --version

If pip is older than 26.2.2, use the SHA-256-pinned bootstrap in the official Python security notice , then check the version again. Repeat this in each new environment. Then install the SDK:

python -m pip install flashdrive

The SDK also requires Certifi 2026.10.19 or later. In an existing environment, run python -m pip install --upgrade 'certifi>=2026.10.19' after patching pip.

Keep .venv/ out of version control.

Create an API key

Open the Console, choose the workspace your application should use, then open Settings → API keys. A workspace administrator can create a key. Choose Read for applications that only read or search, or Read-write for applications that upload or change files. The key is shown only once.

Copy the key when it is shown and store it in your application’s secret manager. Keep it on your server, not in browser code or a repository. A key belongs to its workspace; using a drive ID from another workspace does not grant access to it.

Check your connection

Save this as quickstart.py. It asks for your key without displaying it, then lists the drives the key can access:

from getpass import getpass from flashdrive import Flashdrive with Flashdrive(api_key=getpass("FlashDrive API key: ")) as client: for drive in client.drives.list(): print(drive.id, drive.name, drive.status)

Run python quickstart.py. You should see a drive ID, name, and status on each line. If the list is empty, create a drive in the same workspace in the Console, then run the script again.

Configure your application

Set FLASHDRIVE_API_KEY in your application’s environment through your secret manager or deployment settings. The client reads it automatically:

from flashdrive import Flashdrive with Flashdrive() as client: print([drive.name for drive in client.drives.list()])

Explicit api_key= and base_url= arguments override the corresponding FLASHDRIVE_API_KEY and FLASHDRIVE_BASE_URL environment values. The package already selects the FlashDrive API, so a custom base URL is unnecessary for normal use. A custom base URL must be an API origin, not the MCP server URL.

For the following guides, set FLASHDRIVE_DRIVE_ID to an ID from the list. This is an application setting used by the examples, not an automatically loaded SDK setting:

export FLASHDRIVE_DRIVE_ID="YOUR_DRIVE_ID"

In PowerShell, use $env:FLASHDRIVE_DRIVE_ID = "YOUR_DRIVE_ID".

import os from flashdrive import Flashdrive with Flashdrive(drive_id=os.environ["FLASHDRIVE_DRIVE_ID"]) as client: drive = client.drives.get(client.drive_id) print(drive.name, drive.status)

A method’s drive_id= argument overrides the client’s selected drive for that call. If neither is provided, methods use the workspace’s default drive. Select a drive explicitly when your application must always use the same destination.

Continue with uploading files, reading and updating files, or searching with citations.