Overview
The Microsoft Graph API serves as a unified programmatic interface to data and services across the Microsoft cloud. It offers a single endpoint (https://graph.microsoft.com) to access information from Microsoft 365, Windows, and Enterprise Mobility + Security. This consolidation simplifies development for applications that need to interact with multiple Microsoft services, eliminating the need to connect to individual service APIs [Microsoft Graph Overview].
Developers use Microsoft Graph to build applications that can manage user identities, access mailboxes, calendars, and contacts in Outlook, manipulate files stored in OneDrive and SharePoint, and interact with Microsoft Teams. The API supports a wide range of scenarios, from automating routine tasks within an organization to building complex business applications that integrate deeply with Microsoft's productivity suite.
The API is designed as a RESTful service, utilizing standard HTTP requests and JSON responses. Authentication is handled via OAuth 2.0, providing secure access to user and organizational data based on delegated permissions or application permissions [Microsoft Graph Authentication]. This approach allows administrators to control precisely what data an application can access, enhancing security and compliance. Microsoft Graph provides a comprehensive set of SDKs for various programming languages, including .NET, Java, JavaScript, Go, and Python, simplifying client-side development and interaction with the API [Microsoft Graph SDKs].
Beyond basic data access, Microsoft Graph also exposes capabilities for webhooks, allowing applications to receive notifications when data changes, and delta queries, which enable efficient synchronization of data by retrieving only changes since the last query. These features are crucial for building responsive and data-efficient applications. The API also integrates with Microsoft Entra ID (formerly Azure Active Directory) for identity and access management, and provides access to security-related data and insights through its security API [Microsoft Graph Security API].
For developers new to the platform, Microsoft provides a Graph Explorer, an in-browser tool that allows testing API requests and viewing responses without writing code. This tool is beneficial for understanding the API's structure and available resources [Graph Explorer]. The extensive documentation and community support further aid developers in integrating and building solutions on the Microsoft Graph platform.
Key features
- Unified Endpoint: Access data and intelligence from Microsoft 365, Windows, and Enterprise Mobility + Security through a single REST API endpoint [Microsoft Graph Overview].
- Microsoft 365 Data Access: Programmatically interact with Outlook Mail, Calendar, and Contacts; OneDrive and SharePoint files; Microsoft Teams chats, channels, and meetings; and OneNote notebooks.
- Microsoft Entra ID Integration: Manage users, groups, roles, and other identity-related resources within Microsoft Entra ID [Microsoft Graph Users API].
- Security and Compliance: Access security alerts, scores, and manage compliance data, integrating with Microsoft's security services [Microsoft Graph Security API].
- Webhooks and Delta Queries: Receive real-time notifications for data changes and efficiently synchronize data by querying only for incremental updates [Microsoft Graph Delta Query].
- Extensive SDK Support: Available SDKs for .NET, Java, JavaScript, Go, PHP, PowerShell, Python, and Ruby streamline development across various platforms [Microsoft Graph SDKs].
- Graph Explorer: An interactive developer tool for testing API requests and exploring data without writing code [Graph Explorer].
- Cross-Device and Cross-Platform: Supports applications running on various operating systems and devices, enabling consistent access to data.
Pricing
Access to the Microsoft Graph API is generally included with Microsoft 365 subscriptions. Specific features or higher usage tiers may require particular Microsoft 365 licenses or pay-as-you-go billing for external or advanced scenarios. Usage is typically tied to the underlying Microsoft 365 service entitlements.
| Service/Feature | Pricing Model | Details | As Of |
|---|---|---|---|
| Basic API Access | Included with Microsoft 365 | Standard access to user, mail, calendar, files, and Teams data. | 2026-05-28 |
| Advanced Features | Specific Microsoft 365 Licenses | May require higher-tier subscriptions (e.g., Enterprise E5) for certain security, compliance, or advanced analytics features. | 2026-05-28 |
| External Usage / High Volume | Pay-as-you-go (for some services) | Some services or very high-volume external application usage might incur additional charges, details available on the pricing page. | 2026-05-28 |
| Developer Sandbox | Free | Access to developer tenants and limited production use for testing and development. | 2026-05-28 |
For detailed and up-to-date pricing information, refer to the official Microsoft Graph pricing page.
Common integrations
- Custom Business Applications: Building line-of-business applications that interact with user data, calendars, and files within a Microsoft 365 environment.
- Document Management Systems: Integrating with OneDrive and SharePoint for file storage, retrieval, and collaboration features [Microsoft Graph Drive API].
- Customer Relationship Management (CRM) Systems: Syncing contact and calendar data with Outlook, or linking activities to user profiles.
- HR and Onboarding Tools: Automating user provisioning, group assignments, and access management through Microsoft Entra ID.
- Productivity Dashboards: Creating aggregated views of user tasks, emails, and calendar events from Microsoft 365 services.
- Collaboration Tools: Enhancing Microsoft Teams functionality by automating messages, creating channels, or integrating external services into conversations [Microsoft Teams API overview].
- Security and Compliance Solutions: Developing tools that monitor security alerts, manage access policies, or retrieve audit logs from Microsoft 365 services.
Alternatives
- Google Workspace APIs: Offers a suite of APIs for integrating with Google's productivity applications like Gmail, Calendar, Drive, and Docs.
- Box Platform API: Provides APIs for content management, collaboration, and workflow automation, primarily focused on file storage and sharing.
- Slack API: Enables integration with Slack workspaces for messaging, channel management, and custom bot development.
Getting started
To begin using the Microsoft Graph API, you typically register an application in the Microsoft Entra admin center, obtain appropriate permissions, and then use an SDK to make API calls. The following Python example demonstrates how to retrieve the current user's profile using the Microsoft Graph SDK for Python, after obtaining an access token:
import requests
import json
# Replace with your actual access token obtained via OAuth 2.0
# For development, you can get a temporary token from Graph Explorer
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN_HERE"
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json"
}
# Make a GET request to the Microsoft Graph /me endpoint
# This endpoint retrieves the profile of the currently authenticated user
response = requests.get("https://graph.microsoft.com/v1.0/me", headers=headers)
if response.status_code == 200:
user_data = response.json()
print("Successfully retrieved user profile:")
print(json.dumps(user_data, indent=2))
else:
print(f"Error: {response.status_code} - {response.text}")
# Example of getting the user's messages (requires Mail.Read permission)
# response_messages = requests.get("https://graph.microsoft.com/v1.0/me/messages", headers=headers)
# if response_messages.status_code == 200:
# messages = response_messages.json()
# print("\nSuccessfully retrieved user messages:")
# print(json.dumps(messages, indent=2))
# else:
# print(f"Error retrieving messages: {response_messages.status_code} - {response_messages.text}")
This example demonstrates a basic request to the /me endpoint, which returns information about the authenticated user. Before running this code, you would need to obtain an access token, typically through an OAuth 2.0 flow. For initial testing, you can use the Graph Explorer to get a temporary access token.