---
title: OneDrive API Integration on Truto
slug: onedrive
category: Cloud Storage
canonical: "https://truto.one/integrations/detail/onedrive/"
---

# OneDrive API Integration on Truto



**Category:** Cloud Storage  
**Status:** Generally available

## Unified APIs

### Unified User Directory API

- **Licenses** — Licenses represent concepts like user seats in apps that support them
- **Me** — 
- **Roles** — The Role object represents a role of a User.
- **Users** — The User object represents a User.

### Unified File Storage API

- **Drive-Items** — Drive Items are the files and folders present in a file storage system. These items are usually part of a Drive. You can differentiate between files and folders using the type attribute.
- **Drives** — Drives is a collection of files and folders. They could have multiple Drive Items within them. Users could have multiple Drives accessible to them in a file storage system.
- **Permissions** — Permissions can answer your questions around which User has access to do what on a Drive Item or a Drive.
- **Users** — Users represent the people using the underlying file storage system.

### Unified Search API

- **Search** — Search endpoint for all the apps.

## MCP-ready AI tools

Truto exposes 13 tools for OneDrive that AI agents can call directly.

- **list_all_onedrive_me** — Retrieves the profile information of the currently authenticated user, including their ID, name, email, and userPrincipalName
- **list_all_onedrive_drives** — List drives for a user in OneDrive. Requires user_id. Returns id, driveType, name, and owner with user id and displayName for each drive.
- **get_single_onedrive_drive_by_id** — Get a drive by id in OneDrive. Returns id, driveType, owner user id and displayName, and quota details including deleted, fileCount, remaining, state, and total.
- **list_all_onedrive_drive_items** — List DriveItem by drive_id and item_id in OneDrive. Returns an array of driveItem objects including name, size, and folder childCount if applicable.
- **get_single_onedrive_drive_item_by_id** — Get metadata for a specific DriveItem by id in OneDrive using drive_id and id. Returns fields like createdBy, createdDateTime, cTag, eTag, folder childCount, id, lastModifiedBy, lastModifiedDateTime, name, size, and webUrl.
- **onedrive_drive_items_download** — Use this endpoint to download a file from the specified resource path. It retrieves the binary content of a file stored and returns it as a direct file download.
- **list_all_onedrive_search** — Run a search query in OneDrive with a JSON body containing requests specifying entityTypes, contentSources, region, query, from, size, and fields. Returns search terms, hits with hitId, rank, summary, and resource details.
- **get_single_onedrive_drive_item_content_download_by_id** — Download the contents of a DriveItem file in OneDrive using id. Returns a 302 redirect to a pre-authenticated download URL in the Location header.
- **list_all_onedrive_drive_item_permissions** — List effective sharing permissions on a DriveItem in OneDrive by id. Returns permissions including roles, link details, grantedTo user info, and inheritedFrom ancestor reference.
- **list_all_onedrive_users** — List users in OneDrive. Returns user properties including businessPhones, displayName, givenName, id, jobTitle, mail, mobilePhone, officeLocation, preferredLanguage, surname, and userPrincipalName.
- **get_single_onedrive_user_by_id** — Get information about a specific user in OneDrive. Requires id. Returns default user properties including businessPhones, displayName, givenName, id, jobTitle, mail, mobilePhone, officeLocation, preferredLanguage, surname, and userPrincipalName.
- **list_all_onedrive_search_drive_items** — Search DriveItems in OneDrive root drive using query q. Returns matching DriveItems with id, name, folder info, and searchResult.onClickTelemetryUrl fields.
- **list_all_onedrive_root** — Get metadata for the root DriveItem in OneDrive. Returns fields including id, name, size, createdBy, lastModifiedBy, createdDateTime, lastModifiedDateTime, folder childCount, and webUrl.

## How it works

1. **Link your customer's OneDrive account.** Use Truto's frontend SDK; we handle every OAuth and API key flow so you don't need to create the OAuth app.
2. **Authentication is automatic.** Truto refreshes tokens, stores credentials securely, and injects them into every API request.
3. **Call Truto's API to reach OneDrive.** The Proxy API is a 1-to-1 mapping of the OneDrive API.
4. **Get a unified response format.** Every response uses a single shape, with cursor-based pagination and data in the `result` field.

## Use cases

- **Permission-aware document ingestion for AI knowledge platforms** — Enterprise AI SaaS companies can crawl and download OneDrive files via Truto, then sync file-level permissions to ensure their AI assistant only surfaces answers from documents the querying user is authorized to access.
- **Centralized file browsing for project management tools** — Project management platforms can embed a native OneDrive file browser so users navigate drives, folders, and files without leaving the app — attaching documents to tasks or projects by reference rather than forcing re-uploads.
- **Federated search across cloud storage from within your app** — SaaS products can embed OneDrive's native search directly into their own search bar, letting users find Microsoft 365 documents without switching tabs or context.
- **Compliance-driven document linking for legal and HR platforms** — Regulated-industry SaaS companies can let users link OneDrive documents to internal records (cases, candidates, contracts) while keeping files in the Microsoft 365 environment that IT already trusts for DLP and eDiscovery.
- **Automated file sync and change detection for backup and ETL pipelines** — Data platforms can poll OneDrive drive items for metadata changes (eTag, lastModifiedDateTime) and selectively re-download only updated files, reducing bandwidth and keeping downstream systems current.

## What you can build

- **In-app OneDrive folder tree navigator** — Render a fully navigable folder structure using list_all_onedrive_drives, list_all_onedrive_root, and list_all_onedrive_drive_items so end users can browse and select files without leaving your product.
- **Permission-mirrored document access layer** — Sync OneDrive sharing permissions into your app using list_all_onedrive_drive_item_permissions to enforce the same access controls your customers already manage in Microsoft 365.
- **Embedded cross-drive document search** — Let users search across their OneDrive files directly from your app's UI using list_all_onedrive_search_drive_items, returning relevant hits with summaries powered by Microsoft's native search index.
- **Selective file download and content ingestion pipeline** — Download file contents on demand via onedrive_drive_items_download or get_single_onedrive_drive_item_content_download_by_id to feed documents into RAG pipelines, OCR workflows, or reporting engines.
- **User identity mapping between your app and Microsoft 365** — Automatically resolve your app's users to their Microsoft identities using list_all_onedrive_users and list_all_onedrive_me, ensuring API actions and audit trails are correctly attributed.
- **Storage quota dashboard for admin consoles** — Surface drive-level storage usage and quota information retrieved via get_single_onedrive_drive_by_id so IT admins using your platform can monitor capacity without switching to the Microsoft admin center.

## FAQs

### What authentication method does the OneDrive integration use?

Truto handles OAuth 2.0 authentication with Microsoft's identity platform (Entra ID) on your behalf. Your end users go through a standard consent flow to connect their OneDrive account, and Truto manages token refresh and storage automatically.

### Can I download actual file contents, or only metadata?

Both. You can retrieve rich metadata (name, size, eTag, last modified, created by) via get_single_onedrive_drive_item_by_id, and download the binary file content using onedrive_drive_items_download or get_single_onedrive_drive_item_content_download_by_id.

### How does Truto handle pagination when listing large OneDrive directories?

Truto abstracts Microsoft Graph's pagination (which uses @odata.nextLink tokens) into a consistent interface. When you call list endpoints like list_all_onedrive_drive_items, Truto handles cursor-based pagination so you can iterate through all results without managing page tokens yourself.

### Can I read file-level sharing permissions?

Yes. The list_all_onedrive_drive_item_permissions endpoint returns the effective permissions for a given drive item, including roles and the identities (users, groups, links) they are granted to. This is essential for building permission-aware features.

### Does the integration support both personal OneDrive and OneDrive for Business?

The integration works with OneDrive for Business accounts connected through Microsoft 365. You can discover all available drives (personal and shared) for an authenticated user via list_all_onedrive_drives.

### Which Truto Unified APIs cover OneDrive?

OneDrive is covered by three Unified APIs: the Unified File Storage API (drives, drive items, permissions, users), the Unified User Directory API (users, me, licenses, roles), and the Unified Search API (search across drive items). This means switching between OneDrive and other cloud storage providers requires minimal code changes.
