> ## 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.

# TypeScript / ESM SDK

> Zero-dependency TypeScript client (@7xsystems/zerodrive-sdk) for Node.js 18+, serverless workers, and browsers using fetch.

Zero-dependency TypeScript client (`sdk/typescript`) built on standard `fetch`. Needs **Node.js 18+** and defaults to `process.env.ZERODRIVE_API_KEY`.

```bash theme={null}
npm install @7xsystems/zerodrive-sdk
```

## Quick example

```ts theme={null}
import { ZeroDrive, ZeroDriveError } from "@7xsystems/zerodrive-sdk";

const client = new ZeroDrive({ apiKey: process.env.ZERODRIVE_API_KEY });

const listing = await client.files.list("/");
await client.files.write("notes/todo.md", "# Tasks\n- Ship docs\n", { onConflict: "fail" });
const doc = await client.files.read("notes/todo.md", { startLine: 1, lineCount: 20 });

await client.files.writeBytes("bin/blob.bin", new Uint8Array([0, 1, 2, 3]), { offset: 0, truncate: true });
const chunk = await client.files.readBytes("bin/blob.bin", { offset: 0, length: 4 });
```

## 16 namespaces

| Namespace | Methods |
| :- | :- |
| `client.files` | `list`, `stat`, `read`, `write`, `edit`, `readBytes`, `writeBytes`, `move`, `delete`, `downloadUrl`, `patchUrl`, `prepareUpload`, `completeUpload`, `getUpload` |
| `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`, `batchCreate` |
| `client.search` | `glob`, `grep`, `fullText`, `queryTables` |
| `client.primitives` | `patch`, `appendJsonl`, `query`, `merge` |
| `client.snapshots` | `create`, `list`, `get`, `restore` |
| `client.branches` | `create`, `list`, `get`, `log`, `readFile`, `writeFile`, `deleteFile`, `listFiles`, `diff`, `merge`, `delete` |
| `client.leases` | `acquire`, `renew`, `release`, `list` |
| `client.handoffs` | `create`, `list`, `get`, `claim`, `complete` |
| `client.archive` | `list`, `cold`, `restore`, `listPolicies`, `setPolicy`, `deletePolicy` |
| `client.connectors` | `create`, `list`, `delete`, `sync`, `query` |
| `client.roadmap` | `list`, `changelog`, `vote` |
| `client.tickets` | `list`, `get` |
| `client.feedback` | `submit` |

Failed calls throw `ZeroDriveError` (with `status`, `code`, `message`, `requestId`, `details`, and `retryAfter`). Run tests via `node --test sdk/typescript/test/client.test.mjs && tsc -p sdk/typescript/tsconfig.json`.


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