Google Drive Integration Guide

Complete guide to integrating Google Drive through LawLink.ai

🗂️ Google Drive
🚀

Integration Steps

Google Drive connects via OAuth 2.0. After authentication, all file and folder operations target the connected user's Google Drive.

Create Organization Admin & Login

A Superuser or Admin creates an Organization Admin (ORG_ADMIN) account. The ORG_ADMIN manages users and API tokens.

💡 Tip: Login to LawLink at https://app.lawlink.ai using your ORG_ADMIN credentials.

Create API Access Token

Navigate to API Tokens and create a new access token. Copy the token immediately — it is only shown once.

⚠️ Important: Store your API token securely.

Connect Google Drive via the UI

Navigate to Integrations → Google Drive → Connect. After Google authentication the connection is ready immediately.

🔑 Scope: LawLink requests drive.file access (files created or opened by the app).

📄

File Operations

All item IDs are Google Drive file IDs (e.g. 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms). Use root as the folder ID to reference My Drive root.

Search Files & Folders

Search across the entire drive. By default matches file name or content. Set name_only=true to restrict to filename matches.

# Search by keyword curl.exe -X GET \ "https://app.lawlink.ai/api/v1/gdrive/search?query=retainer&limit=25" \ -H "Authorization: Bearer ACCESS_TOKEN"
{ "items": [{ "id": "1BxiMVs0...", "name": "Retainer.pdf", "mimeType": "application/pdf" }] }

List Files in a Folder

List files inside a specific folder. Use folder_id=root for My Drive root.

curl.exe -X GET \ "https://app.lawlink.ai/api/v1/gdrive/files?folder_id=root&limit=50" \ -H "Authorization: Bearer ACCESS_TOKEN"

Upload a File

Send multipart/form-data. Optionally specify a folder_id to upload into a specific folder.

⚠️ Overwrite: Set overwrite=true to replace an existing file with the same name. Default renames on conflict.

curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/files/upload" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -F "file=@Contract.pdf" \ -F "folder_id=1BxiMVs0..."
{ "id": "1BxiMVs0...", "name": "Contract.pdf", "webViewLink": "https://drive.google.com/..." }

Download a File

Two options: get a direct download link (short-lived URL) or download the file content base64-encoded (max 50 MB).

# Get a direct download link curl.exe -X GET \ "https://app.lawlink.ai/api/v1/gdrive/files/download-link?file_id=1BxiMVs0..." \ -H "Authorization: Bearer ACCESS_TOKEN" # Download content as base64 curl.exe -X GET \ "https://app.lawlink.ai/api/v1/gdrive/files/download?file_id=1BxiMVs0..." \ -H "Authorization: Bearer ACCESS_TOKEN"

Move, Copy, Rename & Delete Files

# Move a file to a new folder curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/files/move" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "file_id": "1BxiMVs0...", "new_folder_id": "1CyiNWt1..." }' # Rename a file curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/files/rename" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "file_id": "1BxiMVs0...", "new_name": "Contract_FINAL.pdf" }' # Delete a file curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/files/delete" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "file_id": "1BxiMVs0..." }'
📁

Folder Operations

List Folders

List sub-folders inside a parent. Omit parent_id to list root folders.

curl.exe -X GET \ "https://app.lawlink.ai/api/v1/gdrive/folders?parent_id=root&limit=50" \ -H "Authorization: Bearer ACCESS_TOKEN"

Create a Folder

Create a new folder. Omit parent_id to create at the root.

curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/folders" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "2026 Cases", "parent_id": "root" }'

Rename, Move & Delete Folders

# Rename a folder curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/folders/rename" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "folder_id": "1CyiNWt1...", "new_name": "2026 Active Cases" }' # Move a folder curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/folders/move" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "folder_id": "1CyiNWt1...", "new_parent_id": "1DzjOXu2..." }' # Delete a folder (and all contents) curl.exe -X POST \ "https://app.lawlink.ai/api/v1/gdrive/folders/delete" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "folder_id": "1CyiNWt1..." }'