Skip to main content

Overview

The Drive API provides endpoints for Google Drive integration, file syncing, and document management. Base Path: /api/drive

Endpoints

List Files

GET /api/drive/files
Query Parameters:
  • folder_id: Drive folder ID to list
  • company_id: Filter by associated company
  • page_size: Number of files (default: 100)
Response:
{
  "files": [
    {
      "id": "drive-file-123",
      "name": "Q4_Financial_Report.pdf",
      "mime_type": "application/pdf",
      "size": 2048576,
      "modified_at": "2024-01-20T10:30:00Z",
      "web_view_link": "https://drive.google.com/file/d/..."
    }
  ],
  "total": 25
}

Sync Folder

POST /api/drive/sync
Request Body:
{
  "folder_id": "drive-folder-id",
  "company_id": "550e8400-e29b-41d4-a716-446655440000",
  "sync_mode": "incremental"
}
Response:
{
  "synced_files": 12,
  "new_files": 3,
  "updated_files": 9,
  "sync_duration": 8.5
}

Upload to Drive

POST /api/drive/upload
Request: multipart/form-data with file

Download from Drive

GET /api/drive/files/{file_id}/download

Next Steps