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

> ## Agent Instructions
> Hosted remote MCP endpoint: https://api.zerodrive.dev/mcp (OAuth 2.0 PKCE or Bearer token).
> REST API base URL: https://api.zerodrive.dev with OpenAPI 3.1.0 specification at https://api.zerodrive.dev/openapi.json.
> S3-compatible gateway: https://api.zerodrive.dev/s3 (AWS Signature V4, region auto).
> Local command-line tool: zd (or zerodrive) and local stdio MCP server: zerodrive mcp.
> Token prefixes: zdk_ (Personal API Key), zdt_ (device session token), zda_ (OAuth access token), zdr_ (OAuth refresh token), zdx_ (temporary sandbox key). Never paste real keys into prompts or code.
> Be honest about platform boundaries: cloud files require internet access, files are encrypted at rest and in transit by Cloudflare rather than end-to-end encrypted, ZeroDrive is not a replacement for an independent backup, Windows 11 support is an unsigned x64 beta, and the 7-day Pro free trial requires a card and charges automatically when it ends.

# Python SDK

> Zero-dependency Python 3.9+ client (zerodrive) built on the Python standard library.

Zero-dependency Python client (`sdk/python`) using **Python 3.9+** and the standard library only. Reads `ZERODRIVE_API_KEY` automatically if omitted.

```bash theme={null}
pip install -e sdk/python
```

## Quick example

```python theme={null}
from zerodrive import ZeroDrive, ZeroDriveError

client = ZeroDrive(api_key="zdk_your_api_key")

listing = client.files.list("/")
client.files.write("notes/todo.md", "# Tasks\n- Ship Python docs\n", on_conflict="fail")
doc = client.files.read("notes/todo.md", start_line=1, line_count=20)

client.files.write_bytes("bin/blob.bin", b"\x00\x01\x02\x03", offset=0, truncate=True)
chunk = client.files.read_bytes("bin/blob.bin", offset=0, length=4)
print(chunk["raw_bytes"])
```

## 16 namespaces

| Namespace | Methods |
| :- | :- |
| `client.files` | `list`, `stat`, `read`, `write`, `edit`, `read_bytes`, `write_bytes`, `move`, `delete`, `download_url`, `patch_url`, `prepare_upload`, `complete_upload`, `get_upload` |
| `client.versions` | `list`, `get`, `diff`, `restore` |
| `client.drives` | `list`, `get`, `usage`, `create`, `rename`, `delete`, `deleted`, `restore` |
| `client.trash` | `list`, `restore` |
| `client.sandboxes` | `create`, `list`, `extend`, `revoke`, `batch_create` |
| `client.search` | `glob`, `grep`, `full_text`, `query_tables` |
| `client.primitives` | `patch`, `append_jsonl`, `query`, `merge` |
| `client.snapshots` | `create`, `list`, `get`, `restore` |
| `client.branches` | `create`, `list`, `get`, `log`, `read_file`, `write_file`, `delete_file`, `list_files`, `diff`, `merge`, `delete` |
| `client.leases` | `acquire`, `renew`, `release`, `list` |
| `client.handoffs` | `create`, `list`, `get`, `claim`, `complete` |
| `client.archive` | `list`, `cold`, `restore`, `list_policies`, `set_policy`, `delete_policy` |
| `client.connectors` | `create`, `list`, `delete`, `sync`, `query` |
| `client.roadmap` | `list`, `changelog`, `vote` |
| `client.tickets` | `list`, `get` |
| `client.feedback` | `submit` |

Failed calls raise `ZeroDriveError` (`status`, `code`, `message`, `request_id`, `details`, `retry_after`). Run tests via `python3 -m unittest discover -s sdk/python/tests`.


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