Microsoft Graph API for Teams: Setup, Endpoints, Security
Yes, Microsoft Teams has an API: it’s Microsoft Graph. From one endpoint, https://graph.microsoft.com, you can create teams and channels, manage members, send messages, subscribe to change notifications and read security alerts. This guide covers app registration and permissions, the REST calls that matter, change notifications, team templates and security controls.
- One-stop shop : Access all Microsoft 365 data through a single API
- Automate everything : Create teams, manage channels, handle users without manual work
- Custom apps : Build apps that take Teams to the next level
- Real-time sync : Keep data up-to-date across Microsoft 365
- Deep insights : Analyze team collaboration and engagement
Who should use this? Microsoft 365 and Teams admins, developers and Power Platform makers.
Here’s a quick look at key features:
| Feature | Benefit |
|---|---|
| REST APIs | Create/manage teams, channels, and messages |
| Event-based systems | React to real-time Teams changes |
| User management | Add/remove members, update roles |
| Templates | Quick team setup with custom structures |
| Security controls | SSO, access rules, compliance checks |
Ready to supercharge your Teams? Let’s dive in.
Setting Up Authentication and Access
Let’s talk about securing your Microsoft Graph API integration with Teams. It’s not just important – it’s essential. Here’s what you need to know:
Microsoft Identity: Your Security Gatekeeper
Microsoft Identity platform is like a bouncer for your Graph API. Here’s how it works:
- You register your app in the Microsoft Entra admin center. No exceptions.
- Your app asks for an access token to use Microsoft Graph.
- The platform checks your app’s credentials and permissions before letting it in.

These two protocols are the backbone of secure API access:
- OAuth 2.0 handles authorization. It’s like giving your app a VIP pass to access resources for a user.
- OpenID Connect builds on OAuth 2.0, adding identity checks to the mix.
To use them:
- Set up OAuth 2.0 for your app’s authorization.
- Use OpenID Connect when you need to verify user identity.
- Use authentication libraries. They’ll handle the complex stuff for you.
Permissions: Your App’s VIP Pass
Think of permissions as your app’s backstage pass. They decide what your app can access:
| Type | Needs User Sign-in? | Best For |
|---|---|---|
| Delegated | Yes | Apps acting for a user |
| Application | No | Background services |
Here’s a pro tip: Only ask for what you need. It’s like packing for a trip – take only what’s necessary.
To set up permissions:
- Sign in to the Microsoft Entra admin center and open Entra ID > App registrations, then select your app.
- Find Manage > API permissions.
- Click + Add a permission > Microsoft Graph.
- Pick your permission type and specifics.
- Grant admin consent if the permission requires it.
Keeping It Secure
Security isn’t a one-and-done deal. It’s ongoing. Here’s what to do:
- Treat access tokens like cash. Keep them safe and out of sight.
- Check your permissions regularly. Remove what you don’t need.
- Watch for weird API usage. It could mean trouble.
“The fewer permissions an app requests, the fewer privacy concerns for customers.” – Microsoft Graph permissions best practices
Ways to Connect Teams with Graph API
Let’s dive into how you can use Graph API to supercharge your Teams experience.
Working with REST APIs
REST APIs are the backbone of Teams integration with Graph API. Here’s how to use them:
Create and manage teams : Use the /teams endpoint to create, update, and delete teams. For example:
POST https://graph.microsoft.com/v1.0/teams
Channel management : The /channels endpoint lets you add, change, or remove channels.
Send messages : POST to /teams/{team-id}/channels/{channel-id}/messages or /chats/{chat-id}/messages. These calls use delegated permissions; application permissions are only supported for migration, so use a bot for unattended notifications.
Event-Based Systems
Event-based systems help your apps react to real-time Teams changes.
Change notifications : Subscribe to updates for specific resources:
- Group changes:
/groups/{id} - Chat updates:
/chats/{id} - Call records:
/communications/callRecords
Webhooks : Get notified when data changes in Microsoft Graph. No more constant polling!
| Subscription Type | Maximum Quota |
|---|---|
| Per organization (all Teams resources combined) | 10,000 subscriptions |
| Per app and team (teams, channels, members) | 1 subscription |
Going over a limit returns 403 Forbidden. (Microsoft Learn)
Setting Up Notifications
Here’s how to keep your integration in the loop:
- Send a POST request to the subscriptions endpoint.
- Include the change type, notification URL, resource, and expiration date.
- Set up a reliable endpoint to receive notifications 24/7.
Pro tip : Return a 2xx response within 3 seconds (queue the work and reply 202 Accepted). Microsoft Graph retries failed deliveries for up to 4 hours, and endpoints that are persistently slow get notifications delayed or dropped. (Microsoft Learn)
Keeping Data in Sync
Want to keep your Teams data consistent? Try these:
- Use delta queries with webhooks to track changes.
- Check and renew subscriptions before they expire.
- Use change notification endpoints to monitor Teams updates.
Managing Teams Through Graph API
Microsoft Graph API packs a punch when it comes to Teams management. Let’s explore how you can use it to supercharge your workflow.
Automating Team Tasks
Why waste time on repetitive tasks? Here’s how Graph API can do the heavy lifting for you:
1. Creating teams at scale
Got a bunch of teams to set up? No sweat. Use this API call to create a team from a template, and repeat the call for each team you need:
POST https://graph.microsoft.com/v1.0/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName": "Sales Department",
"description": "Collaborate on sales strategies and customer relationships"
}
Team creation is asynchronous: the call returns 202 Accepted with a link to an operation you poll. Microsoft throttles POST /teams at 10 requests per second per app per tenant, so pace bulk scripts and honor Retry-After on 429 responses.
2. Bulk channel creation
Once your team’s up, populate it with channels:
POST https://graph.microsoft.com/v1.0/teams/{team-id}/channels
Content-Type: application/json
{
"displayName": "Marketing Campaigns",
"description": "Discuss ongoing marketing initiatives"
}
3. Scheduled archiving
Old teams cluttering up your workspace? Archive them automatically:
POST https://graph.microsoft.com/v1.0/teams/{team-id}/archive
Managing Users and Roles
Keeping your Teams house in order means managing who’s who and what they can do. Here’s how:
1. Adding team members
Bring new folks on board with this API call:
POST https://graph.microsoft.com/v1.0/teams/{team-id}/members
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["member"],
"user@odata.bind": "https://graph.microsoft.com/v1.0/users/{user-id}"
}
2. Updating member roles
Need to promote someone? Use this PATCH request:
PATCH https://graph.microsoft.com/v1.0/teams/{team-id}/members/{membership-id}
Content-type: application/json
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"roles": ["owner"]
}
3. Removing members
Sometimes, you gotta say goodbye:
DELETE https://graph.microsoft.com/v1.0/teams/{team-id}/members/{membership-id}
Resource Control
Keeping your Teams resources in check is key. Here’s what you need to know:
Teams app permissions are a two-headed beast:
| Permission Type | Management Location |
|---|---|
| Graph API | Microsoft Entra ID |
| Teams-specific | Resource-specific consent (RSC) |
RSC lets Teams apps manage specific resources in your org. Just declare these permissions in your app’s manifest file.
When it comes to permissions, less is more. Always go for the least privileged option. For example, when adding team members:
| Permission Type | Least Privileged Permission |
|---|---|
| Delegated (work/school account) | TeamMember.ReadWrite.All |
| Application | TeamMember.ReadWrite.All |
Using Templates for Teams Setup
Templates can make setting up Microsoft Teams across your organization a breeze. Here’s how to use them effectively:
Making Custom Templates
Creating custom templates is straightforward:
- Sign in to the Teams admin center
- Go to Teams > Team templates
- Click “Add” and select “Create a brand new template”
- Enter template settings (name, description)
- Add channels, tabs, and apps
- Submit your template
It can take up to 24 hours for users to see a custom template change in the gallery.
These are the properties you can and can’t customize in templates built in the Teams admin center:
| Supported | Not Supported |
|---|---|
| Template type | Team membership |
| Team name | Team picture |
| Team description | Channel settings |
| Team visibility | Connectors |
| Team settings | Files and content |
| Auto-favorite channel | |
| Installed apps | |
| Pinned tabs |

nBold offers advanced template features:
- Collaboration Template Builder: Create rich, custom templates
- Team Creation Automation: Quickly set up new teams from templates
- IT Governance Policies: Align templates with company policies
nBold’s Platform plan is quote-based and priced per user, with volume discounts for larger organizations.
Automatic Setup Options
Automate your Teams setup to save time:
1. Microsoft Graph API : Create teams programmatically:
POST https://graph.microsoft.com/v1.0/teams
Content-Type: application/json
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName": "Sales Department",
"description": "Collaborate on sales strategies and customer relationships"
}
2. Power Automate : Build flows to create teams automatically based on triggers or schedules.
3. PowerShell : Use scripts for batch team creation, great for large-scale setups.
Security Controls and Settings
When you connect Microsoft Graph API to Teams, you need to lock things down tight. Here’s how to keep your data safe and your users protected.
Setting Up Single Sign-On
Single Sign-On (SSO) makes life easier for Teams app users. They can access your app without typing in passwords over and over. Here’s the setup:
- Register your app in Microsoft Entra ID
- Set API permissions (start with User.Read)
- Use MSAL library in your app code
Access Rules
Follow the “least privilege” rule. Only ask for what you need:
| Permission Type | What to Do | Example |
|---|---|---|
| Delegated | Ask for minimum | User.Read for profile info |
| Application | Use carefully | Mail.Read for background tasks |
To handle permissions:
- Use
Find-MgGraphPermissionto find what you need - List required permissions in
Connect-MgGraph - Regularly check and remove extra permissions
Checking Compliance
You can’t skip company security rules. Here’s your must-do list:
- Use Multi-Factor Authentication (MFA) for all service accounts
- Create new service accounts to avoid extra privileges
- Turn on auditing and check logs often
- Use access rights management software
Tracking System Use
Keep an eye on your API activity. Here’s how:
- Use Microsoft Graph security API to see alerts from different security tools
- Check Microsoft Secure Score to spot security gaps
- Set up automatic security management and monitoring
Want to see security alerts? Try this API call:
GET https://graph.microsoft.com/v1.0/security/alerts_v2
The older /security/alerts endpoint retires on October 15, 2026; alerts_v2 needs the SecurityAlert.Read.All permission. This surfaces security alerts across your Microsoft 365 tenant, Teams included.
Summary
Microsoft Graph API and Teams integration can supercharge your organization’s collaboration and security. Here’s what you need to know:
Boosting Productivity
Microsoft Graph API is your one-stop shop for Microsoft 365 data. With it, you can:
- Create and manage teams automatically
- Build custom apps to expand Teams’ capabilities
- Keep your Microsoft 365 services in sync
Security Matters
When you’re connecting Graph API to Teams, security is crucial:
- Use OAuth 2.0 and OpenID Connect for solid authentication
- Only grant the permissions you absolutely need
- Set up Single Sign-On (SSO) for better security and user experience
Automation Power
Graph API lets you automate like a pro:
- Set up teams and channels in bulk
- Control user roles and permissions with code
- Automatically archive old teams on a schedule
Here’s a quick look at some common automation tasks:
| Task | API Endpoint | What it does |
|---|---|---|
| Make a team | POST /teams | Creates a new team with custom settings |
| Add a member | POST /teams/{team-id}/members | Brings new users into the team |
| Create a channel | POST /teams/{team-id}/channels | Adds new channels to existing teams |
Templates for Speed
Templates can make setting up Teams a breeze:
- Make custom templates in the Teams admin center
- Try nBold’s Collaboration Template Builder for advanced features
- Use Microsoft Graph API to create teams from templates programmatically
Stay Compliant and Watchful
Keep your security and compliance game strong:
- Use Multi-Factor Authentication (MFA) for all service accounts
- Regularly check and remove unnecessary permissions
- Keep an eye on API activity with Microsoft Graph security API
FAQs
Does Teams use Graph API?
Yes, Teams relies heavily on Graph API. Here’s the scoop:
Graph API is the go-to method for developers to interact with Teams data and features. It’s like a Swiss Army knife for Teams development.
With Graph API, you can:
- Mess with Teams messages
- Manage channels
- Handle user data
- And a whole lot more
“Microsoft Graph is the gateway to data and intelligence in Microsoft cloud services like Microsoft Entra and Microsoft 365.” – Microsoft Graph overview
Here’s a taste of what you can do with Graph API in Teams:
| What you want to do | How to do it | What it does |
|---|---|---|
| Make a new team | POST /teams | Sets up a fresh team |
| Get team info | GET /teams/{id} | Grabs details about a specific team |
| Add a channel | POST /teams/{id}/channels | Creates a new channel in a team |
| Send a message | POST /teams/{id}/channels/{id}/messages | Fires off a message to a channel |
When you’re playing with Graph API and Teams:
- Stick to the latest API version. New is usually better.
- Watch out for rate limits. Don’t go overboard.
- Handle errors like a pro. Things can go wrong, be ready.
Graph API opens up a world of possibilities for Teams. It’s powerful stuff, so use it wisely!