> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modulex.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# AgentMail Integration for AI Agents & Workflows

> Integrate AgentMail into your workflow. Create and manage email inboxes, send and receive messages, reply to threads, manage drafts, and organize threads with labels.

{/* Self-hosted logo — build-time vendored from modulex.json / Iconify (see scripts/lib/logo.js). */}

<img src="https://mintcdn.com/modulexaillc/df8MOr-hXotYLTh5/logos/placeholder.svg?fit=max&auto=format&n=df8MOr-hXotYLTh5&q=85&s=a4046f9cd6d738c81259050e9833913c" alt="AgentMail logo" width="72" height="72" data-path="logos/placeholder.svg" />

## Overview

Add **AgentMail** to any ModuleX agent or workflow. API-first email for agents and automation: create inboxes, send and receive messages, reply to and forward threads, manage drafts, and organize conversations with labels — over the AgentMail REST API (`api.agentmail.to`).

<Info>
  **Categories**: Communication · Email · Automation · **Auth**: API Key · **Actions**: 21
</Info>

## Authentication

### API Key Authentication

Authenticate using your AgentMail API key

<Steps>
  <Step title="Step 1">
    Sign up or log in at [https://agentmail.to](https://agentmail.to)
  </Step>

  <Step title="Step 2">
    Open the dashboard and navigate to the API Keys section
  </Step>

  <Step title="Step 3">
    Create a new API key or copy your existing one
  </Step>

  <Step title="Step 4">
    Paste the API key below
  </Step>
</Steps>

#### Required Credentials

| Field             | Description            | Required | Format |
| ----------------- | ---------------------- | -------- | ------ |
| AgentMail API Key | Your AgentMail API key | Yes      | `-`    |

## Available Actions

<AccordionGroup>
  <Accordion title="send_message — Send an email message from an AgentMail inbox.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to send from
    </ResponseField>

    <ResponseField name="to" type="string" required>
      Recipient email address (comma-separated for multiple)
    </ResponseField>

    <ResponseField name="subject" type="string" required>
      Email subject line
    </ResponseField>

    <ResponseField name="text" type="string">
      Plain text email body
    </ResponseField>

    <ResponseField name="html" type="string">
      HTML email body
    </ResponseField>

    <ResponseField name="cc" type="string">
      CC recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="bcc" type="string">
      BCC recipient email addresses (comma-separated)
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Id"
        },
        "subject": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Subject"
        },
        "to": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "To"
        }
      },
      "required": [
        "success"
      ],
      "title": "SendMessageOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="reply_message — Reply to an existing email message in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to reply from
    </ResponseField>

    <ResponseField name="message_id" type="string" required>
      ID of the message to reply to
    </ResponseField>

    <ResponseField name="text" type="string">
      Plain text reply body
    </ResponseField>

    <ResponseField name="html" type="string">
      HTML reply body
    </ResponseField>

    <ResponseField name="to" type="string">
      Override recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="cc" type="string">
      CC email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="bcc" type="string">
      BCC email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="reply_all" type="boolean">
      Reply to all recipients of the original message (Default: `false`)
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Id"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        }
      },
      "required": [
        "success"
      ],
      "title": "ReplyMessageOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="forward_message — Forward an email message to new recipients in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the message
    </ResponseField>

    <ResponseField name="message_id" type="string" required>
      ID of the message to forward
    </ResponseField>

    <ResponseField name="to" type="string" required>
      Recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="subject" type="string">
      Override subject line
    </ResponseField>

    <ResponseField name="text" type="string">
      Additional plain text to prepend
    </ResponseField>

    <ResponseField name="html" type="string">
      Additional HTML to prepend
    </ResponseField>

    <ResponseField name="cc" type="string">
      CC recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="bcc" type="string">
      BCC recipient email addresses (comma-separated)
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Id"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        }
      },
      "required": [
        "success"
      ],
      "title": "ForwardMessageOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="list_messages — List messages in an inbox in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to list messages from
    </ResponseField>

    <ResponseField name="limit" type="integer">
      Maximum number of results to return
    </ResponseField>

    <ResponseField name="page_token" type="string">
      Pagination token for the next page of results
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "MessageSummary": {
          "additionalProperties": false,
          "description": "A single message row in ``list_messages``.",
          "properties": {
            "message_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Message Id"
            },
            "from_": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "From"
            },
            "to": {
              "items": {
                "type": "string"
              },
              "title": "To",
              "type": "array"
            },
            "subject": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Subject"
            },
            "preview": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Preview"
            },
            "timestamp": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Timestamp"
            },
            "created_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Created At"
            }
          },
          "title": "MessageSummary",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "messages": {
          "items": {
            "$ref": "#/$defs/MessageSummary"
          },
          "title": "Messages",
          "type": "array"
        },
        "count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Count"
        },
        "next_page_token": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Next Page Token"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListMessagesOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="get_message — Get details of a specific email message in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the message
    </ResponseField>

    <ResponseField name="message_id" type="string" required>
      ID of the message to retrieve
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Id"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        },
        "from_": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "From"
        },
        "to": {
          "items": {
            "type": "string"
          },
          "title": "To",
          "type": "array"
        },
        "cc": {
          "items": {
            "type": "string"
          },
          "title": "Cc",
          "type": "array"
        },
        "bcc": {
          "items": {
            "type": "string"
          },
          "title": "Bcc",
          "type": "array"
        },
        "subject": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Subject"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Text"
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Html"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        },
        "timestamp": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Timestamp"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        }
      },
      "required": [
        "success"
      ],
      "title": "GetMessageOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="update_message — Add or remove labels on an email message in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the message
    </ResponseField>

    <ResponseField name="message_id" type="string" required>
      ID of the message to update
    </ResponseField>

    <ResponseField name="add_labels" type="string">
      Comma-separated labels to add to the message
    </ResponseField>

    <ResponseField name="remove_labels" type="string">
      Comma-separated labels to remove from the message
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Id"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "UpdateMessageOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="list_threads — List email threads in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to list threads from
    </ResponseField>

    <ResponseField name="limit" type="integer">
      Maximum number of results to return
    </ResponseField>

    <ResponseField name="page_token" type="string">
      Pagination token for the next page of results
    </ResponseField>

    <ResponseField name="labels" type="string">
      Comma-separated labels to filter threads by
    </ResponseField>

    <ResponseField name="before" type="string">
      Filter threads before this ISO 8601 timestamp
    </ResponseField>

    <ResponseField name="after" type="string">
      Filter threads after this ISO 8601 timestamp
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "ThreadSummary": {
          "additionalProperties": false,
          "description": "A single thread row in ``list_threads``.",
          "properties": {
            "thread_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Thread Id"
            },
            "subject": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Subject"
            },
            "senders": {
              "items": {
                "type": "string"
              },
              "title": "Senders",
              "type": "array"
            },
            "recipients": {
              "items": {
                "type": "string"
              },
              "title": "Recipients",
              "type": "array"
            },
            "message_count": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Message Count"
            },
            "last_message_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Last Message At"
            },
            "created_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Created At"
            },
            "updated_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Updated At"
            }
          },
          "title": "ThreadSummary",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "threads": {
          "items": {
            "$ref": "#/$defs/ThreadSummary"
          },
          "title": "Threads",
          "type": "array"
        },
        "count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Count"
        },
        "next_page_token": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Next Page Token"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListThreadsOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="get_thread — Get details of a specific email thread including messages in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the thread
    </ResponseField>

    <ResponseField name="thread_id" type="string" required>
      ID of the thread to retrieve
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "ThreadMessage": {
          "additionalProperties": false,
          "description": "A single message inside ``get_thread``.",
          "properties": {
            "message_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Message Id"
            },
            "from_": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "From"
            },
            "to": {
              "items": {
                "type": "string"
              },
              "title": "To",
              "type": "array"
            },
            "cc": {
              "items": {
                "type": "string"
              },
              "title": "Cc",
              "type": "array"
            },
            "bcc": {
              "items": {
                "type": "string"
              },
              "title": "Bcc",
              "type": "array"
            },
            "subject": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Subject"
            },
            "text": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Text"
            },
            "html": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Html"
            },
            "labels": {
              "items": {
                "type": "string"
              },
              "title": "Labels",
              "type": "array"
            },
            "timestamp": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Timestamp"
            },
            "created_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Created At"
            }
          },
          "title": "ThreadMessage",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        },
        "subject": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Subject"
        },
        "senders": {
          "items": {
            "type": "string"
          },
          "title": "Senders",
          "type": "array"
        },
        "recipients": {
          "items": {
            "type": "string"
          },
          "title": "Recipients",
          "type": "array"
        },
        "message_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Count"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        },
        "last_message_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Last Message At"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        },
        "messages": {
          "items": {
            "$ref": "#/$defs/ThreadMessage"
          },
          "title": "Messages",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "GetThreadOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="update_thread — Add or remove labels on an email thread in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the thread
    </ResponseField>

    <ResponseField name="thread_id" type="string" required>
      ID of the thread to update
    </ResponseField>

    <ResponseField name="add_labels" type="string">
      Comma-separated labels to add to the thread
    </ResponseField>

    <ResponseField name="remove_labels" type="string">
      Comma-separated labels to remove from the thread
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "UpdateThreadOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="delete_thread — Delete an email thread in AgentMail (moves to trash, or permanently deletes if already in trash).">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the thread
    </ResponseField>

    <ResponseField name="thread_id" type="string" required>
      ID of the thread to delete
    </ResponseField>

    <ResponseField name="permanent" type="boolean">
      Force permanent deletion instead of moving to trash (Default: `false`)
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "deleted": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deleted"
        }
      },
      "required": [
        "success"
      ],
      "title": "DeleteThreadOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="create_draft — Create a new email draft in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to create the draft in
    </ResponseField>

    <ResponseField name="to" type="string">
      Recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="subject" type="string">
      Draft subject line
    </ResponseField>

    <ResponseField name="text" type="string">
      Plain text draft body
    </ResponseField>

    <ResponseField name="html" type="string">
      HTML draft body
    </ResponseField>

    <ResponseField name="cc" type="string">
      CC recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="bcc" type="string">
      BCC recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="in_reply_to" type="string">
      ID of message being replied to
    </ResponseField>

    <ResponseField name="send_at" type="string">
      ISO 8601 timestamp to schedule sending
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "draft_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Draft Id"
        },
        "inbox_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Inbox Id"
        },
        "subject": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Subject"
        },
        "to": {
          "items": {
            "type": "string"
          },
          "title": "To",
          "type": "array"
        },
        "cc": {
          "items": {
            "type": "string"
          },
          "title": "Cc",
          "type": "array"
        },
        "bcc": {
          "items": {
            "type": "string"
          },
          "title": "Bcc",
          "type": "array"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Text"
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Html"
        },
        "preview": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Preview"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        },
        "in_reply_to": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "In Reply To"
        },
        "send_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Send Status"
        },
        "send_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Send At"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        }
      },
      "required": [
        "success"
      ],
      "title": "CreateDraftOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="list_drafts — List email drafts in an inbox in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to list drafts from
    </ResponseField>

    <ResponseField name="limit" type="integer">
      Maximum number of results to return
    </ResponseField>

    <ResponseField name="page_token" type="string">
      Pagination token for the next page of results
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "DraftSummary": {
          "additionalProperties": false,
          "description": "A single draft row in ``list_drafts``.",
          "properties": {
            "draft_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Draft Id"
            },
            "inbox_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Inbox Id"
            },
            "subject": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Subject"
            },
            "to": {
              "items": {
                "type": "string"
              },
              "title": "To",
              "type": "array"
            },
            "cc": {
              "items": {
                "type": "string"
              },
              "title": "Cc",
              "type": "array"
            },
            "bcc": {
              "items": {
                "type": "string"
              },
              "title": "Bcc",
              "type": "array"
            },
            "preview": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Preview"
            },
            "send_status": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Send Status"
            },
            "send_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Send At"
            },
            "created_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Created At"
            },
            "updated_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Updated At"
            }
          },
          "title": "DraftSummary",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "drafts": {
          "items": {
            "$ref": "#/$defs/DraftSummary"
          },
          "title": "Drafts",
          "type": "array"
        },
        "count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Count"
        },
        "next_page_token": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Next Page Token"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListDraftsOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="get_draft — Get details of a specific email draft in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox the draft belongs to
    </ResponseField>

    <ResponseField name="draft_id" type="string" required>
      ID of the draft to retrieve
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "draft_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Draft Id"
        },
        "inbox_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Inbox Id"
        },
        "subject": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Subject"
        },
        "to": {
          "items": {
            "type": "string"
          },
          "title": "To",
          "type": "array"
        },
        "cc": {
          "items": {
            "type": "string"
          },
          "title": "Cc",
          "type": "array"
        },
        "bcc": {
          "items": {
            "type": "string"
          },
          "title": "Bcc",
          "type": "array"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Text"
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Html"
        },
        "preview": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Preview"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        },
        "in_reply_to": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "In Reply To"
        },
        "send_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Send Status"
        },
        "send_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Send At"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        }
      },
      "required": [
        "success"
      ],
      "title": "GetDraftOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="update_draft — Update an existing email draft in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the draft
    </ResponseField>

    <ResponseField name="draft_id" type="string" required>
      ID of the draft to update
    </ResponseField>

    <ResponseField name="to" type="string">
      Recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="subject" type="string">
      Draft subject line
    </ResponseField>

    <ResponseField name="text" type="string">
      Plain text draft body
    </ResponseField>

    <ResponseField name="html" type="string">
      HTML draft body
    </ResponseField>

    <ResponseField name="cc" type="string">
      CC recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="bcc" type="string">
      BCC recipient email addresses (comma-separated)
    </ResponseField>

    <ResponseField name="send_at" type="string">
      ISO 8601 timestamp to schedule sending
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "draft_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Draft Id"
        },
        "inbox_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Inbox Id"
        },
        "subject": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Subject"
        },
        "to": {
          "items": {
            "type": "string"
          },
          "title": "To",
          "type": "array"
        },
        "cc": {
          "items": {
            "type": "string"
          },
          "title": "Cc",
          "type": "array"
        },
        "bcc": {
          "items": {
            "type": "string"
          },
          "title": "Bcc",
          "type": "array"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Text"
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Html"
        },
        "preview": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Preview"
        },
        "labels": {
          "items": {
            "type": "string"
          },
          "title": "Labels",
          "type": "array"
        },
        "in_reply_to": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "In Reply To"
        },
        "send_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Send Status"
        },
        "send_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Send At"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        }
      },
      "required": [
        "success"
      ],
      "title": "UpdateDraftOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="delete_draft — Delete an email draft in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the draft
    </ResponseField>

    <ResponseField name="draft_id" type="string" required>
      ID of the draft to delete
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "deleted": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deleted"
        }
      },
      "required": [
        "success"
      ],
      "title": "DeleteDraftOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="send_draft — Send an existing email draft in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox containing the draft
    </ResponseField>

    <ResponseField name="draft_id" type="string" required>
      ID of the draft to send
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message Id"
        },
        "thread_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Thread Id"
        }
      },
      "required": [
        "success"
      ],
      "title": "SendDraftOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="create_inbox — Create a new email inbox with AgentMail.">
    ### Parameters

    <ResponseField name="username" type="string">
      Username for the inbox email address
    </ResponseField>

    <ResponseField name="domain" type="string">
      Domain for the inbox email address
    </ResponseField>

    <ResponseField name="display_name" type="string">
      Display name for the inbox
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "inbox_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Inbox Id"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Email"
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Display Name"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        }
      },
      "required": [
        "success"
      ],
      "title": "CreateInboxOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="list_inboxes — List all email inboxes in AgentMail.">
    ### Parameters

    <ResponseField name="limit" type="integer">
      Maximum number of results to return
    </ResponseField>

    <ResponseField name="page_token" type="string">
      Pagination token for the next page of results
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "InboxSummary": {
          "additionalProperties": false,
          "description": "A single inbox row in ``list_inboxes``.",
          "properties": {
            "inbox_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Inbox Id"
            },
            "email": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Email"
            },
            "display_name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Display Name"
            },
            "created_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Created At"
            },
            "updated_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Updated At"
            }
          },
          "title": "InboxSummary",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "inboxes": {
          "items": {
            "$ref": "#/$defs/InboxSummary"
          },
          "title": "Inboxes",
          "type": "array"
        },
        "count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Count"
        },
        "next_page_token": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Next Page Token"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListInboxesOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="get_inbox — Get details of a specific email inbox in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to retrieve
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "inbox_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Inbox Id"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Email"
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Display Name"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        }
      },
      "required": [
        "success"
      ],
      "title": "GetInboxOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="update_inbox — Update the display name of an email inbox in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to update
    </ResponseField>

    <ResponseField name="display_name" type="string" required>
      New display name for the inbox
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "inbox_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Inbox Id"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Email"
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Display Name"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Updated At"
        }
      },
      "required": [
        "success"
      ],
      "title": "UpdateInboxOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="delete_inbox — Delete an email inbox in AgentMail.">
    ### Parameters

    <ResponseField name="inbox_id" type="string" required>
      ID of the inbox to delete
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "deleted": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deleted"
        }
      },
      "required": [
        "success"
      ],
      "title": "DeleteInboxOutput",
      "type": "object"
    }
    ```
  </Accordion>
</AccordionGroup>

## Limits & Quotas

* All calls go to `https://api.agentmail.to/v0` over HTTPS with a 30s
  client timeout.
* List endpoints are paginated: pass `limit` and the returned
  `next_page_token` (via `page_token`) to page through results.
* **Error model**: non-2xx responses and timeouts are caught and
  returned as `success=False` + `error` rather than raising. Plan for
  retries on the agent side based on the error string.

## Related integrations

<CardGroup cols={3}>
  <Card title="Gmail" href="/integrations/tools/gmail" />

  <Card title="Klaviyo" href="/integrations/tools/klaviyo" />

  <Card title="Mailgun" href="/integrations/tools/mailgun" />
</CardGroup>

## Links

* [AgentMail](https://agentmail.to)
