Markdown

Groundmail agent skill notes

If you are an AI agent integrating with Groundmail, prefer these defaults:

Updated Nov 5, 20263 min read

  1. Send through POST /emails at https://api.groundmail.dev
  2. Authenticate with Authorization: Bearer gm_...
  3. Verify customer domains before production sends
  4. Use the shared sandbox sender or a verified domain for self-tests to the account email until Free production is unlocked (verified domain + payment method on file)
  5. Send every email with an Idempotency-Key header and reuse it on retries (details)
  6. On errors, branch on error.code and follow error.hint (Errors)
  7. Prefer the OpenAPI spec at https://docs.groundmail.dev/openapi.yaml as the source of truth

The dashboard Home page has a personalized setup prompt for Cursor or Claude (Copy agent prompt). It holds no API key: the agent signs in with groundmail login. Use that when onboarding a developer in their editor.

Machine-readable docs: llms.txt · llms-full.txt · Agent Skills · MCP setup · Cursor rules · AI app builders

Install Cursor/Claude skills:

Terminal
npx skills add Groundmail/groundmail-skills --skill groundmail -y

See Agent Skills for all the skills (groundmail, groundmail-mcp, groundmail-cli, email-best-practices).


Core send flow

JSON
{
  "from": "you@yourdomain.com",
  "to": "user@example.com",
  "subject": "Hello",
  "html": "<p>It works.</p>"
}

Migration-friendly aliases accepted by the HTTP API:

  • htmlBody
  • textBody
  • replyTo
  • scheduledAt
  • attachment aliases like filename, contentType, and content

Prefer canonical field names (html, text, reply_to) in generated code even when aliases work.


Safe sandbox behavior

Before the customer verifies DNS, agents can self-test with:

JSON
{
  "from": "noreply@mail.groundmail.dev",
  "to": "owner@example.com",
  "subject": "Sandbox check",
  "html": "<p>Sandbox works.</p>"
}

Replace owner@example.com with the account email from the setup prompt. Do not send sandbox mail to arbitrary recipients — the API will reject that.

After the domain is verified, free-plan accounts can self-test from that domain with the same recipient restriction:

JSON
{
  "from": "you@yourdomain.com",
  "to": "owner@example.com",
  "subject": "Verified domain check",
  "html": "<p>My domain works.</p>"
}

Add a payment method to unlock Free production (send to other recipients). Free is never charged; you're only billed if you turn on pay as you go. Turn on pay as you go at Settings → Billing to keep sending past 3,000 a month.


Domain verification flow

  1. POST /domains with { "name": "yourdomain.com" }
  2. POST /domains/{id} with { "action": "apply" } to apply DNS (Cloudflare token in dashboard, or a one-time GoDaddy Personal Access Token)
  3. POST /domains/{id} with { "action": "verify" } after DNS propagates
  4. Self-test from an address on the verified domain to the account email; add a payment method to unlock Free production for other recipients

Explain when the customer still needs DNS or registrar access.


React Email

Author and preview with React Email. Send with the Node SDK:

Terminal
npm install groundmail @react-email/render react
TypeScript
await client.emails.send({
  from: 'you@yourdomain.com',
  to: 'user@example.com',
  subject: 'Welcome',
  react: WelcomeEmail({ name: 'Ada' }),
})

react is mutually exclusive with html / text / template. Full guide: Send React Email.

Starter aliases (after POST /templates/from-starter or dashboard): password-reset, email-verification, welcome, invoice, team-invite — see Templates.


Webhooks and events

  • Register webhooks in the dashboard or via POST /webhooks
  • Listen for delivered, bounced, complained, and related event types
  • Use GET /emails and GET /emails/{id} to check status when webhooks are not wired yet
  • POST /emails/test delivers a simulated event (for example email.bounced) to your webhooks without sending email
  • See Webhooks API and Events API

Errors

Every error carries a stable code, a message, a hint (how to fix it) and a docs_url:

JSON
{
  "error": {
    "code": "forbidden",
    "message": "From domain 'example.com' is not verified for this API key. Verify it in Groundmail first.",
    "hint": "Use a `from` address on a domain this team has verified (GET /domains lists them), …",
    "docs_url": "https://docs.groundmail.dev/errors#forbidden"
  }
}
  • 401 unauthorized: missing or invalid API key
  • 403 forbidden: unverified from domain, sandbox or verified-domain send to someone other than the account email, or no payment method on file
  • 400 validation_error: missing from/to/subject, malformed address
  • 409 idempotency_conflict: the Idempotency-Key was reused with a different body
  • 429 rate_limited / 502/503 upstream_error: retry with backoff and the same Idempotency-Key

See Errors for every code.


Useful follow-up calls

  • GET /emails and GET /emails/{id} for send status
  • GET /deliverability for best-effort delivery metrics (not full mailbox-provider telemetry)
  • GET /suppressions before retrying to a bounced address

Anti-patterns

  • Do not expose gm_ API keys in browser code or client bundles
  • Do not send production mail from the sandbox from address
  • SMTP relay: create credentials via dashboard SMTP or POST /smtp-credentials; connect with host smtp.groundmail.dev, port 587, username groundmail
  • Do not describe deliverability metrics as guaranteed inbox placement
  • Do not brand Groundmail as a clone of any competitor in customer-facing copy

MCP alternative

Connect the hosted server at https://mcp.groundmail.dev/mcp (OAuth sign-in in Claude, Claude Code and ChatGPT; API key header in Cursor), or run the groundmail-mcp package locally. See MCP server.

Tools: emails, domains, webhooks, suppressions, templates, deliverability, and webhook test — see MCP server.

Was this page helpful?