Skip to main content
gateway files is the project’s file drive: the same store the dashboard’s Files tab, the REST routes under /api/public/files and the MCP tools (list_files, get_file, request_file_upload, confirm_file_upload, delete_file, move_file, create_folder) use. Files are addressed by path, e.g. corpora/2026/train.jsonl. A drive: prefix on a path is accepted and ignored. Bytes move directly between your machine and storage over presigned URLs. The platform keeps the index. Each command below is one REST route; the exit codes are the CLI’s usual ones: 0 done, 1 the platform refused or a transfer failed, 2 bad arguments or missing credentials.

Upload

Each file is three requests: POST /files returns a presigned PUT URL; the bytes stream to it with the SHA-256 the platform signed; POST /files/confirm marks the file ready. A failed PUT is confirmed with ok=false, so no placeholder is left behind. Files starting with . are skipped when a directory is walked. Empty files are refused. One refused file does not stop the others; the exit code is 1 when any was refused. Progress prints on standard error on a TTY, or when GATEWAY_PROGRESS=1.

List and read

Organize

move is metadata only; no bytes are copied. delete removes the stored bytes too. Both print how many entries changed and exit 1 naming the path when nothing was there.

Fetch a URL into the drive

The bytes pass through your machine, then upload as above. The response’s Content-Type is recorded unless --content-type says otherwise. --overwrite replaces a file at that path. The MCP tool download_url_to_drive does the same fetch on the platform.

Connectors

A connector is a saved sync from an external connection (a Slack channel, a Google Drive file, an http URL) into a drive folder. Humans create them on the Connectors tab; only connectors with agent access turned on are visible here.
Routes: GET /files/connectors and POST /files/connectors/sync { connectorId }. A connector without agent access is refused with 400.

The drive in worlds data commands

Every gateway worlds data input that takes a local file takes drive:<path>; the file is downloaded to a scratch copy, the command runs unchanged, and the report names the drive path under inputs.
--to takes drive:<path> or a bare path, overwrites, and works beside a local output. The manifest under .gateway/imports/ records the drive spelling, so --resume matches the same import.

From code

TypeScript: import { files } from "@withgateway/sdk" (or @withgateway/sdk/files) — uploadFile, uploadBytes, listFiles, iterateFiles, getFile, readFile, downloadFile, deleteFile, moveFile, createFolder, listFileConnectors, syncFileConnector. Python: from gatewaysdk.files import FilesClient — upload, upload_bytes, list, iter_files, get, read, download, delete, move, mkdir, connectors, sync_connector. Both read GATEWAY_HOST, GATEWAY_PUBLIC_KEY and GATEWAY_SECRET_KEY.