Google Drive
/install googledrive-maton
Google Drive (Maton Gateway) – cURL Guide\r
\r Access the Google Drive API with managed OAuth authentication using cURL.\r \r ---\r \r
🔹 Base URL\r
\r https://gateway.maton.ai/google-drive/{native-api-path}\r \r \r ---\r \r
🔹 Authentication\r
\r All requests require your API key:\r \r
export MATON_API_KEY="YOUR_API_KEY"\r
Header:\r
\r
Authorization: Bearer $MATON_API_KEY\r
🚀 Quick Start\r
List Files\r
curl -X GET "https://gateway.maton.ai/google-drive/drive/v3/files?pageSize=10" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
🔗 Connection Management\r
List Connections\r
curl -X GET "https://ctrl.maton.ai/connections?app=google-drive&status=ACTIVE" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Create Connection\r
curl -X POST "https://ctrl.maton.ai/connections" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json" \\r
-d '{"app": "google-drive"}'\r
Get Connection\r
curl -X GET "https://ctrl.maton.ai/connections/{connection_id}" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Delete Connection\r
curl -X DELETE "https://ctrl.maton.ai/connections/{connection_id}" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Specify Connection\r
curl -X GET "https://gateway.maton.ai/google-drive/drive/v3/files?pageSize=10" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Maton-Connection: CONNECTION_ID"\r
📁 File Operations\r
List Files\r
curl -X GET "https://gateway.maton.ai/google-drive/drive/v3/files?pageSize=10" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Search Files\r
curl -G "https://gateway.maton.ai/google-drive/drive/v3/files" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
--data-urlencode "q=name contains 'report'" \\r
--data-urlencode "pageSize=10"\r
Only Folders\r
curl -G "https://gateway.maton.ai/google-drive/drive/v3/files" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
--data-urlencode "q=mimeType='application/vnd.google-apps.folder'"\r
Files in Folder\r
curl -G "https://gateway.maton.ai/google-drive/drive/v3/files" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
--data-urlencode "q='FOLDER_ID' in parents"\r
Select Fields\r
curl -g "https://gateway.maton.ai/google-drive/drive/v3/files?fields=files(id,name,mimeType,createdTime,modifiedTime,size)" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Get File Metadata\r
curl -X GET "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}?fields=id,name,mimeType,size,createdTime" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Download File\r
curl -X GET "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}?alt=media" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-o file.bin\r
Export Google Docs (PDF)\r
curl -X GET "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}/export?mimeType=application/pdf" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-o file.pdf\r
✏️ Create & Update\r
Create File\r
curl -X POST "https://gateway.maton.ai/google-drive/drive/v3/files" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json" \\r
-d '{\r
"name": "New Document",\r
"mimeType": "application/vnd.google-apps.document"\r
}'\r
Create Folder\r
curl -X POST "https://gateway.maton.ai/google-drive/drive/v3/files" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json" \\r
-d '{\r
"name": "New Folder",\r
"mimeType": "application/vnd.google-apps.folder"\r
}'\r
Update Metadata\r
curl -X PATCH "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json" \\r
-d '{"name": "Renamed File"}'\r
Move File\r
curl -X PATCH "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}?addParents=NEW_FOLDER_ID&removeParents=OLD_FOLDER_ID" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Delete File\r
curl -X DELETE "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
Copy File\r
curl -X POST "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}/copy" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json" \\r
-d '{"name": "Copy of File"}'\r
⬆️ Uploads\r
Simple Upload (≤5MB)\r
curl -X POST "https://gateway.maton.ai/google-drive/upload/drive/v3/files?uploadType=media" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: text/plain" \\r
--data-binary @file.txt\r
Multipart Upload\r
curl -X POST "https://gateway.maton.ai/google-drive/upload/drive/v3/files?uploadType=multipart" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: multipart/related; boundary=boundary" \\r
--data-binary $'--boundary\r\r
Content-Type: application/json; charset=UTF-8\r\r
\r\r
{"name": "myfile.txt", "description": "My file"}\r\r
--boundary\r\r
Content-Type: text/plain\r\r
\r\r
Hello file content\r\r
--boundary--'\r
Resumable Upload\r
Step 1: Start Session\r
curl -i -X POST "https://gateway.maton.ai/google-drive/upload/drive/v3/files?uploadType=resumable" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json; charset=UTF-8" \\r
-H "X-Upload-Content-Type: application/octet-stream" \\r
-H "X-Upload-Content-Length: \x3CFILE_SIZE>" \\r
-d '{"name": "large_file.bin"}'\r
Step 2: Upload File\r
curl -X PUT "\x3CUPLOAD_URL>" \\r
-H "Content-Length: \x3CFILE_SIZE>" \\r
-H "Content-Type: application/octet-stream" \\r
--data-binary @large_file.bin\r
Update File Content\r
curl -X PATCH "https://gateway.maton.ai/google-drive/upload/drive/v3/files/{fileId}?uploadType=media" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: text/plain" \\r
--data-binary @file.txt\r
🔐 Sharing\r
curl -X POST "https://gateway.maton.ai/google-drive/drive/v3/files/{fileId}/permissions" \\r
-H "Authorization: Bearer $MATON_API_KEY" \\r
-H "Content-Type: application/json" \\r
-d '{\r
"role": "reader",\r
"type": "user",\r
"emailAddress": "[email protected]"\r
}'\r
🧠 Query Examples\r
name contains 'report'\r
mimeType = 'application/pdf'\r
'folderId' in parents\r
trashed = false\r
modifiedTime > '2024-01-01T00:00:00'\r
⚠️ Notes\r
Use -G for query parameters\r
\r
Use --data-binary for file uploads\r
\r
Use -o to save files\r
\r
Use curl -g when URL contains brackets\r
\r
Pagination uses nextPageToken\r
\r
❗ Error Codes\r
Status Meaning\r
400 Missing Google Drive connection\r
401 Invalid API key\r
429 Rate limited\r
4xx/5xx Google API error\r
🔧 Troubleshooting\r
Check API Key\r
echo $MATON_API_KEY\r
Test Connection\r
curl -X GET "https://ctrl.maton.ai/connections" \\r
-H "Authorization: Bearer $MATON_API_KEY"\r
📌 Important\r
✔ Correct:\r
\r
https://gateway.maton.ai/google-drive/drive/v3/files\r
❌ Incorrect:\r
\r
https://gateway.maton.ai/drive/v3/files
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install googledrive-maton - After installation, invoke the skill by name or use
/googledrive-maton - Provide required inputs per the skill's parameter spec and get structured output
What is Google Drive?
Access and manage Google Drive files, folders, metadata, uploads, downloads, and sharing via the Google Drive API with OAuth authentication. It is an AI Agent Skill for Claude Code / OpenClaw, with 105 downloads so far.
How do I install Google Drive?
Run "/install googledrive-maton" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Google Drive free?
Yes, Google Drive is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Google Drive support?
Google Drive is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Google Drive?
It is built and maintained by Otman Heddouch (@otman-ai); the current version is v1.0.0.