Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Gmail API

by Google

Read, sort and send mail in Gmail.

Email sendingOfficial MCP server

WebsitePricingGitHub

1. Price

Free tier: Usage under 80,000,000 quota units per day per project isn't billed. As reported on the official pricing page, checked Oct 10, 2026.

developers.google.com/workspace/gmail/api/reference/quota

Checked against the maker's official pages, pricing on Oct 10, 2026. Tap a verdict to see its source.How we checkedReport an error

What Gmail API does

The Gmail API lets your app work with a person's own Gmail mailbox after they sign in with Google and approve access. The app can search and read messages, add labels, write drafts and send mail from that address. It is for working with real mailboxes, not for sending newsletters or receipts from your own domain.

  • Gmail API is one of 23 APIs in the Email sending category on AgentGid.
  • It is one of 21 that can be started for free.
  • It ships an official MCP server, like 9 others here.
  • Its official SDK is the 1st most downloaded in the category (32.1M a week).

What people build with it

Send mail from the user's own address

Your app writes and sends a message, or saves a draft, from the signed-in person's Gmail, so replies come back to their inbox.

Find messages like in the Gmail search box

Pull out invoices, order confirmations or messages from one sender with the same search words people type in Gmail.

Back up or index a mailbox

Copy someone's mail into an archive or a search index, with read-only access so nothing can be changed or deleted.

Sort and label incoming mail

Put labels such as "Invoices" on matching messages, or set up filters that act on new mail automatically.

React the moment new mail arrives

Get a notice on your server when a watched mailbox changes, instead of checking it again and again.

AI assistant that drafts replies Idea

An assistant reads a customer's message and leaves a suggested reply as a draft, which the person checks and sends themselves.

Gmail API popularity

30.8M
SDK downloads a week
+3.7% on the 4-week average
573
public agent repos use its SDK
12.3K
GitHub stars, googleapis/google-api-nodejs-client
SDK downloads per weeknpm @googleapis/gmail, pypi google-api-python-client 30,752,501

SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026.

Pricing

Free tier

Usage under 80,000,000 quota units per day per project isn't billed

Cheapest plan

No monthly plan

Usage price

Quota-unit based: messages.send = 100 units; 1,200,000 units per minute per project; 6,000 units per minute per user

Plans

Quotas changed May 1, 2026 for new Cloud projects; Google says full billing details for usage above the daily threshold come later in 2026 with 90 days' notice. Limit of 500 recipients per message.

As reported on the official pricing page, checked Oct 10, 2026. Prices change: confirm before you buy. developers.google.com/workspace/gmail/api/reference/quota

Limits

All projects created from May 1, 2026

1,200,000 quota units per minute per project; 6,000 per minute per user

All projects

80,000,000 quota units per day before charges apply (cannot be raised)

All projects

Costs per call: messages.send 100 units, messages.list 5, messages.get 20

All accounts

500 recipients per message

From the official docs. developers.google.com/workspace/gmail/api/reference/quota

Key and access

How it signs in

OAuth 2.0 user consent with scopes (each user signs in with Google); the access token goes in the Authorization header.

Environment variable
none fixed; the quickstart reads credentials.json, and Python samples use google.auth.default() (GOOGLE_APPLICATION_CREDENTIALS)
Safe in browser code
Yes
Card at sign-up

No

Steps only a person can do

  • Create or pick a Google Cloud project, turn on the Gmail API and set up the OAuth consent screen (app name, support e-mail, audience). Read the client ID and secret from credentials.json on the server, kept out of git.
  • Create an OAuth client; if the app is an AI agent acting for users, tick the AI-powered agent option (it cannot be changed later). Use that client in the sign-in flow and store each user's refresh token encrypted.
  • Before a public launch, submit the app for Google verification, and the security assessment if restricted scopes are used. Until then, keep the app in testing with listed test users.
  • Each user signs in and approves the requested access. Call the API with userId 'me' for that user.

Commercial use and your data

Free to call within Google's limits for any app, including paid ones, under the Google APIs Terms. Apps that read people's mail must follow Google's user data rules, and may not use that mail to train general AI models.

In a paid app
With conditions

Allowed under the Google APIs Terms and the Workspace user data policy; public apps need verification, and restricted scopes may need a yearly security assessment.

“If your public application uses scopes that permit access to certain user data, it must complete a verification process.” source

To train your own AI
No

Mail data may not be used to train or improve general AI models beyond that user's own personalized model.

“Transferring, selling, or using user data to create, train, or improve a machine learning or artificial intelligence model beyond that specific user's personalized model for the appropriate use case or user-facing feature.” source

client-work
With conditions

Fine for internal tools in a client's own Workspace (internal apps skip some review); public apps follow the same verification rules.

“Note: If your app is only used by users within your own domain,” source

Trains on what you send

Rule for your app, not Google's own use; you may not use Gmail user data to train general AI models.

“Transferring, selling, or using user data to create, train, or improve a machine learning or artificial intelligence model beyond that specific user's personalized model for the appropriate use case or user-facing feature.” source

Keeps your data

Your app must publish a privacy policy that says how it uses, stores and shares the Google user data it gets.

“You must publish a privacy policy that fully documents how your application interacts with user data.” source

Errors to handle

401 authError

The access token is expired or invalid, or lacks the needed scope.

Refresh the token with the refresh token (client libraries do this); if that fails, send the user through sign-in again.

403 rateLimitExceeded / userRateLimitExceeded

The user or project hit a rate limit.

Retry with exponential backoff and make fewer requests.

403 domainPolicy

The user's Workspace admin does not allow apps to access Gmail.

Tell the user to ask their domain administrator to allow your app.

429

Daily sending limit, bandwidth limit or too many parallel requests for one user.

Wait for the retry time and back off; per-user limits cannot be raised.

500 backendError (also 502, 503, 504)

An unexpected error on Google's side.

Retry with exponential backoff.

Use it from an agent

Our agent check

4 of 6: llms.txt no, OpenAPI no, SDK yes, MCP yes, status page yes, AI assistants allowed yes

Checked Nov 13, 2026.

MCP server

Gmail MCP server (gmailmcp.googleapis.com), Developer Preview

https://gmailmcp.googleapis.com/mcp/v1

npm
npm install @googleapis/gmail
PyPI
pip install google-api-python-client

Alternatives

Gmail API This page

Free planFree tierOfficial MCP

Resend

Pick Resend to send transactional or marketing mail from your own domain, without users signing in to Gmail.

See its pageNo free tier

Postmark

Pick Postmark for receipts and password resets from your domain, with handling of incoming mail.

See its pageNo free tier

AgentMail

Pick AgentMail when an AI agent needs its own inboxes to send, receive and reply, instead of a person's Gmail.

See its pageNo free tier

All email sending APIs

Get started

Tell your AI assistant

“Connect Gmail with OAuth using googleapis on my server: ask only for gmail.readonly (or gmail.send if we only send), keep credentials.json and tokens out of git, search with the q parameter, and retry 429 and 5xx errors with exponential backoff.”

  1. In a Google Cloud project, turn on the Gmail API, set up the consent screen and create an OAuth client; save the downloaded file as credentials.json.

    From developers.google.com/workspace/gmail/api/quickstart/nodejs

  2. Install the client libraries used by the Node.js quickstart.

    npm install googleapis@105 @google-cloud/local-auth@2.1.0 --save

    From developers.google.com/workspace/gmail/api/quickstart/nodejs

  3. Run the sample; the first run opens a browser to sign in and approve, then it lists the mailbox labels.

    node .

    From developers.google.com/workspace/gmail/api/quickstart/nodejs

First request

Request from the search guide (needs an OAuth access token); response is the structure from the messages.list reference, where each message carries only an id and a threadId.

GET https://www.googleapis.com/gmail/v1/users/me/messages?q=in:sent after:2014/01/01 before:2014/02/01

Mistakes to avoid

Asking for https://mail.google.com/ (full access) when the app only sends or reads.
Ask for gmail.send to send, or gmail.readonly to read; use full access only for permanent deletion.

Broader scopes are restricted and mean more review, and users trust narrow requests more.

Putting plain text or JSON fields like to and subject into messages.send.
Build a full email (RFC 2822 MIME), encode it as base64url and put it in the raw field.

The API only accepts the message as one encoded raw string.

Treating a 200 answer from messages.send as proof the mail was delivered.
Watch for later 429 "Mail sending" errors and check the Sent label or bounces.

Over the daily limit, errors can start several minutes after successful-looking sends.

Sending many requests at once for the same user to go faster.
Limit parallel requests per user and retry 429 and 403 rate errors with exponential backoff.

Gmail has a per-user concurrent request limit on top of the rate limits.

Running the desktop quickstart on a remote server over SSH.
Run it on a computer with a browser, or use a web OAuth flow for server apps.

The local sign-in needs a browser on the same machine.

Questions

Does the Gmail API cost money?

Not below the daily threshold of 80 million quota units per project; Google says billing details for usage above it come later in 2026 with at least 90 days' notice.

Can I use it to send newsletters to thousands of people?

It sends from a person's own Gmail with that account's daily limits and at most 500 recipients per message; for bulk mail from your domain an email-sending service fits better.

Which permission should my app ask for?

The narrowest one that works, for example gmail.send to only send; broad ones like full mail access are restricted and need extra review.

Can an AI assistant use Gmail directly?

Google offers a Gmail MCP server in Developer Preview with tools such as search threads and create draft.