OneDrive Integration Guide

Complete guide to integrating Microsoft OneDrive (personal drive) through LawLink.ai

☁️ OneDrive Personal Drive
🚀

Integration Steps

OneDrive connects to your personal Microsoft drive (/me/drive). No drive picker is needed — after OAuth the connection is ready immediately.

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 OneDrive via the UI

Navigate to Integrations → OneDrive → Connect. After Microsoft authentication the connection is established immediately — no drive selection required.

🔑 Scope: LawLink requests Files.ReadWrite (personal drive only, no admin consent required).

📄

File Operations

All operations target the connected user's personal OneDrive (/me/drive). Item IDs are opaque Microsoft Graph IDs.

List & Search Files

List files in a folder by parent_id, or search across the drive with query. Omit parent_id to list the root.

# List root files curl.exe -X GET \ "https://app.lawlink.ai/api/v1/onedrive/files?limit=25" \ -H "Authorization: Bearer ACCESS_TOKEN" # Search across the drive curl.exe -X GET \ "https://app.lawlink.ai/api/v1/onedrive/files?query=contract&limit=25" \ -H "Authorization: Bearer ACCESS_TOKEN"
{ "items": [{ "id": "01ABCDE...", "name": "Contract.pdf", "size": 204800 }], "total": 1 }

Upload a File

Send multipart/form-data. Files larger than 4 MB are automatically chunked via an upload session.

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

# Upload to root curl.exe -X POST \ "https://app.lawlink.ai/api/v1/onedrive/files/upload" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -F "file=@Retainer.pdf" \ -F "overwrite=false"

Download a File

Returns file content base64-encoded. Maximum file size is 50 MB.

# Download by item ID curl.exe -X GET \ "https://app.lawlink.ai/api/v1/onedrive/files/download?item_id=01ABCDE..." \ -H "Authorization: Bearer ACCESS_TOKEN"
{ "filename": "Contract.pdf", "content_b64": "JVBERi0xLjQK...", "size": 102400 }

Move, Copy & Delete Files

Move or copy by supplying item_id, new_parent_id, and optional new_name. Copy returns 202 Accepted with a monitor_url.

# Move a file curl.exe -X POST \ "https://app.lawlink.ai/api/v1/onedrive/files/move" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "item_id": "01ABCDE...", "new_parent_id": "01XYZAB..." }' # Delete a file curl.exe -X POST \ "https://app.lawlink.ai/api/v1/onedrive/files/delete" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "item_id": "01ABCDE..." }'
📁

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/onedrive/folders?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/onedrive/folders" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "2026 Cases" }'

Move & Delete Folders

# Move a folder curl.exe -X POST \ "https://app.lawlink.ai/api/v1/onedrive/folders/move" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "item_id": "01FOLDER...", "new_parent_id": "01PARENT..." }' # Delete a folder (and all contents) curl.exe -X POST \ "https://app.lawlink.ai/api/v1/onedrive/folders/delete" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "item_id": "01FOLDER..." }'