Gmail API

Programmatic access to Gmail mailboxes for apps and agents.

How MailKite fits

Gmail API reads mail you already have. MailKite provisions addresses on your domain with real deliverability — and an MCP for agents.

See the full MailKite vs Gmail API comparison

Receive email into Gmail API via MailKite

A minimal, copy-paste starter. Swap in your own domain and API key.

webhook.ts
import { verifyWebhook } from "@mailkite/client";

// MailKite POSTs every inbound email at your domain as JSON.
// Point a route at this handler in the MailKite dashboard.
export default async function handler(req: Request) {
const raw = await req.text();
const sig = req.headers.get("x-mailkite-signature") ?? "";

// Reject anything not signed by your webhook secret
const ok = await verifyWebhook(sig, raw, process.env.MK_WEBHOOK_SECRET!);
if (!ok) return new Response("bad signature", { status: 401 });

const email = JSON.parse(raw);
// Route into Gmail API: open a ticket, create a task, store a record
await routeIntoName(email); // email.from · email.subject · email.text

return new Response(JSON.stringify({ ok: true }));
}
Read the inbound webhooks guide

The Gmail API gives applications and agents programmatic access to existing Gmail mailboxes — read, send, label, and search — via OAuth. It's the path for apps that operate on a user's own Gmail, but it requires OAuth consent per user and doesn't provision new addresses or handle deliverability for your domain.

Key features

Pricing model

Free within Google API quotas

Category

Agent & MCP email

Inboxes, SDKs, and MCP servers that give AI agents email.

Questions about Gmail API

Can agents use the Gmail API?

Yes, with OAuth consent from the mailbox owner. It reads/sends from an existing Gmail account rather than a new address.

Gmail API vs MailKite?

Gmail API operates on existing Gmail mailboxes. MailKite provisions new addresses on your own verified domain with SPF/DKIM deliverability and an MCP server. See /alternatives/gmail-api.

Related

Similar tools

Try MailKite alongside Gmail API.

Point a domain, drop in a webhook URL, and send your first email in minutes. Unlimited domains, no credit card.