Skip to main content
The Files API handles file uploads and downloads for tools that work with files. It’s automatically used when autoUploadDownloadFiles is enabled (default).

Automatic File Handling

By default, Composio automatically handles file uploads and downloads:

Manual File Upload

upload()

Manually upload a file:
File | string
required
File object or path to local file
string
required
Tool that will use the file
string
required
Toolkit the tool belongs to

Manual File Download

download()

Manually download a file:
string
required
S3 URL of the file to download
string
required
Tool that downloaded the file
string
required
MIME type of the file

Disabling Automatic Handling

Disable automatic file handling for manual control:

Complete Example

Supported File Operations

Upload Tools

  • GOOGLE_DRIVE_UPLOAD
  • DROPBOX_UPLOAD_FILE
  • SLACK_UPLOAD_FILE
  • GMAIL_SEND_EMAIL (with attachments)

Download Tools

  • GOOGLE_DRIVE_DOWNLOAD
  • DROPBOX_DOWNLOAD_FILE
  • SLACK_GET_FILE
  • GMAIL_GET_ATTACHMENT

File Types

FileUploadData

FileDownloadData

Best Practices

  1. Auto Handling: Use automatic file handling for simplicity
  2. File Cleanup: Clean up downloaded files after use
  3. Error Handling: Handle upload/download failures
  4. Size Limits: Be aware of file size limits
  5. Temporary Files: Use temp directories for downloads

Platform Support

File operations are supported in:
  • ✅ Node.js
  • ✅ Bun
  • ❌ Browser (use File objects)
  • ❌ Cloudflare Workers (no filesystem)
  • ⚠️ Deno (with —allow-read/—allow-write)

Next Steps

Tools API

Learn about tools

Platform Support

Runtime compatibility

Composio Class

Main SDK reference