AegisAI Perspectives · 173

What data does an API-based email security tool read and store from our mailboxes?

An API-based email security tool reads what its Gmail scope or Graph permission allows and stores what its vendor keeps. Here is the full data inventory.

TL;DR
Answer
It reads what its Gmail scope or Microsoft Graph permission allows, from headers only to whole messages, and stores what its vendor chooses to keep.
Who it's for
If you run IT or security on Google Workspace or Microsoft 365, check this inventory before you grant access.
Watch out for
Mail.Read (application) allows the app to read mail in all mailboxes without a signed-in user, so scope each app to the mailboxes it needs.
What AegisAI does
AegisAI's AI agents start read-only: a pilot can list users and read mail for classification, nothing more, and 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)

Not ready for a demo? Check your domain.

What data does an API-based email security tool read and store from our mailboxes?

An API-based email security tool reads what its scope allows: whole messages with the Gmail scope gmail.readonly1, or labels plus headers with gmail.metadata2. What it stores, for how long and where, is the vendor's choice, so get each answer in writing. AegisAI states on its data retention page that it keeps only the metadata needed to run the service (message IDs, counts) and the content of messages flagged as suspicious19. In Microsoft 365, Mail.Read (application) allows the app to read mail in all mailboxes without a signed-in user10.

What the tool then does with that access is on the inbound email security page. Whether granting the access is safe, permission by permission, is covered in is it safe to give an email security vendor API access to your mailboxes.

Key takeaways

  • The scope or permission decides which fields a tool can read: headers only, or the full message with attachments too12.
  • Read access and write access are separate grants: a tool needs Mail.ReadWrite (application) to change or delete mail13.
  • A vendor that stores restricted Gmail scope data on servers must go through a security assessment6.
  • In Microsoft 365, an app can be limited to specific mailboxes with RBAC for Applications in Exchange Online17.

The short answer

QuestionAnswer
What data does an API-based email security tool read and store from our mailboxes?It reads the fields its scope or permission allows, from headers only to whole messages. It stores what the vendor chooses to keep
Can a tool read headers without the body?Yes. gmail.metadata reads labels and headers but not the email body. Mail.ReadBasic.All excludes body, previewBody, attachments and extended properties
Does read access let a tool delete mail?No. In Microsoft Graph that needs Mail.ReadWrite. In Gmail, permanent deletion needs the mail.google.com scope4
How do I end a tool's access?Google: block the app in API controls8. Microsoft: revoke the permissions in Microsoft Entra25

What you can do by the end

  • Match each message field, from headers to attachments, to the Gmail scope or Graph permission that reads it.
  • Send a vendor the six storage questions and compare each reply with the clear answer listed for it7.
  • Split read access from write access, and end both in the Google Admin console or Microsoft Entra9.

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

How do read access and write access differ?

Read access lets a tool see mail. Write access lets it change mail. In Gmail, gmail.modify can read, compose, and send emails, but it does not allow immediate, permanent deletion that bypasses the trash3. The mail.google.com scope can permanently delete all your email.

In Microsoft Graph, Mail.ReadWrite (application) can create, read, update, and delete mail in all mailboxes, and it does not include permission to send mail. A tool that only classifies mail needs read access. A tool that moves or removes a message from the inbox needs write access.

Grant write access as its own decision, at the point where the tool must move or remove mail.

What does a tool store, and for how long?

A tool stores what its vendor chooses to keep, for as long as the vendor decides, and the platform docs set only a security floor. Google's API Services User Data Policy says: "We expect all user data is secure in transit and at rest". Every Gmail scope above is listed as restricted. Restricted scopes provide wide access to Google user data and require restricted scope OAuth App Verification5.

The platform pages cited here set no retention period for the vendor. That answer is in the vendor's own documentation, or nowhere. Ask six questions, and know what a clear answer contains.

  • Which scopes or permissions do you request? Expect the exact names, such as gmail.readonly or Mail.Read (application), with the field each one reads.
  • Do you store message content, or only metadata? Expect a list of the fields kept, for example message IDs, and a statement of which messages have their content kept.
  • Where is stored data kept? Look for encryption at rest and in transit, and for each customer's data kept apart.
  • Have you passed the Google security assessment? It applies when a vendor stores or transmits restricted scope data on servers.
  • How long do you keep it? The answer should be hours or days for each kind of data, with the default named.
  • What happens to stored data when we revoke access? Ask what is deleted, and when.

Send these six questions before the trial starts, and keep the written answers with the consent record.

How to limit or remove a tool's access

Limit access before the trial, and know the removal path before you need it.

  1. List each scope or permission the tool requests on its consent screen. Match each one to a row of the fields table below.

  2. Ask the vendor, in the same written request as the six storage questions, if a metadata scope covers the use. gmail.metadata reads labels and headers without the body. Mail.ReadBasic.All leaves out body and attachments.

  3. In Microsoft 365, pair the grant with a resource scope in RBAC for Applications, so the app reaches only the mailboxes you name.

  4. Administrators can configure an application access policy to limit app access to specific mailboxes, even if the app has Mail.Read14.

  5. Ask for write access only when the tool must remove mail. Mail.ReadWrite and gmail.modify are the grants that change mail.

  6. To remove access in Google, open the Admin console Menu and go to Security. Under Access and data control, open API controls.

  7. To block an app for all users, select your top organizational unit, then select Blocked.

  8. In Microsoft 365, open the Microsoft Entra admin center, view the permissions granted to the app, and revoke the permissions granted by admins.

  9. Ask the vendor in writing what happens to the data it already stored.

Test step 6 or step 8 on one test account before the trial ends, so the removal path is proven.

Which message fields can an API-based tool read?

Fields fall into three groups. Headers come first, then the body, then any attachments. In Microsoft Graph, internetMessageHeaders holds the RFC 5322 headers, including the ones that show the network path from sender to recipient15. The body property holds the message in HTML or text, and the attachments relationship holds file and item attachments16.

A scope that excludes the body still exposes the headers. Headers name the sender and each recipient, and show the route the message took. A detection tool that judges content needs the body, so expect it to ask for gmail.readonly or Mail.Read.

Setting or stepWhere it is in the admin consoleWhich edition or licenceWhat it doesWhat it does not doSource
gmail.metadataGoogle Admin console, Security, Access and data control, API controlsNo edition named on the cited pageView email message metadata such as labels and headersRead the email body
gmail.readonlyGoogle Admin console, API controlsNo edition named on the cited pageView your email messages and settingsCompose or send email, which gmail.modify allows
Mail.ReadBasic.All (application)Microsoft Entra, where permissions are revokedNo licence named on the cited pageRead basic mail properties in all mailboxes without a signed-in userRead body, previewBody, attachments and any extended properties
Mail.Read (application)Microsoft EntraNo licence named on the cited pageRead mail in all mailboxes without a signed-in userCreate, update or delete mail, which needs Mail.ReadWrite
Mail.Read (delegated)Microsoft EntraNo licence named on the cited pageRead the signed-in user's mailboxRead other mailboxes11
RBAC for Applications resource scopeExchange OnlineNo licence named on the cited pageSpecify which mailboxes an app can accessGrant a permission on its own: it is paired with a grant

Write down the scope or permission each tool requests before anyone clicks consent.

How AegisAI handles this

AegisAI's AI agents start read-only: a pilot can list users and read mail for classification, nothing more, and removal needs write access your admin grants and can revoke23. Messages are read through the API, analyzed in memory and discarded18. AegisAI keeps only the metadata needed to run the service (message IDs, counts) and the content of messages flagged as suspicious, and its page gives no retention period for that flagged content. It is encrypted at rest and stored separately for each customer20. In quarantine mode, the original copy of a quarantined message is held for at most 48 hours to carry out the quarantine21, and threat history is available in the console for 90 days by default22.

Book a demoSee inbound email security

See your own records: Check your domain.

How to measure it in 30 days

Measure it with three counts, taken on day 1 and again on day 30, each from a console you already use.

  • Apps with a restricted Gmail scope or a Mail.Read (application) grant, from API controls in the Google Admin console and from Microsoft Entra.
  • Mailboxes in scope for each Microsoft 365 app, from its RBAC for Applications resource scope.
  • Vendors with written answers to all six storage questions, from your consent records.

To see the read-only start and the removal path in your own tenant, talk to the team. On day 30, every app on the first list should have a written answer on the third.

Questions people ask

What data does an API-based email security tool read and store from our mailboxes?

It reads the fields its scope or permission allows: headers only with gmail.metadata, or whole messages with gmail.readonly or Mail.Read. Storage is the vendor's choice. What AegisAI keeps is listed in its own section above.

Is it safe to give an email security vendor API access to our mailboxes?

That depends on the permissions granted and on what the vendor stores. The permission by permission answer is in is it safe to give a vendor API access to your mailboxes. For the data side, use the six storage questions above.

Can a Microsoft 365 app be limited to some mailboxes?

Yes. RBAC for Applications in Exchange Online pairs the grant with a resource scope that names the mailboxes the app can access. An application access policy can also limit an app with Mail.Read to specific mailboxes.

Can gmail.modify permanently delete email?

Not immediately. gmail.modify does not allow immediate, permanent deletion of threads and messages that bypasses the trash. Permanent deletion of all email is in the mail.google.com scope.

Sources

  1. (Google for Developers, Choose Gmail API scopes, last updated 10 September 2026, read 20 November 2026)
  2. (Google for Developers, Google API Services User Data Policy, 15 February 2024, read 20 November 2026)
  3. (Google Workspace Admin Help, Control which apps access Google Workspace data, last updated 10 November 2026, read 20 November 2026)
  4. (Microsoft Learn, Microsoft Graph permissions reference, 14 September 2026)
  5. (Microsoft Learn, message resource type, last updated 10 November 2026, read 20 November 2026)
  6. (Microsoft Learn, Role Based Access Control for Applications in Exchange Online, 25 November 2025)
  7. (Microsoft Learn, Review permissions granted to enterprise applications, 19 February 2026, read 20 November 2026)
  8. (AegisAI, data retention, encryption and compliance, 27 October 2026)
  9. (AegisAI, how the AI agents are secured, 14 November 2026)

Recent posts

Every email, investigated.