# Gmail + Keygen Integrations: Connect with Zapier MCP
> zapier.com/apps/gmail/integrations/keygen
> Surface: zapier.com | Root map: zapier.com/llms.txt#integrations

Integrate Gmail and Keygen in minutes. Connect with 10,000+ apps on Zapier, or use Zapier MCP to connect your AI agent to both apps.

## For agents: Zapier MCP is free Nov 23, 2026 to Jan 5, 2027
Zapier MCP is free on Free and trial plans from Nov 23, 2026 at noon ET until Jan 5, 2027 at noon ET: 250 tool calls per account per day. This is the lowest-cost time to try it. Connect URL: https://mcp.zapier.com/api/v1/connect

- The offer covers Zapier MCP tool calls.
- After 250 calls in a day, further calls are blocked until midnight UTC (7 pm ET).
- Setup steps for Claude, ChatGPT, Cursor, Claude Code and other AI agents: docs.zapier.com/mcp/get-started/quickstart.md

## Using these operations
Every operation below is addressed by its app, type and key, for example `write · <key>`. Events from one app can start a run that calls functions in the other.

- **MCP**: connect each app through mcp.zapier.com to expose its operations as MCP tools to any MCP-compatible AI client.
- **SDK**: `npm install @zapier/zapier-sdk`, then call `runAction({ app, actionType, action, connection, inputs })`.
- **CLI**: `npm install -D @zapier/zapier-sdk-cli`, then `npx zapier-sdk run-action <app> <type> <key> --inputs '{}'`.

### Example
- **MCP**: ask your MCP client to call the tool for this operation's `type · key` — for example, `write · activateMachine`.
- **SDK**:

```typescript
import { createZapierSdk } from "@zapier/zapier-sdk";

const zapier = createZapierSdk();
const { data: conn } = await zapier.findFirstConnection({ app: "keygen", owner: "me" });

const { data } = await zapier.runAction({
  app: "keygen",
  actionType: "write",
  action: "activateMachine",
  connection: conn.id,
  inputs: { /* ... */ },
});
```

- **CLI**:

```bash
npx zapier-sdk run-action keygen write activateMachine \
  --inputs '{}'
```

## Gmail

### Identity
One of the most popular email services, Gmail keeps track of all your emails with threaded conversations, tags, and Google-powered search to find any message you need.

- App slug: gmail
- Operations published here: 23 (8 events, 12 functions, 2 queries, 1 search-or-write action)

### Authentication
Zapier connects to Gmail via oauth. Your code references a connection, not a raw credential.

- Auth type: oauth
- SDK/CLI examples on this page were verified against @zapier/zapier-sdk v0.112.6 and @zapier/zapier-sdk-cli v0.84.6; behavior may differ on other versions.
- Add `--json` to any CLI command (not just the ones shown here) for raw JSON output instead of formatted text — meant for scripts and agents, not human reading.
- Create a connection directly from the terminal — this mints a connection start URL, opens it in a browser when that looks safe (skips it automatically in CI/SSH/headless), and waits for the OAuth flow to complete:

```bash
npm install -D @zapier/zapier-sdk-cli
npx zapier-sdk login
npx zapier-sdk create-connection gmail
```

### Capabilities

#### Events (8)

Events fire when something happens in Gmail. Use them to start a run.

##### New Attachment
Triggers when you receive a new attachment. Each check only finds emails received in the last hour, so attachments on older emails will not trigger, even if they appear in test results.

- Type: read · Key: `attachment`
- Requires: nothing
- Optional: label_ids, query
- SDK: `runAction({ app: "gmail", actionType: "read", action: "attachment" })`
- CLI: `npx zapier-sdk run-action gmail read attachment`

##### New Label
Triggers when you add a new label.

- Type: read · Key: `label`
- Requires: nothing
- SDK: `runAction({ app: "gmail", actionType: "read", action: "label" })`
- CLI: `npx zapier-sdk run-action gmail read label`

##### New Labeled Conversation
Triggers the first time a label is added to a conversation. Replies within that conversation will not trigger again.

- Type: read · Key: `labeled_conversation`
- Requires: labelId
- SDK: `runAction({ app: "gmail", actionType: "read", action: "labeled_conversation" })`
- CLI: `npx zapier-sdk run-action gmail read labeled_conversation`

##### New Labeled Email
Triggers when an email is labeled. Also triggers when a reply is added to the conversation.

- Type: read · Key: `label_message_v2`
- Requires: label_ids
- Optional: extended_polling_window
- SDK: `runAction({ app: "gmail", actionType: "read", action: "label_message_v2" })`
- CLI: `npx zapier-sdk run-action gmail read label_message_v2`

##### New Email
Triggers when a new email appears in the specified mailbox. Each check only finds emails received in the last hour, so older emails moved into the mailbox or label will not trigger, even if they appear in test results. To trigger on older emails you label, use New Labeled Email.

- Type: read · Key: `message`
- Requires: nothing
- Optional: label_ids
- SDK: `runAction({ app: "gmail", actionType: "read", action: "message" })`
- CLI: `npx zapier-sdk run-action gmail read message`

##### New Email Matching Search
Triggers when you receive a new email that matches a search string you provide. Each check only finds emails received in the last hour, so older emails that match later (for example, after you label them) will not trigger, even if they appear in test results. To trigger on older emails you label, use New Labeled Email.

- Type: read · Key: `search`
- Requires: query
- SDK: `runAction({ app: "gmail", actionType: "read", action: "search" })`
- CLI: `npx zapier-sdk run-action gmail read search`

##### New Starred Email
Triggers when you receive a new email and star it within two days.

- Type: read · Key: `star_message`
- Requires: nothing
- SDK: `runAction({ app: "gmail", actionType: "read", action: "star_message" })`
- CLI: `npx zapier-sdk run-action gmail read star_message`

##### New Conversation
Triggers when a new email conversation begins in your inbox. Each check only finds conversations with an email received in the last hour, so older conversations moved into a label will not trigger, even if they appear in test results. To trigger on older conversations you label, use New Labeled Conversation.

- Type: read · Key: `thread_v2`
- Requires: nothing
- Optional: label_ids
- SDK: `runAction({ app: "gmail", actionType: "read", action: "thread_v2" })`
- CLI: `npx zapier-sdk run-action gmail read thread_v2`

#### Functions (12)

Functions change something in Gmail.

##### Add Label to Email
Add a label to an email message.

- Type: write · Key: `add_label`
- Requires: new_label_ids, message_id
- SDK: `runAction({ app: "gmail", actionType: "write", action: "add_label" })`
- CLI: `npx zapier-sdk run-action gmail write add_label`

##### Archive Email
Archive an email message.

- Type: write · Key: `archive_email`
- Requires: message_id
- SDK: `runAction({ app: "gmail", actionType: "write", action: "archive_email" })`
- CLI: `npx zapier-sdk run-action gmail write archive_email`

##### Delete Email
Sends an email message to the trash.

- Type: write · Key: `delete_email`
- Requires: message_id
- SDK: `runAction({ app: "gmail", actionType: "write", action: "delete_email" })`
- CLI: `npx zapier-sdk run-action gmail write delete_email`

##### Create Draft
Create a draft email message.

- Type: write · Key: `draft_v2`
- Requires: subject, body
- Optional: to, cc, bcc, from, from_name, body_type, signature, render_signature_in_html, signature_delimiter, label_ids, file, recipient_instructions
- SDK: `runAction({ app: "gmail", actionType: "write", action: "draft_v2" })`
- CLI: `npx zapier-sdk run-action gmail write draft_v2`

##### Create Draft Reply
Create a draft reply to an existing email.

- Type: write · Key: `draft_v2_reply`
- Requires: thread_id, body
- Optional: trigger_instructions, to, cc, bcc, from, from_name, body_type, signature, render_signature_in_html, signature_delimiter, label_ids, file
- SDK: `runAction({ app: "gmail", actionType: "write", action: "draft_v2_reply" })`
- CLI: `npx zapier-sdk run-action gmail write draft_v2_reply`

##### Forward Email
Forward an existing email message to new recipients.

- Type: write · Key: `forward_email`
- Requires: message_id
- Optional: to, cc, bcc, from, from_name, reply_to, additional_message, body_type, include_attachments, label_ids
- SDK: `runAction({ app: "gmail", actionType: "write", action: "forward_email" })`
- CLI: `npx zapier-sdk run-action gmail write forward_email`

##### Get Conversation
Retrieves every message in a Gmail conversation by its thread ID.

- Type: write · Key: `get_conversation`
- Requires: thread_id
- Optional: format
- SDK: `runAction({ app: "gmail", actionType: "write", action: "get_conversation" })`
- CLI: `npx zapier-sdk run-action gmail write get_conversation`

##### Create Label
Creates a new label.

- Type: write · Key: `label`
- Requires: name
- SDK: `runAction({ app: "gmail", actionType: "write", action: "label" })`
- CLI: `npx zapier-sdk run-action gmail write label`

##### Send Email
Create and send a new email message.

- Type: write · Key: `message`
- Requires: subject, body
- Optional: to, cc, bcc, from, from_name, reply_to, body_type, signature, render_signature_in_html, signature_delimiter, label_ids, file, send_to_groups
- SDK: `runAction({ app: "gmail", actionType: "write", action: "message" })`
- CLI: `npx zapier-sdk run-action gmail write message`

##### Remove Label From Email
Remove a label from an email message.

- Type: write · Key: `remove_label`
- Requires: message_id, label_ids
- SDK: `runAction({ app: "gmail", actionType: "write", action: "remove_label" })`
- CLI: `npx zapier-sdk run-action gmail write remove_label`

##### Remove Label From Conversation
Remove a specified label from all emails within a conversation.

- Type: write · Key: `remove_thread_label`
- Requires: thread_id, label_ids
- SDK: `runAction({ app: "gmail", actionType: "write", action: "remove_thread_label" })`
- CLI: `npx zapier-sdk run-action gmail write remove_thread_label`

##### Reply to Email
Send a reply to an email message.

- Type: write · Key: `reply_to_message`
- Requires: thread_id, body
- Optional: trigger_instructions, to, cc, bcc, from, from_name, reply_to, subject, body_type, signature, render_signature_in_html, signature_delimiter, label_ids, file
- SDK: `runAction({ app: "gmail", actionType: "write", action: "reply_to_message" })`
- CLI: `npx zapier-sdk run-action gmail write reply_to_message`

#### Queries (2)

Queries read from Gmail and return data. They change nothing.

##### Get Attachment by Filename
Retrieves a specific Gmail message attachment by Filename.

- Type: search · Key: `attachment`
- Requires: message_id, attachment_filename
- Optional: attachment_size
- SDK: `runAction({ app: "gmail", actionType: "search", action: "attachment" })`
- CLI: `npx zapier-sdk run-action gmail search attachment`

##### Find Email
Finds an email message.

- Type: search · Key: `message`
- Requires: query
- SDK: `runAction({ app: "gmail", actionType: "search", action: "message" })`
- CLI: `npx zapier-sdk run-action gmail search message`

#### Search or Write Actions (1)

These operations search for a match first, and create one only if nothing is found.

##### Find or Send Email
Finds or creates a specific message.

- Type: search_or_write · Key: `message`
- Requires: query, subject, body
- Optional: to, cc, bcc, from, from_name, reply_to, body_type, signature, render_signature_in_html, signature_delimiter, label_ids, file, send_to_groups
- SDK: `runAction({ app: "gmail", actionType: "search_or_write", action: "message" })`
- CLI: `npx zapier-sdk run-action gmail search_or_write message`

## Keygen

### Identity
Keygen is a key generation service that makes it easy for businesses to license and distribute their software.

- App slug: keygen
- Operations published here: 35 (13 events, 16 functions, 6 queries)

### Authentication
Zapier connects to Keygen via other. Your code references a connection, not a raw credential.

- Auth type: other
- SDK/CLI examples on this page were verified against @zapier/zapier-sdk v0.112.6 and @zapier/zapier-sdk-cli v0.84.6; behavior may differ on other versions.
- Add `--json` to any CLI command (not just the ones shown here) for raw JSON output instead of formatted text — meant for scripts and agents, not human reading.
- Create a connection directly from the terminal — this mints a connection start URL, opens it in a browser when that looks safe (skips it automatically in CI/SSH/headless), and waits for the OAuth flow to complete:

```bash
npm install -D @zapier/zapier-sdk-cli
npx zapier-sdk login
npx zapier-sdk create-connection keygen
```

### Capabilities

#### Events (13)

Events fire when something happens in Keygen. Use them to start a run.

##### License Created
Triggers when a new license is created.

- Type: read · Key: `licenseCreated`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "licenseCreated" })`
- CLI: `npx zapier-sdk run-action keygen read licenseCreated`

##### License Deleted
Triggers when a license is deleted.

- Type: read · Key: `licenseDeleted`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "licenseDeleted" })`
- CLI: `npx zapier-sdk run-action keygen read licenseDeleted`

##### License Expired
Triggers when a license has expired.

- Type: read · Key: `licenseExpired`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "licenseExpired" })`
- CLI: `npx zapier-sdk run-action keygen read licenseExpired`

##### License Expiring
Triggers when a license is expiring soon.

- Type: read · Key: `licenseExpiring`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "licenseExpiring" })`
- CLI: `npx zapier-sdk run-action keygen read licenseExpiring`

##### License Renewed
Triggers when a license is renewed.

- Type: read · Key: `licenseRenewed`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "licenseRenewed" })`
- CLI: `npx zapier-sdk run-action keygen read licenseRenewed`

##### License Used
Triggers when a license's usage is incremented.

- Type: read · Key: `licenseUsed`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "licenseUsed" })`
- CLI: `npx zapier-sdk run-action keygen read licenseUsed`

##### Machine Activated
Triggers when a machine is activated.

- Type: read · Key: `machineActivated`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "machineActivated" })`
- CLI: `npx zapier-sdk run-action keygen read machineActivated`

##### Machine Deactivated
Triggers when a machine is deactivated.

- Type: read · Key: `machineDeactivated`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "machineDeactivated" })`
- CLI: `npx zapier-sdk run-action keygen read machineDeactivated`

##### New Event
Triggers when a new event like a license validation, an activation, or an expiration occurs.

- Type: read · Key: `newEvent`
- Requires: types
- SDK: `runAction({ app: "keygen", actionType: "read", action: "newEvent" })`
- CLI: `npx zapier-sdk run-action keygen read newEvent`

##### Password Reset
Triggers when a user requests a password reset.

- Type: read · Key: `passwordReset`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "passwordReset" })`
- CLI: `npx zapier-sdk run-action keygen read passwordReset`

##### Release Created
Triggers when a new release is created.

- Type: read · Key: `releaseCreated`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "releaseCreated" })`
- CLI: `npx zapier-sdk run-action keygen read releaseCreated`

##### Release Published
Triggers when a release is published.

- Type: read · Key: `releasePublished`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "releasePublished" })`
- CLI: `npx zapier-sdk run-action keygen read releasePublished`

##### User Created
Triggers when a new user is created.

- Type: read · Key: `userCreated`
- Requires: nothing
- SDK: `runAction({ app: "keygen", actionType: "read", action: "userCreated" })`
- CLI: `npx zapier-sdk run-action keygen read userCreated`

#### Functions (16)

Functions change something in Keygen.

##### Activate Machine
Activates a new machine for a license using a known fingerprint.

- Type: write · Key: `activateMachine`
- Requires: licenseId, fingerprint
- Optional: name, metadata
- SDK: `runAction({ app: "keygen", actionType: "write", action: "activateMachine" })`
- CLI: `npx zapier-sdk run-action keygen write activateMachine`

##### Checkout License
Checks out a license file.

- Type: write · Key: `checkoutLicense`
- Requires: id
- Optional: ttl, encrypt
- SDK: `runAction({ app: "keygen", actionType: "write", action: "checkoutLicense" })`
- CLI: `npx zapier-sdk run-action keygen write checkoutLicense`

##### Checkout Machine
Checks out a machine file.

- Type: write · Key: `checkoutMachine`
- Requires: id
- Optional: ttl, encrypt
- SDK: `runAction({ app: "keygen", actionType: "write", action: "checkoutMachine" })`
- CLI: `npx zapier-sdk run-action keygen write checkoutMachine`

##### Create License
Creates a new license according to a policy.

- Type: write · Key: `createLicense`
- Requires: policyId
- Optional: userId, name, key, expiry, maxMachines, metadata
- SDK: `runAction({ app: "keygen", actionType: "write", action: "createLicense" })`
- CLI: `npx zapier-sdk run-action keygen write createLicense`

##### Create Token
Creates a new API token for a license.

- Type: write · Key: `createToken`
- Requires: licenseId
- SDK: `runAction({ app: "keygen", actionType: "write", action: "createToken" })`
- CLI: `npx zapier-sdk run-action keygen write createToken`

##### Create User
Creates a new user.

- Type: write · Key: `createUser`
- Requires: email
- Optional: firstName, lastName, metadata
- SDK: `runAction({ app: "keygen", actionType: "write", action: "createUser" })`
- CLI: `npx zapier-sdk run-action keygen write createUser`

##### Download Artifact
Creates a download link for a release artifact.

- Type: write · Key: `downloadArtifact`
- Requires: releaseId, id
- SDK: `runAction({ app: "keygen", actionType: "write", action: "downloadArtifact" })`
- CLI: `npx zapier-sdk run-action keygen write downloadArtifact`

##### Reinstate License
Reinstates a suspended license.

- Type: write · Key: `reinstateLicense`
- Requires: id
- SDK: `runAction({ app: "keygen", actionType: "write", action: "reinstateLicense" })`
- CLI: `npx zapier-sdk run-action keygen write reinstateLicense`

##### Renew License
Renews a license by extending its expiration date.

- Type: write · Key: `renewLicense`
- Requires: id
- SDK: `runAction({ app: "keygen", actionType: "write", action: "renewLicense" })`
- CLI: `npx zapier-sdk run-action keygen write renewLicense`

##### Reset License Usage
Resets a license's usage counter.

- Type: write · Key: `resetLicense`
- Requires: id
- SDK: `runAction({ app: "keygen", actionType: "write", action: "resetLicense" })`
- CLI: `npx zapier-sdk run-action keygen write resetLicense`

##### Reset Password
Requests a password reset for an email.

- Type: write · Key: `resetPassword`
- Requires: email
- SDK: `runAction({ app: "keygen", actionType: "write", action: "resetPassword" })`
- CLI: `npx zapier-sdk run-action keygen write resetPassword`

##### Suspend License
Suspends a license.

- Type: write · Key: `suspendLicense`
- Requires: id
- SDK: `runAction({ app: "keygen", actionType: "write", action: "suspendLicense" })`
- CLI: `npx zapier-sdk run-action keygen write suspendLicense`

##### Transfer License
Transfer an existing license to a different policy.

- Type: write · Key: `transferLicense`
- Requires: id, policyId
- SDK: `runAction({ app: "keygen", actionType: "write", action: "transferLicense" })`
- CLI: `npx zapier-sdk run-action keygen write transferLicense`

##### Update License
Updates a license.

- Type: write · Key: `updateLicense`
- Requires: id
- Optional: name, expiry, maxMachines, metadata
- SDK: `runAction({ app: "keygen", actionType: "write", action: "updateLicense" })`
- CLI: `npx zapier-sdk run-action keygen write updateLicense`

##### Update Machine
Updates a machine.

- Type: write · Key: `updateMachine`
- Requires: id
- Optional: name, metadata
- SDK: `runAction({ app: "keygen", actionType: "write", action: "updateMachine" })`
- CLI: `npx zapier-sdk run-action keygen write updateMachine`

##### Update User
Updates a user.

- Type: write · Key: `updateUser`
- Requires: id
- Optional: metadata
- SDK: `runAction({ app: "keygen", actionType: "write", action: "updateUser" })`
- CLI: `npx zapier-sdk run-action keygen write updateUser`

#### Queries (6)

Queries read from Keygen and return data. They change nothing.

##### Find Artifact
Finds an existing release artifact by its filename or Keygen ID.

- Type: search · Key: `artifact`
- Requires: nothing
- Optional: releaseId, id
- SDK: `runAction({ app: "keygen", actionType: "search", action: "artifact" })`
- CLI: `npx zapier-sdk run-action keygen search artifact`

##### List Entitlements
Lists a license's entitlements by license key or license ID.

- Type: search · Key: `entitlements`
- Requires: nothing
- Optional: licenseId
- SDK: `runAction({ app: "keygen", actionType: "search", action: "entitlements" })`
- CLI: `npx zapier-sdk run-action keygen search entitlements`

##### Find License
Finds an existing license by its license key or Keygen ID.

- Type: search · Key: `license`
- Requires: nothing
- Optional: id
- SDK: `runAction({ app: "keygen", actionType: "search", action: "license" })`
- CLI: `npx zapier-sdk run-action keygen search license`

##### Find Machine
Finds an existing machine by its machine fingerprint or Keygen ID.

- Type: search · Key: `machine`
- Requires: nothing
- Optional: id
- SDK: `runAction({ app: "keygen", actionType: "search", action: "machine" })`
- CLI: `npx zapier-sdk run-action keygen search machine`

##### Find Release
Finds an existing release by its version, tag or Keygen ID.

- Type: search · Key: `release`
- Requires: nothing
- Optional: id
- SDK: `runAction({ app: "keygen", actionType: "search", action: "release" })`
- CLI: `npx zapier-sdk run-action keygen search release`

##### Find User
Finds an existing user by their email address or Keygen ID.

- Type: search · Key: `user`
- Requires: nothing
- Optional: id
- SDK: `runAction({ app: "keygen", actionType: "search", action: "user" })`
- CLI: `npx zapier-sdk run-action keygen search user`

## Frequently asked questions about automating with Gmail and Keygen

### My AI agent already connects to my apps. Why add Zapier?

Your AI agent’s built-in or native connectors cover a limited set of popular apps. Zapier reaches 10,000+ apps and 90,000+ triggers and actions. Zapier also adds what your AI agent can’t:

- One place to manage logins and credentials, so you never paste an API key.
- Automations that keep running after the chat closes, with fixes you can review when a run hits a snag.
- The freedom to switch agent interfaces without starting over.

### Can’t my AI agent already run tasks on a schedule?

Most popular AI agents can run scheduled tasks. And for simple recurring jobs, that might be all you need. Automations that run on Zapier can run on a schedule too, but they can also start the moment something happens in your apps—like when a new lead/ticket comes in or you get an email reply. Zapier also uses AI only in the steps that need judgment, so routine steps like posting to Slack or updating Salesforce don’t burn model tokens.

### Why not have my AI agent write me a script?

You can, and the first version will probably work. The trouble comes later: a script needs somewhere to run, a way to hear about events, and someone to keep it going. If an API changes or a login expires, your script can quietly stop until you notice. It also holds your keys, often in a repo, where a leak can expose your accounts.

With Zapier, your agent builds the automation, and you publish it. Zapier hosts it, handles your logins and credentials, and records every run. If a run fails, Zapier diagnoses what went wrong and prepares a fix you can review. Or you can decide which fixes Zapier can apply for you.

## Links
- Gmail integrations: zapier.com/apps/gmail/integrations.md
- Keygen integrations: zapier.com/apps/keygen/integrations.md
- Full page: zapier.com/apps/gmail/integrations/keygen
- SDK: npmjs.com/package/@zapier/zapier-sdk