one-driveOneDrive API integration with managed OAuth via Microsoft Graph. Manage files, folders, and sharing. Use this skill when users want to upload, download, orga...
Install via ClawdBot CLI:
clawdbot install byungkyu/one-driveAccess the OneDrive API with managed OAuth authentication via Microsoft Graph. Manage files, folders, drives, and sharing with full CRUD operations.
# List files in OneDrive root
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/one-drive/v1.0/me/drive/root/children')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
https://gateway.maton.ai/one-drive/v1.0/{resource}
The gateway proxies requests to graph.microsoft.com and automatically injects your OAuth token.
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Manage your OneDrive OAuth connections at https://ctrl.maton.ai.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=one-drive&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'one-drive'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "3f17fb58-4515-4840-8ef6-2bbf0fa67e2c",
"status": "ACTIVE",
"creation_time": "2026-02-07T08:23:30.317909Z",
"last_updated_time": "2026-02-07T08:24:04.925298Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "one-drive",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If you have multiple OneDrive connections, specify which one to use with the Maton-Connection header:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/one-drive/v1.0/me/drive')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '3f17fb58-4515-4840-8ef6-2bbf0fa67e2c')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
GET /one-drive/v1.0/me/drive
Response:
{
"id": "b!F3Y7M0VT80OO9iu_D6Z-LA...",
"driveType": "personal",
"name": "OneDrive",
"owner": {
"user": {
"displayName": "John Doe",
"id": "d4648f06c91d9d3d"
}
},
"quota": {
"total": 5368709120,
"used": 1234567,
"remaining": 5367474553
}
}
GET /one-drive/v1.0/me/drives
GET /one-drive/v1.0/drives/{drive-id}
GET /one-drive/v1.0/me/drive/root
GET /one-drive/v1.0/me/drive/root/children
Response:
{
"value": [
{
"id": "F33B7653325337C3!s88...",
"name": "Documents",
"folder": {
"childCount": 5
},
"createdDateTime": "2024-01-15T10:30:00Z",
"lastModifiedDateTime": "2024-02-01T14:20:00Z"
},
{
"id": "F33B7653325337C3!s3f...",
"name": "report.pdf",
"file": {
"mimeType": "application/pdf",
"hashes": {
"sha1Hash": "cf23df2207d99a74fbe169e3eba035e633b65d94"
}
},
"size": 35212
}
]
}
GET /one-drive/v1.0/me/drive/items/{item-id}
Use colon (:) syntax to access items by path:
GET /one-drive/v1.0/me/drive/root:/Documents/report.pdf
GET /one-drive/v1.0/me/drive/root:/Documents:/children
GET /one-drive/v1.0/me/drive/items/{item-id}/children
Access known folders by name:
GET /one-drive/v1.0/me/drive/special/documents
GET /one-drive/v1.0/me/drive/special/photos
GET /one-drive/v1.0/me/drive/special/music
GET /one-drive/v1.0/me/drive/special/approot
GET /one-drive/v1.0/me/drive/recent
GET /one-drive/v1.0/me/drive/sharedWithMe
GET /one-drive/v1.0/me/drive/root/search(q='{query}')
Example:
GET /one-drive/v1.0/me/drive/root/search(q='budget')
POST /one-drive/v1.0/me/drive/root/children
Content-Type: application/json
{
"name": "New Folder",
"folder": {},
"@microsoft.graph.conflictBehavior": "rename"
}
Create folder inside another folder:
POST /one-drive/v1.0/me/drive/items/{parent-id}/children
Content-Type: application/json
{
"name": "Subfolder",
"folder": {}
}
PUT /one-drive/v1.0/me/drive/items/{parent-id}:/{filename}:/content
Content-Type: application/octet-stream
{file binary content}
Example - upload to root:
PUT /one-drive/v1.0/me/drive/root:/document.txt:/content
Content-Type: text/plain
Hello, OneDrive!
For files over 4MB, use resumable upload:
Step 1: Create upload session
POST /one-drive/v1.0/me/drive/root:/{filename}:/createUploadSession
Content-Type: application/json
{
"item": {
"@microsoft.graph.conflictBehavior": "rename"
}
}
Response:
{
"uploadUrl": "https://sn3302.up.1drv.com/up/...",
"expirationDateTime": "2024-02-08T10:00:00Z"
}
Step 2: Upload bytes to the uploadUrl
Get the file metadata to retrieve the download URL:
GET /one-drive/v1.0/me/drive/items/{item-id}
The response includes @microsoft.graph.downloadUrl - a pre-authenticated URL valid for a short time:
{
"id": "...",
"name": "document.pdf",
"@microsoft.graph.downloadUrl": "https://public-sn3302.files.1drv.com/..."
}
Use this URL directly to download the file content (no auth header needed).
PATCH /one-drive/v1.0/me/drive/items/{item-id}
Content-Type: application/json
{
"name": "new-name.txt"
}
Move to different folder:
PATCH /one-drive/v1.0/me/drive/items/{item-id}
Content-Type: application/json
{
"parentReference": {
"id": "{new-parent-id}"
}
}
POST /one-drive/v1.0/me/drive/items/{item-id}/copy
Content-Type: application/json
{
"parentReference": {
"id": "{destination-folder-id}"
},
"name": "copied-file.txt"
}
Returns 202 Accepted with a Location header to monitor the copy operation.
DELETE /one-drive/v1.0/me/drive/items/{item-id}
Returns 204 No Content on success.
POST /one-drive/v1.0/me/drive/items/{item-id}/createLink
Content-Type: application/json
{
"type": "view",
"scope": "anonymous"
}
Link types:
view - Read-only accessedit - Read-write accessembed - Embeddable linkScopes:
anonymous - Anyone with the linkorganization - Anyone in your organizationResponse:
{
"id": "...",
"link": {
"type": "view",
"scope": "anonymous",
"webUrl": "https://1drv.ms/b/..."
}
}
POST /one-drive/v1.0/me/drive/items/{item-id}/invite
Content-Type: application/json
{
"recipients": [
{"email": "user@example.com"}
],
"roles": ["read"],
"sendInvitation": true,
"message": "Check out this file!"
}
Customize responses with OData query parameters:
$select - Choose specific properties: ?$select=id,name,size$expand - Include related resources: ?$expand=children$filter - Filter results: ?$filter=file ne null (files only)$orderby - Sort results: ?$orderby=name$top - Limit results: ?$top=10Example:
GET /one-drive/v1.0/me/drive/root/children?$select=id,name,size&$top=20&$orderby=name
Results are paginated. The response includes @odata.nextLink for additional pages:
{
"value": [...],
"@odata.nextLink": "https://graph.microsoft.com/v1.0/me/drive/root/children?$skiptoken=..."
}
Use the full URL from @odata.nextLink (without the gateway prefix) to fetch the next page.
// List files in root
const response = await fetch(
'https://gateway.maton.ai/one-drive/v1.0/me/drive/root/children',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
// Upload a file
const uploadResponse = await fetch(
'https://gateway.maton.ai/one-drive/v1.0/me/drive/root:/myfile.txt:/content',
{
method: 'PUT',
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`,
'Content-Type': 'text/plain'
},
body: 'Hello, OneDrive!'
}
);
import os
import requests
# List files in root
response = requests.get(
'https://gateway.maton.ai/one-drive/v1.0/me/drive/root/children',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
files = response.json()
# Upload a file
upload_response = requests.put(
'https://gateway.maton.ai/one-drive/v1.0/me/drive/root:/myfile.txt:/content',
headers={
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
'Content-Type': 'text/plain'
},
data='Hello, OneDrive!'
)
graph.microsoft.com):) syntax for path-based addressing: /root:/path/to/file@microsoft.graph.downloadUrl are pre-authenticated and temporaryfail, replace, renamecurl -g when URLs contain brackets to disable glob parsingjq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments| Status | Meaning |
|--------|---------|
| 400 | Missing OneDrive connection or invalid request |
| 401 | Invalid or missing Maton API key |
| 403 | Insufficient permissions |
| 404 | Item not found |
| 409 | Conflict (e.g., item already exists) |
| 429 | Rate limited (check Retry-After header) |
| 4xx/5xx | Passthrough error from Microsoft Graph API |
{
"error": {
"code": "itemNotFound",
"message": "The resource could not be found."
}
}
MATON_API_KEY environment variable is set:echo $MATON_API_KEY
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
one-drive. For example:https://gateway.maton.ai/one-drive/v1.0/me/drive/root/childrenhttps://gateway.maton.ai/v1.0/me/drive/root/childrenGenerated Mar 1, 2026
A small business can use this skill to automatically back up important documents from local systems to OneDrive. It enables scheduled uploads of invoices, reports, and contracts, ensuring data redundancy and easy access across devices. This reduces manual effort and minimizes risk of data loss.
Remote teams can leverage this skill to organize and share project files in OneDrive. It allows listing, uploading, and managing folders for collaborative work, such as design assets or meeting notes. This streamlines workflows and ensures all members have up-to-date resources.
Law firms can use this skill to securely share confidential documents with clients via OneDrive. It facilitates controlled access to files like contracts and case materials, with audit trails through connection management. This enhances compliance and client communication.
Educators can employ this skill to distribute learning materials to students through OneDrive. It enables uploading syllabi, assignments, and multimedia files, with easy retrieval via path-based access. This supports hybrid learning environments and reduces administrative overhead.
Creative professionals can utilize this skill to manage media files like photos and videos in OneDrive. It allows organizing special folders, listing items, and sharing assets with clients or collaborators. This optimizes storage and speeds up project delivery.
Offer a monthly subscription service that uses this skill to automate OneDrive backups for individuals or businesses. Provide tiered plans based on storage size and frequency of backups. Revenue is generated from recurring fees and potential upsells for advanced features.
Sell custom integration packages where this skill is embedded into enterprise workflows, such as CRM or project management tools. Charge a one-time setup fee plus ongoing support and maintenance. Revenue comes from licensing and consulting services.
Develop a user-facing app that leverages this skill for basic OneDrive file management, offering free access to core functions. Monetize through premium features like bulk operations, advanced sharing controls, or analytics. Revenue is driven by in-app purchases or upgrades.
💬 Integration Tip
Start by setting the MATON_API_KEY environment variable and creating a connection via the control panel; use the base URL for direct API calls to avoid complex OAuth handling.
Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.
Connect to 100+ APIs (Google Workspace, Microsoft 365, GitHub, Notion, Slack, Airtable, HubSpot, etc.) with managed OAuth. Use this skill when users want to...
Build, debug, and deploy websites using HTML, CSS, JavaScript, and modern frameworks following production best practices.
YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Scaffold, test, document, and debug REST and GraphQL APIs. Use when the user needs to create API endpoints, write integration tests, generate OpenAPI specs, test with curl, mock APIs, or troubleshoot HTTP issues.
Search for jobs across LinkedIn, Indeed, Glassdoor, ZipRecruiter, Google Jobs, Bayt, Naukri, and BDJobs using the JobSpy MCP server.