Want a free personalized recommendation for your software stack?Get yours
That Marketing Buddy
Home/API/Mailgun
Mailgun

Mailgun API

Yes. Mailgun publishes a public REST API. See mailgun.com/glossary/api for pricing details.

MCP also available
Public REST API documentedAgent-readiness 7/10
Data from Buddy's database, auto-rechecked weekly

What is the Mailgun API?

The Mailgun API is a public REST interface to campaigns, contacts, segments, and automation workflows. Auth method is documented on the official API reference. No official SDK was detected, so most teams hit it directly with HTTP clients.

Typical builds: scripts that sync subscribers from your product database, engagement dashboards that combine open rate with revenue attribution, and cron jobs that pause underperforming campaigns automatically.

For agent workflows specifically, the official MCP server is usually less code than the REST API. The API still wins for scheduled jobs, dashboards, and anything outside an LLM-driven flow.

For the broader picture: Mailgun review, full pricing breakdown, .

HOOK IT TO YOUR STACK

Real Mailgun API calls you'll write

mailgun-apirest
#List campaigns from the last 30 days
GET/v3/campaigns?since=30d&fields=name,open_rate,clicks
200 OK · 12 campaigns
Black Friday Teaseropen 42.1%
Product launchopen 38.5%
Weekly digest #12open 27.0%
Welcome flow step 2open 61.3%
mailgun-apirest
#Create a new automation programmatically
POST/v3/automations
201 Created · automation_id: aut_8x
Statusdraft
Steps configured0
Estimated audience2,847
Push steps via PUT /automations/{id}/steps.
mailgun-apirest
#Add a contact and tag them in one call
POST/v3/contacts
201 Created · contact_id: c_4f12
Lifecycle stagesubscriber
Tags applied1
Triggers firedwelcome-series
TMB SCORE FOR MailgunAgent fit: 7/10
Read review →

Endpoints illustrative. Confirm exact paths against the live API docs before integrating.

How much does the Mailgun API actually cost?

Verify on docs

Mailgun publishes an API, but per-tier gating wasn't extracted automatically.

  • Most likely scenario: API access is either included in all paid plans, or it's gated to higher tiers and we need to verify on the live docs page.
  • Until verified, treat the question "which plan unlocks the API" as open. Don't budget on the assumption it's free with the cheapest paid plan.

API at a glance

Auth method
SDK languages
OpenAPI spec
Webhooks
Structured outputs

Mailgun also has an MCP server

If you're wiring Mailgun into Claude / Cursor / Codex, the MCP server is usually less code than the REST API.

See Mailgun MCP page

What you can build with the Mailgun API

Three personas, three different shapes of build. Pick the row that matches how you actually ship.

SOLO DEV / FOUNDER

Glue Mailgun into your daily workflow

  • Pull a digest of campaign performance into your morning Slack
  • Trigger a one-off backfill when something looks off
  • Pipe data into your own SQLite for ad-hoc queries
Effort: A weekend, one Node or Python script
AGENCY / CONSULTANT

Sell Mailgun reporting at scale

  • White-label Mailgun data into client-branded dashboards
  • Run scheduled multi-account reports without logging into the Mailgun UI
  • Cross-reference with the rest of the client's stack (CRM, analytics, ad spend)
Effort: 1-2 weeks, hits multi-tenant auth quickly
IN-HOUSE ENGINEER

Production pipelines for Mailgun

  • Real-time sync into your warehouse on a cron
  • Custom alerts the dashboard's built-in alerting can't express
  • Backfill + idempotency handling for Mailgun data older than the dashboard exposes
Effort: Multi-week project, expect rate-limit tuning

Quickstart template

# Starter template — endpoint paths and SDK package names come from
# the Mailgun API docs: https://www.mailgun.com/glossary/api/

curl -X GET "https://www.mailgun.com/<your-endpoint>" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" | jq .

Template only. Endpoint paths, exact base URL, and auth header format come from mailgun.com/glossary/api.

Limits and gotchas

  • No OpenAPI spec — you write typed clients by hand or use a third-party generator on the docs HTML.
  • No official SDK detected. Plan on hitting the API directly with your HTTP client of choice.
  • Rate limits: always read the docs page before scaling — the published limit is usually lower than the practical one and overages can be expensive.
7/10

Agent-readiness verdict

Moderate agent fit with official MCP support. Mailgun has a live official MCP server and documented public API, which enables Claude workflows, but lacks OpenAPI specs and SDKs across multiple languages. The missing structured outputs and webhook support limit automation depth compared to modern agent-native platforms.

MCP server availableOfficial MCP (on tool's own domain)Public API with docs

Mailgun API FAQ

Does Mailgun have a public API?+
Yes — REST API at mailgun.com/glossary/api.
Should I use the API or the MCP server for Claude / Cursor / Codex?+
Prefer the MCP server for agent workflows — it's less code and pre-handles auth flows. Use the REST API for scheduled jobs, dashboards, and anything outside an LLM-driven flow.

Sources

Joonas Rotko
Joonas RotkoAuthor & Founder of That Marketing Buddy

10+ years in digital marketing. I review marketing software for AI-stack fit: real pricing, MCP and API support, and how cleanly each tool drops into an AI agent workflow, cross-checked against verified data and real user feedback.

Mailgun

Try Mailgun
WEEKLY NEWSLETTER

The marketing tools worth your money, scored for AI agent readiness

Every week I score the tools for MCP, API, and agent-readiness, then email you the ones that actually deliver, what plugs into Claude and Cursor, the pricing changes, and what to skip. No fluff, no daily spam.

Join for free. One email a week, unsubscribe anytime.