Use the Microsoft OneDrive CLI from KosmoKrator to call Microsoft OneDrive tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Microsoft OneDrive can be configured headlessly with `kosmokrator integrations:configure one_drive`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure one_drive --set access_token="$ONE_DRIVE_ACCESS_TOKEN" --enable --read allow --write ask --jsonkosmokrator integrations:doctor one_drive --jsonkosmokrator integrations:status --json
Credentials
Authentication type: Bearer tokenbearer_token. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
access_token
ONE_DRIVE_ACCESS_TOKEN
Secret secret
yes
Access Token
url
ONE_DRIVE_URL
URL url
no
Graph API URL
Call Microsoft OneDrive Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Microsoft OneDrive.
one_drive.onedrive_list_files
Read read
List files and folders in the root of the user's OneDrive. Returns item names, IDs, sizes, and metadata. Use the item ID with onedrive_get_file or onedrive_download_file for details or content.
Upload a file to OneDrive. Specify the destination path and file content. Creates the file if it does not exist, or replaces it if it does. Supports files up to 4 MB via the simple upload API.
Download a file's content from OneDrive by its drive item ID. Returns the raw file content. Use onedrive_list_files or onedrive_get_file to find the item ID.
Use these parameter tables when building CLI payloads without calling integrations:schema first.
one_drive.onedrive_list_files
List files and folders in the root of the user's OneDrive. Returns item names, IDs, sizes, and metadata. Use the item ID with onedrive_get_file or onedrive_download_file for details or content.
The unique identifier of the drive item (obtained from onedrive_list_files or onedrive_list_shared).
one_drive.onedrive_upload_file
Upload a file to OneDrive. Specify the destination path and file content. Creates the file if it does not exist, or replaces it if it does. Supports files up to 4 MB via the simple upload API.
The destination path in OneDrive, relative to the root (e.g., "Documents/report.txt" or "photos/image.png").
content
string
yes
The content of the file to upload.
content_type
string
no
The MIME type of the file (e.g., "text/plain", "application/json", "image/png"). Defaults to "application/octet-stream".
one_drive.onedrive_download_file
Download a file's content from OneDrive by its drive item ID. Returns the raw file content. Use onedrive_list_files or onedrive_get_file to find the item ID.
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.