Everything an AI agent can do with the OneDrive API.

A reference guide for building AI agents: every method, how to authenticate, and the permissions each one needs.

Endpoints21
API versionv1.0
Last updated23 June 2026
Orientation

How the OneDrive API works.

The OneDrive API is how an app or AI agent works with the files in a OneDrive or SharePoint document library: reading a folder's contents, uploading and updating files, moving and copying items, searching across a drive, and sharing a file with someone. Access is granted through an OAuth token and a set of permissions that decide what each call can read or write, and an agent is limited to the drives and items that token reaches. It can also push a change notification when something changes under a folder, so an agent can react instead of polling.

21Endpoints
5Capability groups
10Read
11Write
3Permissions
Authentication
Every call goes through Microsoft Graph and needs an OAuth 2.0 token sent as 'Authorization: Bearer '. A token is either delegated, acting for a signed-in user and limited to what that user can see, or application, acting as the app itself across the tenant. There is no unauthenticated access to a drive. A pre-authenticated short-lived download URL returned for a file is the one value that can be fetched without sending the token again.
Permissions
Permissions are Microsoft Graph scopes. Reads use Files.Read for the signed-in user's own files, or Files.Read.All to reach files shared with or owned across what the caller can see; writes use Files.ReadWrite and Files.ReadWrite.All. SharePoint document libraries can additionally need Sites.Read.All or Sites.ReadWrite.All. The .All scopes reach far more than the bare scope: Files.Read reads only the caller's own drive, while Files.Read.All reaches every file the caller has access to.
Versioning
Microsoft Graph exposes two endpoints, a stable v1.0 endpoint for production and a beta endpoint for preview features. The OneDrive files methods are on v1.0. Rather than minting a new version of the whole endpoint, Microsoft adds and adjusts individual methods over time and records each change in the Microsoft Graph changelog.
Data model
The core resource is the driveItem, which represents a file, a folder, or another item and is the same shape whether it lives in OneDrive or a SharePoint library. A driveItem is addressed either by its id under /items/{item-id} or by file-system path under /root:/path/to/file, and a folder's contents are its children. A drive is the container, reached as /me/drive for the signed-in user or /drives/{drive-id} for a specific one, and /sites/{site-id}/drive for a SharePoint library.
Connect & authenticate

Connection & authentication methods.

How an app or AI agent connects to OneDrive determines what it can reach. Access runs through Microsoft Graph, governed by the token behind the call and the permissions that token carries.

Ways to connect

Microsoft Graph REST API (v1.0)

The files surface answers under the Microsoft Graph v1.0 endpoint at https://graph.microsoft.com/v1.0, with drives reached as /me/drive or /drives/{drive-id} and items as driveItem resources. This is the main way an app or AI agent works with OneDrive and SharePoint files.

Best forConnecting an app or AI agent to OneDrive.
Governed byThe OAuth token and the Microsoft Graph permissions it carries.
Docs ↗

Change notifications (webhooks)

A subscription tells Microsoft Graph to post to a receiver URL when something changes under a subscribed drive folder. The notification reports only that a change occurred, so the app then calls the change-tracking method to read what changed.

Best forReacting to file changes without polling.
Governed byThe OAuth token and the read permission on the subscribed resource.
Docs ↗

Microsoft MCP Server for Enterprise (preview)

Microsoft's first-party Model Context Protocol server at https://mcp.svc.cloud.microsoft/enterprise translates natural-language requests into read-only Microsoft Graph calls. In public preview it is scoped to Microsoft Entra identity and directory data, not the OneDrive files surface, so it does not yet cover drive items.

Best forNatural-language read access to Microsoft Entra data.
Governed byThe user's roles and the scopes granted to the MCP client.
Docs ↗
Authentication

Delegated access (work, school, or personal account)

An OAuth token obtained on behalf of a signed-in user. The app can never see more than that user can, so a delegated token scoped to Files.Read reaches only that user's own OneDrive. This is the least-privilege route for acting as a specific person.

TokenDelegated OAuth 2.0 access token
Best forActing on behalf of one signed-in user
Docs ↗

Application access (app-only)

An OAuth token the app obtains as itself, with no user signed in, using application permissions granted by an administrator. It suits background automation but reaches whatever the granted .All scope allows across the tenant, and new external guests can't be invited with it.

TokenApplication OAuth 2.0 access token
Best forBackground automation across a tenant
Docs ↗
Endpoint reference

Every OneDrive API method.

Filter by method, access, or permission, or search any path. Select a row for version detail, rate limits, the related webhook event, and the source.

MethodEndpointWhat it doesAccessPermissionVersion

Drives

Read a drive's metadata, list the drives available to a user, group, or site, and get a drive's root folder.3

Also reachable as /drives/{drive-id}, /sites/{site-id}/drive, and /users/{user-id}/drive. Application access uses Files.Read.All; SharePoint libraries may need Sites.Read.All.

Acts ondrive
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Also reachable as /me/drives, /users/{user-id}/drives, and /groups/{group-id}/drives. SharePoint sites may need Sites.Read.All.

Acts ondrive
Permission (capability)Files.Read.All
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

The root is a driveItem like any other folder. Application access uses Files.Read.All.

Acts ondriveItem
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1 resource unit

Files & folders

Get an item, list a folder's children, create a folder, update an item, delete it, and move or copy items.7

Also addressable by path as /me/drive/root:/{item-path}. Application access uses Files.Read.All; SharePoint may need Sites.Read.All.

Acts ondriveItem
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1 resource unit

Root children list as /me/drive/root/children. A multi-item query. Application access uses Files.Read.All.

Acts ondriveItem
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit2 resource units

Send a body with a folder facet. The @microsoft.graph.conflictBehavior value controls naming when one already exists. Application access uses Files.ReadWrite.All.

Acts ondriveItem
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

Updates metadata, not content; use the content method to change bytes. Application access uses Files.ReadWrite.All.

Acts ondriveItem
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

Deleting a folder removes its contents too. Application access uses Files.ReadWrite.All.

Acts ondriveItem
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

A move is a PATCH that sets a new parentReference, optionally with a new name. Application access uses Files.ReadWrite.All.

Acts ondriveItem
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

Runs in the background; the response gives a URL to monitor progress rather than the finished item. Application access uses Files.ReadWrite.All.

Acts ondriveItem
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

File content

Download a file's bytes, upload a small file in one call, and create an upload session for large files.3

Redirects to a short-lived pre-authenticated download URL that needs no further token for about an hour. Application access uses Files.Read.All.

Acts ondriveItem
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1 resource unit

Supports files up to 250 MB; larger files use an upload session. Replace an existing file as /me/drive/items/{item-id}/content. Application access uses Files.ReadWrite.All.

Acts ondriveItem
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

Each range is up to 60 MiB and, except the last, a multiple of 320 KiB. Application-only access uses Sites.ReadWrite.All, not Files.ReadWrite.All.

Acts onuploadSession
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limit2 resource units

Search & change tracking

Search a drive for matching items, track changes since the last run, and list an item's thumbnails.4

Searching from /me/drive/search instead also returns items shared with the user. Doesn't support the Sites.Selected application permission. Application access uses Files.Read.All.

Acts ondriveItem
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit2 resource units

Ends a run with an @odata.deltaLink to replay later. Costs 1 unit when called with a token, 2 without. Application access uses Files.Read.All.

Acts ondriveItem
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1 resource unit (with token)

Returns small, medium, and large sizes where available. Application access uses Files.Read.All.

Acts onthumbnailSet
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Subscribe with a resource of me/drive/root or a subfolder (personal) or the root only (Business). Needs read permission on the resource: delegated Files.Read on personal, Files.Read.All on Business and for application access.

Acts onsubscription
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventdriveitem-changed
Rate limitStandard limits apply

Sharing & permissions

Create a sharing link, invite specific people to an item, list its permissions, and remove a permission.4

The scope value sets reach: anonymous (anyone with the link), organization (anyone signed in to the tenant), or users (named people). A permission operation. Application access uses Files.ReadWrite.All.

Acts onpermission
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit5 resource units

Permissions can't be set on the root of a personal OneDrive, and new external guests can't be invited with an application-only token. Application access uses Files.ReadWrite.All.

Acts onpermission
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit5 resource units

Shows links and direct grants on the item. A permission operation. Application access uses Files.Read.All.

Acts onpermission
Permission (capability)Files.Read
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit5 resource units

Deletes one link or grant by its permission id. A permission operation. Application access uses Files.ReadWrite.All.

Acts onpermission
Permission (capability)Files.ReadWrite
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit5 resource units
No endpoints match those filters.
Webhooks

Webhook events.

Microsoft Graph can notify an app or AI agent when something changes in a drive, instead of the app repeatedly asking. A change notification says only that something changed under the subscribed folder, and the agent then calls the change-tracking method to read the details.

EventWhat it signalsTriggered by
driveItem change notificationFires when an item is created, updated, or deleted under a subscribed drive folder. The notification reports only that a change happened, not the detail, so the receiver calls the change-tracking method to read exactly which items changed. On personal OneDrive a subscription can target the root or any subfolder; on OneDrive for Business only the root./me/drive/items/{parent-item-id}/children
/me/drive/items/{item-id}
/me/drive/items/{parent-id}:/{filename}:/content
/me/drive/items/{item-id}
/me/drive/items/{item-id}
/me/drive/items/{item-id}/copy
No events match that search.
Rate limits & pagination

Rate limits, pagination & request size.

OneDrive limits how much an app or AI agent can call through a resource-unit budget rather than a simple request count, where each kind of call costs a set number of units against a per-app and per-user ceiling over a time window.

Request rate

OneDrive and SharePoint throttle by a resource-unit budget rather than a raw request count, where each call has a set cost: a single-item read such as getting an item, a download, or a delta call with a token costs 1 unit, a multi-item call such as listing children or any create, update, delete, or upload costs 2 units, and any permission call costs 5 units. Those units are charged against several ceilings at once, including a per-user limit of 3,000 requests every 5 minutes and a per-app, per-tenant limit that scales with the tenant's license count, from 1,250 resource units a minute at the smallest tier up to 6,250 at the largest, plus a separate 24-hour app ceiling. Going over returns HTTP 429 Too Many Requests, or 503 when the service is overloaded, both carrying a Retry-After header in seconds that should be honored before retrying. RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset headers give an early warning as an app nears its per-minute budget.

Pagination

List, search, and change-tracking responses page through an @odata.nextLink URL: an app follows that link until it stops being returned, rather than building the URL by hand. The $top query parameter sets the page size, and search also accepts a $skipToken. Change tracking ends a run with an @odata.deltaLink instead of a nextLink, which is saved and replayed later to read only what changed since.

Request size

A single-call upload through the content method handles files up to 250 MB. Larger files go through an upload session, which takes the file in sequential byte ranges of up to 60 MiB each, where every range except the last must be a multiple of 320 KiB. A sharing-invitation message is capped at 2,000 characters. Exceeding the drive's storage quota returns HTTP 507 Insufficient Storage.

Errors

Status codes & error handling.

The status codes an agent should handle, and what to do about each.

StatusCodeMeaningWhat to do
401InvalidAuthenticationTokenThe required authentication information is missing or the token is invalid or expired.Acquire a fresh OAuth token and resend it in the Authorization header.
403accessDeniedThe caller is authenticated but the token lacks the permission, or the user lacks the rights, to act on this item.Grant the missing scope, such as Files.ReadWrite.All, or use an account with access to the item.
404itemNotFoundThe requested item doesn't exist, or the token can't see it. Graph returns 404 rather than 403 when access is the reason, so it doesn't confirm a hidden item exists.Confirm the drive and item id or path, and that the token has access to the item.
409nameAlreadyExistsThe request conflicts with the current state, most often an item with the same name already exists at the destination.Set the @microsoft.graph.conflictBehavior value to rename or replace, or choose a different name.
412preconditionFailedAn if-match or if-none-match eTag sent with the request doesn't match the item's current state.Refetch the item to read its current eTag, then retry with the updated precondition.
423lockedThe item is locked, for example checked out by another user, and can't be changed.Wait for the lock to clear or check the item back in, then retry.
429activityLimitReachedThe app or user exceeded a resource-unit budget and is being throttled. SharePoint returns 429, or 503 when the service is overloaded.Honor the Retry-After header in seconds before retrying, and slow down as RateLimit headers near zero.
507quotaLimitReachedThe upload would exceed the drive's storage quota.Free space in the drive or target a drive with available quota, then retry.
Versioning & freshness

Version history.

Microsoft Graph serves two named endpoints, the stable v1.0 endpoint and a separate beta endpoint. The OneDrive files surface lives on v1.0, where individual methods are added and changed over time rather than the whole endpoint being re-versioned.

Version history

What changed, and when

Latest versionv1.0
v1.0Current version
Stable production endpoint

The OneDrive and SharePoint files surface, built on the driveItem resource, is served on the stable v1.0 Microsoft Graph endpoint. Microsoft adds and adjusts individual methods over time and records each change in the Microsoft Graph changelog rather than re-versioning the whole endpoint. The beta endpoint carries preview features that aren't guaranteed stable.

What changed
  • driveItem covers get, list children, create folder, update, delete, move, copy, upload, download, search, and change tracking
  • Sharing is handled through createLink for links and invite for direct recipient grants, plus listing and removing permissions
  • Change tracking (delta) returns added, changed, and removed items with a deltaLink to replay later
  • Change notifications (subscriptions) post to a receiver URL when something changes under a subscribed folder
2025-11-18Feature update
Microsoft MCP Server for Enterprise enters public preview

Microsoft published its first-party MCP server, the Microsoft MCP Server for Enterprise, in public preview. It translates natural-language requests into read-only Microsoft Graph calls and is currently scoped to Microsoft Entra identity and directory data, not the OneDrive files surface. It is documented as a preview product that may change before release.

What changed
  • First-party Model Context Protocol server published at https://mcp.svc.cloud.microsoft/enterprise
  • Exposes read-only tools that run Microsoft Graph calls while honoring user roles and granted scopes
  • Scoped to Entra identity and directory read scenarios in preview, not files or OneDrive

An integration calls the v1.0 endpoint for production work and tracks individual method changes through the Microsoft Graph changelog.

Microsoft Graph changelog ↗
Questions

OneDrive API, answered.

What's the difference between Files.Read and Files.Read.All?+
Files.Read lets an app read only the files in the signed-in user's own OneDrive. Files.Read.All lets it read every file that user can access, including files other people have shared with them and, with the right setup, content across SharePoint sites. The write scopes split the same way: Files.ReadWrite covers the user's own files, and Files.ReadWrite.All covers everything they can reach. Choosing the bare scope over the .All version is the difference between an agent that touches one person's drive and one that can read across the organization.
Delegated or application permissions, which should an agent use?+
A delegated token acts on behalf of a signed-in user and can never see more than that user can. An application token acts as the app itself with no user in the loop, which suits background automation but reaches whatever the granted .All scope allows across the tenant, so it should be scoped tightly. Some actions differ by type: an upload session for a new file, for example, uses Sites.ReadWrite.All when called application-only, and new external guests can't be invited with an application-only token.
How does an agent upload a large file?+
Files up to 250 MB can be sent in one call by putting the bytes to the item's content method. Anything larger uses an upload session: the app creates the session, gets back a temporary upload URL, then sends the file in sequential byte ranges of up to 60 MiB. Each range other than the last must be a multiple of 320 KiB, and the transfer can resume from the last received range if the connection drops.
How does an agent get notified of changes instead of polling?+
Two pieces work together. A change notification subscription tells Microsoft Graph to post to a receiver URL when something changes under a subscribed folder, but the notification says only that a change happened, not what. The app then calls the change-tracking (delta) method, which returns exactly the items that were added, changed, or removed since the last run, along with a deltaLink to use next time. On a personal OneDrive a subscription can target the root or any subfolder; on OneDrive for Business it can target only the root.
How does the resource-unit rate limit work?+
Instead of counting requests, OneDrive and SharePoint charge each call a number of resource units by how expensive it is: 1 unit for a single-item read or a delta call with a token, 2 units for a list or any write, and 5 units for any permission operation. Those units are drawn from per-user, per-app, and per-tenant budgets over fixed windows. Going over returns HTTP 429 or 503 with a Retry-After header, and RateLimit headers warn an app as it approaches its per-minute budget.
Does the OneDrive API have a version number to pin?+
Not in the way a dated API does. Microsoft Graph has a stable v1.0 endpoint and a separate beta endpoint, and the OneDrive files methods live on v1.0. Individual methods are added and adjusted over time rather than the whole endpoint being re-versioned, so an integration calls v1.0 and tracks specific method changes through the Microsoft Graph changelog.
Related

More storage API guides for agents

What is Bollard AI?

Control what every AI agent can do in OneDrive.

Bollard AI sits between a team's AI agents and OneDrive. Grant each agent exactly the access it needs, read or write, folder by folder, and every call is checked and logged.

  • Set read, write, or full access per agent, never a shared OneDrive token.
  • Denied by default, so an agent reaches only the files and folders explicitly allowed.
  • Every call recorded in plain English: who, what, where, and the decision.
OneDrive
Docs Agent
Read files and folders ResourceOffReadFull use
Upload and update files ActionOffReadFull use
Create sharing links ActionOffReadFull use
Per-agent access, set in Bollard AI, not in OneDrive