AegisAI Perspectives · 094

What is API-based email security and how does it integrate with Microsoft 365?

API-based email security connects to Microsoft 365 as an admin-approved Graph app that reads mail after delivery and removes threats, with no MX change.

TL;DR
Answer
An app that reads Microsoft 365 mail through the Microsoft Graph API after delivery and removes bad messages, approved by an admin, with no MX record change.
Who it's for
Microsoft 365 admins and security reviewers who must list the Graph permissions, consent roles and removal route before a trial starts.
Watch out for
Mail.Read as an application permission reads email in all mailboxes. Scope it with RBAC for Applications and allow 30 minutes to 2 hours for changes.
What AegisAI does
AegisAI reads mail through the Microsoft 365 or Google Workspace API after delivery, with no change to mail routing. Removal needs write access your admin grants and can revoke.
Book a demo

See it on your own Google Workspace or Microsoft 365 tenant. No MX change.

Or get the Q3 2026 State of the AI Attack report (free, instant download)

What is API-based email security and how does it integrate with Microsoft 365?

API-based email security is an app that authenticates to the Microsoft Graph API, scans messages in Microsoft 365 after delivery to user mailboxes and removes the ones it judges malicious3. AegisAI reads mail through the Microsoft 365 API after delivery, with no change to mail routing18.

What you can do by the end

  • List the admin roles that can consent and the Graph permissions each step of the integration needs.
  • Limit the app to chosen mailboxes with RBAC for Applications, and allow for the delay before changes apply.
  • Ask each candidate which removal route it uses, since the Graph remediate API is beta only.

What does API-based email security do inside Microsoft 365?

It reads and acts on mail that Exchange Online has already delivered. Microsoft describes services that authenticate, use the Microsoft Graph API to scan messages after delivery, and remove messages they believe to be malicious or unwanted. Mail keeps its normal route, so the domain's MX record stays with Microsoft 365. A gateway works the other way: for mail to reach a third-party filter first, the domain's MX record must point to that provider17.

Microsoft notes this integration typically requires granting the service full access to mailboxes4. The cross-platform version of this design is set out in how API-based email security works without an MX change.

Write "after delivery, by Graph API, no MX change" in the first line of your security review.

Short on time? Watch the explainer, or book a demo.

Who has to approve the connection?

A Privileged Role Administrator or a Global Administrator approves it, because only those two roles can consent to application permissions7. The app then calls Microsoft Graph with its own identity, without a signed-in user. Microsoft calls application permissions highly privileged, since they let an app access and modify resources with no user present.

Read every permission on the consent screen before anyone clicks Accept, and record who consented and when.

Schedule the consent with one named Global Administrator or Privileged Role Administrator, and keep the screenshot of the consent screen.

Which Graph permissions does each step need?

Reading needs Mail.Read as an application permission. That permission allows the app to read email in all mailboxes without a signed-in user11. Change notifications for new messages also need Mail.Read12. The delegated version is no substitute. It only subscribes to folders in the signed-in user's own mailbox.

Plan removal as its own step. Microsoft documents a removal route in Graph, the remediate API, which can move to junk, move to deleted items, soft delete, hard delete or move to Inbox15. It sits in the beta version, and Microsoft says use of these APIs in production applications is not supported.

Ask every candidate, in writing, which permission it uses to read, which it uses to remove, and which API carries the removal.

How do you limit the app to chosen mailboxes?

Use RBAC for Applications in Exchange Online. It lets admins grant permissions to an application that independently accesses data in Exchange Online9. That is how a pilot reaches a test group before the whole tenant.

Plan for the delay. Changes to app permissions pass through a cache that takes between 30 minutes and 2 hours to update, depending on the app's recent usage10. The time each stage of a rollout takes is set out in how long API-based email security takes to deploy.

Test the scope with one mailbox inside it and one outside it, 2 hours after each change.

Follow the integration from consent to removal

Run the integration in this order, and stop at step 5 if the trial is monitoring only.

  1. Register and consent.

    A Privileged Role Administrator or Global Administrator grants the application permissions.

  2. Run as the app.

    The service calls Microsoft Graph with its own identity, with no signed-in user.

  3. Grant Mail.Read.

    The application permission lets it read email across mailboxes.

  4. Scope it if needed.

    Limit access with RBAC for Applications, and wait up to 2 hours for the change.

  5. Subscribe to new messages.

    Change notification subscriptions on messages need Mail.Read.

  6. Turn on removal when ready.

    The same Graph access lets the service remove messages it believes malicious or unwanted.

  7. Confirm the removal route.

    Check which API carries the removal, since the remediate API is beta and not supported in production.

Keep a copy of this list in the change ticket, with the admin and the date beside each step.

Compare an MX gateway and an API layer in Microsoft 365

Score an MX gateway and an API layer on these rows.

CriterionMX-routed gatewayAPI-based layerAegisAI
MX recordPoints to the providerUnchanged, since it reads after deliveryNo change to mail routing
When it actsBefore the mailboxAfter delivery to user mailboxesAfter delivery
Removing delivered mailAsk the providerThrough the Graph APINeeds write access your admin grants and can revoke
Access it holdsMail in transitOften full access to mailboxesReads through the Microsoft 365 API
If the service goes downMail must route through it, since MX points to itAsk the providerMail keeps flowing, detection pauses
Filtering before deliveryYes, mail passes it firstNoNo edge. It reads mail after delivery

60-second self-check

Is your Microsoft 365 tenant ready for an API integration?

Six questions. Nothing is sent anywhere; the result shows on this page.

  1. Do you know which admin in your tenant will consent to application permissions?
  2. Do you know which Graph permissions the tool needs to read and which it needs to remove?
  3. Does the tool read mail after delivery with no change to your MX record?
  4. Is removal a separate grant your admin can give and take back?
  5. Have you decided whether to limit the app to chosen mailboxes with RBAC for Applications?
  6. Does mail keep flowing if the security service goes down?

In the last row the gateway has the edge, because mail reaches it first once the MX record points to it. Score each candidate on all six rows, and see them on your own tenant through the demo page.

How AegisAI handles this

AegisAI reads mail through the Microsoft 365 or Google Workspace API after delivery, with no change to mail routing18. Mail keeps flowing if the service is down, and detection pauses until the service returns. Removal needs write access your admin grants and can revoke. Have your admin grant that access when you want removal on, and revoke it the same way.

How does one phishing message move through the integration?

Illustrative example, figures are fictional. Northgate Dental Group (fictional) runs Microsoft 365 with 640 mailboxes and trials an API-based security app. On Monday its Global Administrator consents to the app and records the screenshot. The team scopes the pilot to 40 mailboxes with RBAC for Applications and tests one mailbox outside the scope 2 hours later. On day 3 a phishing message lands in 12 of the pilot mailboxes at 09:14. The change notification reaches the app, which fetches and judges the message. Removal is not yet granted, so the team reads the verdict and removes the copies by hand. On day 10 the administrator grants write access, and the next copy of the campaign is removed from 9 mailboxes without a ticket.

Copy this sequence into your own pilot plan and set your own mailbox counts.

How to measure it in 30 days

Track three numbers, each in a place you already have.

  • Mailboxes in scope against mailboxes intended. Compare the RBAC for Applications scope with your pilot list after each change, allowing 30 minutes to 2 hours for the cache. Check it against the scope you set with RBAC for Applications.
  • Minutes from delivery to verdict. Take the delivery time from message trace and the verdict time from the tool's log, where your tool logs it.
  • Messages removed after delivery, against messages flagged. It lives in the tool's action log, where your tool keeps one, and shows how much of the trial ran in monitoring only.

Review the three numbers on day 30, and grant write access tenant-wide only if the first one matches.

Questions people ask

What is API-based email security in Microsoft 365?

It is a service that authenticates to the Microsoft Graph API and scans messages after they are delivered to user mailboxes. The same access lets it remove messages it judges malicious or unwanted. Mail routing and MX records stay with Microsoft 365.

Does API-based email security need an MX record change?

No. The service reads mail after delivery through Microsoft Graph. An MX change is the gateway model, where the MX record must point to the third-party provider.

Who can approve the app in Microsoft 365?

Only a Privileged Role Administrator or a Global Administrator can consent to application permissions. Microsoft calls these permissions highly privileged, because they let an app access and modify resources without a signed-in user.

Can I limit the app to some mailboxes?

Yes, with RBAC for Applications in Exchange Online, which grants permissions to an app accessing Exchange Online data on its own. Changes take 30 minutes to 2 hours to apply, so test the scope after that window.

Is the Graph remediate API ready for production?

No. Microsoft says use of these APIs in production applications is not supported, and the remediate API sits in the beta version. Ask any candidate which route it uses for removal.

What happens to mail if the API service goes down?

Mail keeps its normal route through Microsoft 365, because the service is not in the delivery path. Ask each candidate what stops during an outage and how it catches up on mail delivered during the gap.

Sources

  1. (Microsoft Learn, Integrate a non-Microsoft security service with Microsoft 365)
  2. (Microsoft Learn, Manage mail flow using a third-party cloud service with Exchange Online)
  3. (Microsoft Learn, Overview of Microsoft Graph permissions)
  4. (Microsoft Learn, Role Based Access Control for Applications in Exchange Online)
  5. (Microsoft Learn, Create subscription)
  6. (Microsoft Learn, analyzedEmail: remediate, beta)
  7. (AegisAI, Inbound email security)
  8. (AegisAI, How API-based email security works without an MX change)
  9. (AegisAI, How long API-based email security takes to deploy)
  10. (AegisAI, Request a demo)

Recent posts

Every email, investigated.