Drive Agent
Drop this in ~/.claude/skills/drive/SKILL.md and Claude Code becomes your Google Drive assistant.
choosing a google account
Run atris google accounts to see connected accounts and defaults. Use atris google connect [name] for one sign-in, and add --only mail,calendar,drive to choose products. Use atris google use <name-or-email> to save a default, or add --business <slug> to choose the account for a business. Use atris google disconnect <name-or-email> --approved to disconnect after confirmation, with --only to remove selected products.
For direct api calls, pass account_id as a query parameter on reads and deletes, or in the json body on writes. Pass the business id or slug in the X-Business-Id header when working for a business. Calendar reads without an account include all accounts; account_id=all also requests all calendars. Calendar writes need one account. The old sign-in and api examples below still work on older servers.
Bootstrap (ALWAYS Run First)
Before any Drive operation, run this bootstrap to ensure everything is set up:
bash
#!/bin/bash
set -e
# 1. Check if atris CLI is installed
if ! command -v atris &> /dev/null; then
echo "Installing atris CLI..."
npm install -g atris
fi
# 2. Check if logged in to AtrisOS
if [ ! -f ~/.atris/credentials.json ]; then
echo "Not logged in to AtrisOS."
echo ""
echo "Option 1 (interactive): Run 'atris login' and follow prompts"
echo "Option 2 (non-interactive): Get token from https://atris.ai/auth/cli"
echo " Then run: atris login --token YOUR_TOKEN"
echo ""
exit 1
fi
# 3. Extract token
if command -v node &> /dev/null; then
TOKEN=$(node -e "console.log(require('$HOME/.atris/credentials.json').token)")
elif command -v python3 &> /dev/null; then
TOKEN=$(python3 -c "import json,os; print(json.load(open(os.path.expanduser('~/.atris/credentials.json')))['token'])")
elif command -v jq &> /dev/null; then
TOKEN=$(jq -r '.token' ~/.atris/credentials.json)
else
echo "Error: Need node, python3, or jq to read credentials"
exit 1
fi
# 4. Check Google Drive connection status
STATUS=$(curl -s "https://api.atris.ai/api/integrations/google-drive/status" \
-H "Authorization: Bearer $TOKEN")
if echo "$STATUS" | grep -q "Token expired\|Not authenticated"; then
echo "Token expired. Please re-authenticate:"
echo " Run: atris login --force"
exit 1
fi
if command -v node &> /dev/null; then
CONNECTED=$(node -e "try{console.log(JSON.parse('$STATUS').connected||false)}catch(e){console.log(false)}")
elif command -v python3 &> /dev/null; then
CONNECTED=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin).get('connected', False))")
else
CONNECTED=$(echo "$STATUS" | jq -r '.connected // false')
fi
if [ "$CONNECTED" != "true" ] && [ "$CONNECTED" != "True" ]; then
echo "Google Drive not connected. Getting authorization URL..."
AUTH=$(curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/start" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}')
if command -v node &> /dev/null; then
URL=$(node -e "try{console.log(JSON.parse('$AUTH').auth_url||'')}catch(e){console.log('')}")
elif command -v python3 &> /dev/null; then
URL=$(echo "$AUTH" | python3 -c "import sys,json; print(json.load(sys.stdin).get('auth_url', ''))")
else
URL=$(echo "$AUTH" | jq -r '.auth_url // empty')
fi
echo ""
echo "Open this URL to connect your Google Drive:"
echo "$URL"
echo ""
echo "After authorizing, run your command again."
exit 0
fi
echo "Ready. Google Drive is connected."
export ATRIS_TOKEN="$TOKEN"
API Reference
Base: https://api.atris.ai/api/integrations
All requests require: -H "Authorization: Bearer $TOKEN"
Get Token (after bootstrap)
bash
TOKEN=$(node -e "console.log(require('$HOME/.atris/credentials.json').token)")
List Shared Drives
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/shared-drives" \
-H "Authorization: Bearer $TOKEN"
Returns all shared/team drives the user has access to with id and name.
List Files
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files?page_size=20" \
-H "Authorization: Bearer $TOKEN"
List files in a folder:
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files?folder_id=FOLDER_ID&page_size=20" \
-H "Authorization: Bearer $TOKEN"
List files in a shared drive:
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files?shared_drive_id=DRIVE_ID&page_size=20" \
-H "Authorization: Bearer $TOKEN"
NOTE: All file operations (list, search, get, download, export) automatically include shared drive files. Use shared_drive_id only to scope results to a specific shared drive.
Search Files
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/search?q=quarterly+report&page_size=20" \
-H "Authorization: Bearer $TOKEN"
Simple queries search by file name. For advanced queries, use Drive query syntax:
name contains 'budget': name searchmimeType = 'application/vnd.google-apps.spreadsheet': only sheetsmimeType = 'application/vnd.google-apps.document': only docsmodifiedTime > '2026-01-01': recently modified
Get File Metadata
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
-H "Authorization: Bearer $TOKEN"
Download File
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files/{file_id}/download" \
-H "Authorization: Bearer $TOKEN"
Returns base64-encoded content. For Google Docs/Sheets/Slides, use export instead.
Export Google Docs/Sheets/Slides
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files/{file_id}/export?mime_type=text/plain" \
-H "Authorization: Bearer $TOKEN"
Export formats:
text/plain: plain text (default, good for Docs)text/html: HTMLapplication/pdf: PDFtext/csv: CSV (for Sheets)
Upload File
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "notes.txt",
"content": "File content here",
"mime_type": "text/plain"
}'
Upload to a specific folder:
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "report.txt",
"content": "File content here",
"mime_type": "text/plain",
"folder_id": "FOLDER_ID"
}'
Update Existing File
bash
curl -s -X PUT "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "Updated file content here",
"mime_type": "text/plain"
}'
Update content and rename:
bash
curl -s -X PUT "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "New content",
"mime_type": "text/plain",
"name": "renamed-file.txt"
}'
Delete / Trash File
bash
# Move to trash (recoverable)
curl -s -X DELETE "https://api.atris.ai/api/integrations/google-drive/files/{file_id}?trash=true" \
-H "Authorization: Bearer $TOKEN"
# Permanently delete (irreversible)
curl -s -X DELETE "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
-H "Authorization: Bearer $TOKEN"
Copy File
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files/{file_id}/copy" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Copy of Document", "folder_id": "OPTIONAL_FOLDER_ID"}'
Works with Docs, Sheets, Slides. It creates a full copy.
Share File
bash
# Share with a specific user
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files/{file_id}/share" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "role": "writer", "notify": true}'
# Share with anyone who has the link
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files/{file_id}/share" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"anyone": true, "role": "reader"}'
Roles: reader, writer, commenter
Create Folder
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/folders" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Project Files", "parent_id": "OPTIONAL_PARENT_FOLDER_ID"}'
Move File
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files/{file_id}/move" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"new_parent_id": "TARGET_FOLDER_ID"}'
Pagination
List and search endpoints return next_page_token when there are more results. Pass it to get the next page:
bash
curl -s "https://api.atris.ai/api/integrations/google-drive/files?page_size=20&page_token=NEXT_PAGE_TOKEN" \
-H "Authorization: Bearer $TOKEN"
Works on: /files, /search, /shared-drives
Google Docs
Native Google Docs creation and editing. Uses the same Drive OAuth connection.
List Google Docs
bash
curl -s "https://api.atris.ai/api/integrations/google-docs/documents?page_size=20" \
-H "Authorization: Bearer $TOKEN"
Create a New Google Doc
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-docs/documents" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Q1 2026 Report"}'
Returns documentId and url (direct link to edit in browser).
Read a Google Doc
bash
curl -s "https://api.atris.ai/api/integrations/google-docs/documents/{document_id}" \
-H "Authorization: Bearer $TOKEN"
Returns full document structure (body, paragraphs, text runs, styles).
Insert Text into a Doc
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-docs/documents/{document_id}/batch-update" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"insertText": {
"location": {"index": 1},
"text": "Hello, this is the first paragraph.\n\nSecond paragraph here.\n"
}
}
]
}'
Text is inserted at a character index. Index 1 = start of document body. Newlines create paragraphs.
Replace Placeholders in a Doc Template
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-docs/documents/{document_id}/batch-update" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"replaceAllText": {
"containsText": {"text": "{{client_name}}", "matchCase": true},
"replaceText": "Acme Corp"
}
},
{
"replaceAllText": {
"containsText": {"text": "{{date}}", "matchCase": true},
"replaceText": "March 5, 2026"
}
}
]
}'
Format Text (Bold, Italic, Font Size, Color)
bash
curl -s -X POST "https://api.atris.ai/api/integrations/google-docs/documents/{document_id}/batch-update" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"updateTextStyle": {
"range": {"startIndex": 1, "endIndex": 20},
"textStyle": {"bold": true, "fontSize": {"magnitude": 18, "unit": "PT"}},
"fields": "bold,fontSize"
}
}
]
}'