{
  "schemaVersion": "1.0",
  "item": {
    "slug": "mailgun-api",
    "name": "Mailgun",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/byungkyu/mailgun-api",
    "canonicalUrl": "https://clawhub.ai/byungkyu/mailgun-api",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/mailgun-api",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=mailgun-api",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "LICENSE.txt"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/mailgun-api"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/mailgun-api",
    "agentPageUrl": "https://openagent3.xyz/skills/mailgun-api/agent",
    "manifestUrl": "https://openagent3.xyz/skills/mailgun-api/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/mailgun-api/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Mailgun",
        "body": "Access the Mailgun API with managed OAuth authentication. Send transactional emails, manage domains, routes, templates, mailing lists, suppressions, and webhooks."
      },
      {
        "title": "Quick Start",
        "body": "# List domains\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/mailgun/v3/domains')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Base URL",
        "body": "https://gateway.maton.ai/mailgun/v3/{resource}\n\nReplace {resource} with the actual Mailgun API endpoint path. The gateway proxies requests to api.mailgun.net/v3 (US region) and automatically injects your OAuth token.\n\nRegional Note: Mailgun has US and EU regions. The gateway defaults to US region (api.mailgun.net)."
      },
      {
        "title": "Authentication",
        "body": "All requests require the Maton API key in the Authorization header:\n\nAuthorization: Bearer $MATON_API_KEY\n\nEnvironment Variable: Set your API key as MATON_API_KEY:\n\nexport MATON_API_KEY=\"YOUR_API_KEY\""
      },
      {
        "title": "Getting Your API Key",
        "body": "Sign in or create an account at maton.ai\nGo to maton.ai/settings\nCopy your API key"
      },
      {
        "title": "Connection Management",
        "body": "Manage your Mailgun OAuth connections at https://ctrl.maton.ai."
      },
      {
        "title": "List Connections",
        "body": "python <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections?app=mailgun&status=ACTIVE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Create Connection",
        "body": "python <<'EOF'\nimport urllib.request, os, json\ndata = json.dumps({'app': 'mailgun'}).encode()\nreq = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Content-Type', 'application/json')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Get Connection",
        "body": "python <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nResponse:\n\n{\n  \"connection\": {\n    \"connection_id\": \"78b5a036-c621-40c2-b74b-276195735af2\",\n    \"status\": \"ACTIVE\",\n    \"creation_time\": \"2026-02-12T02:24:16.551210Z\",\n    \"last_updated_time\": \"2026-02-12T02:25:03.542838Z\",\n    \"url\": \"https://connect.maton.ai/?session_token=...\",\n    \"app\": \"mailgun\",\n    \"metadata\": {}\n  }\n}\n\nOpen the returned url in a browser to complete OAuth authorization."
      },
      {
        "title": "Delete Connection",
        "body": "python <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Specifying Connection",
        "body": "If you have multiple Mailgun connections, specify which one to use with the Maton-Connection header:\n\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/mailgun/v3/domains')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Maton-Connection', '78b5a036-c621-40c2-b74b-276195735af2')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nIf omitted, the gateway uses the default (oldest) active connection."
      },
      {
        "title": "API Reference",
        "body": "Important: Mailgun API uses application/x-www-form-urlencoded for POST/PUT requests, not JSON."
      },
      {
        "title": "Domains",
        "body": "List Domains\n\nGET /mailgun/v3/domains\n\nReturns all domains for the account.\n\nGet Domain\n\nGET /mailgun/v3/domains/{domain_name}\n\nCreate Domain\n\nPOST /mailgun/v3/domains\nContent-Type: application/x-www-form-urlencoded\n\nname=example.com&smtp_password=supersecret\n\nDelete Domain\n\nDELETE /mailgun/v3/domains/{domain_name}"
      },
      {
        "title": "Messages",
        "body": "Send Message\n\nPOST /mailgun/v3/{domain_name}/messages\nContent-Type: application/x-www-form-urlencoded\n\nfrom=sender@example.com&to=recipient@example.com&subject=Hello&text=Hello World\n\nParameters:\n\nfrom (required) - Sender email address\nto (required) - Recipient(s), comma-separated\ncc - CC recipients\nbcc - BCC recipients\nsubject (required) - Email subject\ntext - Plain text body\nhtml - HTML body\ntemplate - Name of stored template to use\no:tag - Tag for tracking\no:tracking - Enable/disable tracking (yes/no)\no:tracking-clicks - Enable click tracking\no:tracking-opens - Enable open tracking\nh:X-Custom-Header - Custom headers (prefix with h:)\nv:custom-var - Custom variables for templates (prefix with v:)\n\nSend MIME Message\n\nPOST /mailgun/v3/{domain_name}/messages.mime\nContent-Type: multipart/form-data\n\nto=recipient@example.com&message=<MIME content>"
      },
      {
        "title": "Events",
        "body": "List Events\n\nGET /mailgun/v3/{domain_name}/events\n\nQuery parameters:\n\nbegin - Start time (RFC 2822 or Unix timestamp)\nend - End time\nascending - Sort order (yes/no)\nlimit - Results per page (max 300)\nevent - Filter by event type (accepted, delivered, failed, opened, clicked, unsubscribed, complained, stored)\nfrom - Filter by sender\nto - Filter by recipient\ntags - Filter by tags"
      },
      {
        "title": "Routes",
        "body": "Routes are defined globally per account, not per domain.\n\nList Routes\n\nGET /mailgun/v3/routes\n\nQuery parameters:\n\nskip - Number of records to skip\nlimit - Number of records to return\n\nCreate Route\n\nPOST /mailgun/v3/routes\nContent-Type: application/x-www-form-urlencoded\n\npriority=0&description=My Route&expression=match_recipient(\".*@example.com\")&action=forward(\"https://example.com/webhook\")\n\nParameters:\n\npriority - Route priority (lower = higher priority)\ndescription - Route description\nexpression - Filter expression (match_recipient, match_header, catch_all)\naction - Action(s) to take (forward, store, stop)\n\nGet Route\n\nGET /mailgun/v3/routes/{route_id}\n\nUpdate Route\n\nPUT /mailgun/v3/routes/{route_id}\nContent-Type: application/x-www-form-urlencoded\n\npriority=1&description=Updated Route\n\nDelete Route\n\nDELETE /mailgun/v3/routes/{route_id}"
      },
      {
        "title": "Webhooks",
        "body": "List Webhooks\n\nGET /mailgun/v3/domains/{domain_name}/webhooks\n\nCreate Webhook\n\nPOST /mailgun/v3/domains/{domain_name}/webhooks\nContent-Type: application/x-www-form-urlencoded\n\nid=delivered&url=https://example.com/webhook\n\nWebhook types: accepted, delivered, opened, clicked, unsubscribed, complained, permanent_fail, temporary_fail\n\nGet Webhook\n\nGET /mailgun/v3/domains/{domain_name}/webhooks/{webhook_type}\n\nUpdate Webhook\n\nPUT /mailgun/v3/domains/{domain_name}/webhooks/{webhook_type}\nContent-Type: application/x-www-form-urlencoded\n\nurl=https://example.com/new-webhook\n\nDelete Webhook\n\nDELETE /mailgun/v3/domains/{domain_name}/webhooks/{webhook_type}"
      },
      {
        "title": "Templates",
        "body": "List Templates\n\nGET /mailgun/v3/{domain_name}/templates\n\nCreate Template\n\nPOST /mailgun/v3/{domain_name}/templates\nContent-Type: application/x-www-form-urlencoded\n\nname=my-template&description=Welcome email&template=<html><body>Hello {{name}}</body></html>\n\nGet Template\n\nGET /mailgun/v3/{domain_name}/templates/{template_name}\n\nDelete Template\n\nDELETE /mailgun/v3/{domain_name}/templates/{template_name}"
      },
      {
        "title": "Mailing Lists",
        "body": "List Mailing Lists\n\nGET /mailgun/v3/lists/pages\n\nCreate Mailing List\n\nPOST /mailgun/v3/lists\nContent-Type: application/x-www-form-urlencoded\n\naddress=newsletter@example.com&name=Newsletter&description=Monthly newsletter&access_level=readonly\n\nAccess levels: readonly, members, everyone\n\nGet Mailing List\n\nGET /mailgun/v3/lists/{list_address}\n\nUpdate Mailing List\n\nPUT /mailgun/v3/lists/{list_address}\nContent-Type: application/x-www-form-urlencoded\n\nname=Updated Newsletter\n\nDelete Mailing List\n\nDELETE /mailgun/v3/lists/{list_address}"
      },
      {
        "title": "Mailing List Members",
        "body": "List Members\n\nGET /mailgun/v3/lists/{list_address}/members/pages\n\nAdd Member\n\nPOST /mailgun/v3/lists/{list_address}/members\nContent-Type: application/x-www-form-urlencoded\n\naddress=member@example.com&name=John Doe&subscribed=yes\n\nGet Member\n\nGET /mailgun/v3/lists/{list_address}/members/{member_address}\n\nUpdate Member\n\nPUT /mailgun/v3/lists/{list_address}/members/{member_address}\nContent-Type: application/x-www-form-urlencoded\n\nname=Jane Doe&subscribed=no\n\nDelete Member\n\nDELETE /mailgun/v3/lists/{list_address}/members/{member_address}"
      },
      {
        "title": "Suppressions",
        "body": "Bounces\n\n# List bounces\nGET /mailgun/v3/{domain_name}/bounces\n\n# Add bounce\nPOST /mailgun/v3/{domain_name}/bounces\nContent-Type: application/x-www-form-urlencoded\n\naddress=bounced@example.com&code=550&error=Mailbox not found\n\n# Get bounce\nGET /mailgun/v3/{domain_name}/bounces/{address}\n\n# Delete bounce\nDELETE /mailgun/v3/{domain_name}/bounces/{address}\n\nUnsubscribes\n\n# List unsubscribes\nGET /mailgun/v3/{domain_name}/unsubscribes\n\n# Add unsubscribe\nPOST /mailgun/v3/{domain_name}/unsubscribes\nContent-Type: application/x-www-form-urlencoded\n\naddress=unsubscribed@example.com&tag=*\n\n# Delete unsubscribe\nDELETE /mailgun/v3/{domain_name}/unsubscribes/{address}\n\nComplaints\n\n# List complaints\nGET /mailgun/v3/{domain_name}/complaints\n\n# Add complaint\nPOST /mailgun/v3/{domain_name}/complaints\nContent-Type: application/x-www-form-urlencoded\n\naddress=complainer@example.com\n\n# Delete complaint\nDELETE /mailgun/v3/{domain_name}/complaints/{address}\n\nWhitelists\n\n# List whitelists\nGET /mailgun/v3/{domain_name}/whitelists\n\n# Add to whitelist\nPOST /mailgun/v3/{domain_name}/whitelists\nContent-Type: application/x-www-form-urlencoded\n\naddress=allowed@example.com\n\n# Delete from whitelist\nDELETE /mailgun/v3/{domain_name}/whitelists/{address}"
      },
      {
        "title": "Statistics",
        "body": "Get Stats\n\nGET /mailgun/v3/{domain_name}/stats/total?event=delivered&event=opened\n\nQuery parameters:\n\nevent (required) - Event type(s): accepted, delivered, failed, opened, clicked, unsubscribed, complained\nstart - Start date (RFC 2822 or Unix timestamp)\nend - End date\nresolution - Data resolution (hour, day, month)\nduration - Period to show stats for"
      },
      {
        "title": "Tags",
        "body": "List Tags\n\nGET /mailgun/v3/{domain_name}/tags\n\nGet Tag\n\nGET /mailgun/v3/{domain_name}/tags/{tag_name}\n\nDelete Tag\n\nDELETE /mailgun/v3/{domain_name}/tags/{tag_name}"
      },
      {
        "title": "IPs",
        "body": "List IPs\n\nGET /mailgun/v3/ips\n\nGet IP\n\nGET /mailgun/v3/ips/{ip_address}"
      },
      {
        "title": "Domain Tracking",
        "body": "Get Tracking Settings\n\nGET /mailgun/v3/domains/{domain_name}/tracking\n\nUpdate Open Tracking\n\nPUT /mailgun/v3/domains/{domain_name}/tracking/open\nContent-Type: application/x-www-form-urlencoded\n\nactive=yes\n\nUpdate Click Tracking\n\nPUT /mailgun/v3/domains/{domain_name}/tracking/click\nContent-Type: application/x-www-form-urlencoded\n\nactive=yes\n\nUpdate Unsubscribe Tracking\n\nPUT /mailgun/v3/domains/{domain_name}/tracking/unsubscribe\nContent-Type: application/x-www-form-urlencoded\n\nactive=yes&html_footer=<a href=\"%unsubscribe_url%\">Unsubscribe</a>"
      },
      {
        "title": "Credentials",
        "body": "List Credentials\n\nGET /mailgun/v3/domains/{domain_name}/credentials\n\nCreate Credential\n\nPOST /mailgun/v3/domains/{domain_name}/credentials\nContent-Type: application/x-www-form-urlencoded\n\nlogin=alice&password=supersecret\n\nDelete Credential\n\nDELETE /mailgun/v3/domains/{domain_name}/credentials/{login}"
      },
      {
        "title": "Pagination",
        "body": "Mailgun uses cursor-based pagination:\n\n{\n  \"items\": [...],\n  \"paging\": {\n    \"first\": \"https://api.mailgun.net/v3/.../pages?page=first&limit=100\",\n    \"last\": \"https://api.mailgun.net/v3/.../pages?page=last&limit=100\",\n    \"next\": \"https://api.mailgun.net/v3/.../pages?page=next&limit=100\",\n    \"previous\": \"https://api.mailgun.net/v3/.../pages?page=prev&limit=100\"\n  }\n}\n\nUse limit parameter to control page size (default: 100)."
      },
      {
        "title": "JavaScript - Send Email",
        "body": "const formData = new URLSearchParams();\nformData.append('from', 'sender@example.com');\nformData.append('to', 'recipient@example.com');\nformData.append('subject', 'Hello');\nformData.append('text', 'Hello World!');\n\nconst response = await fetch(\n  'https://gateway.maton.ai/mailgun/v3/example.com/messages',\n  {\n    method: 'POST',\n    headers: {\n      'Authorization': `Bearer ${process.env.MATON_API_KEY}`,\n      'Content-Type': 'application/x-www-form-urlencoded'\n    },\n    body: formData.toString()\n  }\n);\nconst result = await response.json();\nconsole.log(result);"
      },
      {
        "title": "Python - Send Email",
        "body": "import os\nimport requests\n\nresponse = requests.post(\n    'https://gateway.maton.ai/mailgun/v3/example.com/messages',\n    headers={'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'},\n    data={\n        'from': 'sender@example.com',\n        'to': 'recipient@example.com',\n        'subject': 'Hello',\n        'text': 'Hello World!'\n    }\n)\nprint(response.json())"
      },
      {
        "title": "Python - List Domains",
        "body": "import os\nimport requests\n\nresponse = requests.get(\n    'https://gateway.maton.ai/mailgun/v3/domains',\n    headers={'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\n)\ndomains = response.json()\nfor domain in domains['items']:\n    print(f\"{domain['name']}: {domain['state']}\")"
      },
      {
        "title": "Python - Create Route and Webhook",
        "body": "import os\nimport requests\n\nheaders = {'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\ndomain = 'example.com'\n\n# Create route\nroute_response = requests.post(\n    'https://gateway.maton.ai/mailgun/v3/routes',\n    headers=headers,\n    data={\n        'priority': 0,\n        'description': 'Forward to webhook',\n        'expression': 'match_recipient(\"support@example.com\")',\n        'action': 'forward(\"https://myapp.com/incoming-email\")'\n    }\n)\nprint(f\"Route created: {route_response.json()}\")\n\n# Create webhook\nwebhook_response = requests.post(\n    f'https://gateway.maton.ai/mailgun/v3/domains/{domain}/webhooks',\n    headers=headers,\n    data={\n        'id': 'delivered',\n        'url': 'https://myapp.com/webhook/delivered'\n    }\n)\nprint(f\"Webhook created: {webhook_response.json()}\")"
      },
      {
        "title": "Notes",
        "body": "Mailgun uses application/x-www-form-urlencoded for POST/PUT requests, not JSON\nDomain names must be included in most endpoint paths\nRoutes are global (per account), not per domain\nSandbox domains require authorized recipients for sending\nDates are returned in RFC 2822 format\nEvent logs are stored for at least 3 days\nStats require at least one event parameter\nTemplates use Handlebars syntax by default\nIMPORTANT: When using curl commands, use curl -g when URLs contain brackets to disable glob parsing\nIMPORTANT: When piping curl output to jq, environment variables may not expand correctly. Use Python examples instead."
      },
      {
        "title": "Rate Limits",
        "body": "OperationLimitSendingVaries by planAPI callsNo hard limit, but excessive requests may be throttled\n\nWhen rate limited, implement exponential backoff for retries."
      },
      {
        "title": "Error Handling",
        "body": "StatusMeaning400Bad request or missing Mailgun connection401Invalid or missing Maton API key403Forbidden (e.g., sandbox domain restrictions)404Resource not found429Rate limited4xx/5xxPassthrough error from Mailgun API"
      },
      {
        "title": "Troubleshooting: API Key Issues",
        "body": "Check that the MATON_API_KEY environment variable is set:\n\necho $MATON_API_KEY\n\nVerify the API key is valid by listing connections:\n\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Troubleshooting: Invalid App Name",
        "body": "Ensure your URL path starts with mailgun. For example:\n\nCorrect: https://gateway.maton.ai/mailgun/v3/domains\nIncorrect: https://gateway.maton.ai/v3/domains"
      },
      {
        "title": "Troubleshooting: Sandbox Domain Restrictions",
        "body": "Sandbox domains can only send to authorized recipients. To send emails:\n\nUpgrade to a paid plan, or\nAdd recipient addresses to authorized recipients in the Mailgun dashboard"
      },
      {
        "title": "Resources",
        "body": "Mailgun API Documentation\nMailgun API Reference\nMailgun Postman Collection\nMaton Community\nMaton Support"
      }
    ],
    "body": "Mailgun\n\nAccess the Mailgun API with managed OAuth authentication. Send transactional emails, manage domains, routes, templates, mailing lists, suppressions, and webhooks.\n\nQuick Start\n# List domains\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/mailgun/v3/domains')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nBase URL\nhttps://gateway.maton.ai/mailgun/v3/{resource}\n\n\nReplace {resource} with the actual Mailgun API endpoint path. The gateway proxies requests to api.mailgun.net/v3 (US region) and automatically injects your OAuth token.\n\nRegional Note: Mailgun has US and EU regions. The gateway defaults to US region (api.mailgun.net).\n\nAuthentication\n\nAll requests require the Maton API key in the Authorization header:\n\nAuthorization: Bearer $MATON_API_KEY\n\n\nEnvironment Variable: Set your API key as MATON_API_KEY:\n\nexport MATON_API_KEY=\"YOUR_API_KEY\"\n\nGetting Your API Key\nSign in or create an account at maton.ai\nGo to maton.ai/settings\nCopy your API key\nConnection Management\n\nManage your Mailgun OAuth connections at https://ctrl.maton.ai.\n\nList Connections\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections?app=mailgun&status=ACTIVE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nCreate Connection\npython <<'EOF'\nimport urllib.request, os, json\ndata = json.dumps({'app': 'mailgun'}).encode()\nreq = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Content-Type', 'application/json')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nGet Connection\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\n\nResponse:\n\n{\n  \"connection\": {\n    \"connection_id\": \"78b5a036-c621-40c2-b74b-276195735af2\",\n    \"status\": \"ACTIVE\",\n    \"creation_time\": \"2026-02-12T02:24:16.551210Z\",\n    \"last_updated_time\": \"2026-02-12T02:25:03.542838Z\",\n    \"url\": \"https://connect.maton.ai/?session_token=...\",\n    \"app\": \"mailgun\",\n    \"metadata\": {}\n  }\n}\n\n\nOpen the returned url in a browser to complete OAuth authorization.\n\nDelete Connection\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nSpecifying Connection\n\nIf you have multiple Mailgun connections, specify which one to use with the Maton-Connection header:\n\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/mailgun/v3/domains')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Maton-Connection', '78b5a036-c621-40c2-b74b-276195735af2')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\n\nIf omitted, the gateway uses the default (oldest) active connection.\n\nAPI Reference\n\nImportant: Mailgun API uses application/x-www-form-urlencoded for POST/PUT requests, not JSON.\n\nDomains\nList Domains\nGET /mailgun/v3/domains\n\n\nReturns all domains for the account.\n\nGet Domain\nGET /mailgun/v3/domains/{domain_name}\n\nCreate Domain\nPOST /mailgun/v3/domains\nContent-Type: application/x-www-form-urlencoded\n\nname=example.com&smtp_password=supersecret\n\nDelete Domain\nDELETE /mailgun/v3/domains/{domain_name}\n\nMessages\nSend Message\nPOST /mailgun/v3/{domain_name}/messages\nContent-Type: application/x-www-form-urlencoded\n\nfrom=sender@example.com&to=recipient@example.com&subject=Hello&text=Hello World\n\n\nParameters:\n\nfrom (required) - Sender email address\nto (required) - Recipient(s), comma-separated\ncc - CC recipients\nbcc - BCC recipients\nsubject (required) - Email subject\ntext - Plain text body\nhtml - HTML body\ntemplate - Name of stored template to use\no:tag - Tag for tracking\no:tracking - Enable/disable tracking (yes/no)\no:tracking-clicks - Enable click tracking\no:tracking-opens - Enable open tracking\nh:X-Custom-Header - Custom headers (prefix with h:)\nv:custom-var - Custom variables for templates (prefix with v:)\nSend MIME Message\nPOST /mailgun/v3/{domain_name}/messages.mime\nContent-Type: multipart/form-data\n\nto=recipient@example.com&message=<MIME content>\n\nEvents\nList Events\nGET /mailgun/v3/{domain_name}/events\n\n\nQuery parameters:\n\nbegin - Start time (RFC 2822 or Unix timestamp)\nend - End time\nascending - Sort order (yes/no)\nlimit - Results per page (max 300)\nevent - Filter by event type (accepted, delivered, failed, opened, clicked, unsubscribed, complained, stored)\nfrom - Filter by sender\nto - Filter by recipient\ntags - Filter by tags\nRoutes\n\nRoutes are defined globally per account, not per domain.\n\nList Routes\nGET /mailgun/v3/routes\n\n\nQuery parameters:\n\nskip - Number of records to skip\nlimit - Number of records to return\nCreate Route\nPOST /mailgun/v3/routes\nContent-Type: application/x-www-form-urlencoded\n\npriority=0&description=My Route&expression=match_recipient(\".*@example.com\")&action=forward(\"https://example.com/webhook\")\n\n\nParameters:\n\npriority - Route priority (lower = higher priority)\ndescription - Route description\nexpression - Filter expression (match_recipient, match_header, catch_all)\naction - Action(s) to take (forward, store, stop)\nGet Route\nGET /mailgun/v3/routes/{route_id}\n\nUpdate Route\nPUT /mailgun/v3/routes/{route_id}\nContent-Type: application/x-www-form-urlencoded\n\npriority=1&description=Updated Route\n\nDelete Route\nDELETE /mailgun/v3/routes/{route_id}\n\nWebhooks\nList Webhooks\nGET /mailgun/v3/domains/{domain_name}/webhooks\n\nCreate Webhook\nPOST /mailgun/v3/domains/{domain_name}/webhooks\nContent-Type: application/x-www-form-urlencoded\n\nid=delivered&url=https://example.com/webhook\n\n\nWebhook types: accepted, delivered, opened, clicked, unsubscribed, complained, permanent_fail, temporary_fail\n\nGet Webhook\nGET /mailgun/v3/domains/{domain_name}/webhooks/{webhook_type}\n\nUpdate Webhook\nPUT /mailgun/v3/domains/{domain_name}/webhooks/{webhook_type}\nContent-Type: application/x-www-form-urlencoded\n\nurl=https://example.com/new-webhook\n\nDelete Webhook\nDELETE /mailgun/v3/domains/{domain_name}/webhooks/{webhook_type}\n\nTemplates\nList Templates\nGET /mailgun/v3/{domain_name}/templates\n\nCreate Template\nPOST /mailgun/v3/{domain_name}/templates\nContent-Type: application/x-www-form-urlencoded\n\nname=my-template&description=Welcome email&template=<html><body>Hello {{name}}</body></html>\n\nGet Template\nGET /mailgun/v3/{domain_name}/templates/{template_name}\n\nDelete Template\nDELETE /mailgun/v3/{domain_name}/templates/{template_name}\n\nMailing Lists\nList Mailing Lists\nGET /mailgun/v3/lists/pages\n\nCreate Mailing List\nPOST /mailgun/v3/lists\nContent-Type: application/x-www-form-urlencoded\n\naddress=newsletter@example.com&name=Newsletter&description=Monthly newsletter&access_level=readonly\n\n\nAccess levels: readonly, members, everyone\n\nGet Mailing List\nGET /mailgun/v3/lists/{list_address}\n\nUpdate Mailing List\nPUT /mailgun/v3/lists/{list_address}\nContent-Type: application/x-www-form-urlencoded\n\nname=Updated Newsletter\n\nDelete Mailing List\nDELETE /mailgun/v3/lists/{list_address}\n\nMailing List Members\nList Members\nGET /mailgun/v3/lists/{list_address}/members/pages\n\nAdd Member\nPOST /mailgun/v3/lists/{list_address}/members\nContent-Type: application/x-www-form-urlencoded\n\naddress=member@example.com&name=John Doe&subscribed=yes\n\nGet Member\nGET /mailgun/v3/lists/{list_address}/members/{member_address}\n\nUpdate Member\nPUT /mailgun/v3/lists/{list_address}/members/{member_address}\nContent-Type: application/x-www-form-urlencoded\n\nname=Jane Doe&subscribed=no\n\nDelete Member\nDELETE /mailgun/v3/lists/{list_address}/members/{member_address}\n\nSuppressions\nBounces\n# List bounces\nGET /mailgun/v3/{domain_name}/bounces\n\n# Add bounce\nPOST /mailgun/v3/{domain_name}/bounces\nContent-Type: application/x-www-form-urlencoded\n\naddress=bounced@example.com&code=550&error=Mailbox not found\n\n# Get bounce\nGET /mailgun/v3/{domain_name}/bounces/{address}\n\n# Delete bounce\nDELETE /mailgun/v3/{domain_name}/bounces/{address}\n\nUnsubscribes\n# List unsubscribes\nGET /mailgun/v3/{domain_name}/unsubscribes\n\n# Add unsubscribe\nPOST /mailgun/v3/{domain_name}/unsubscribes\nContent-Type: application/x-www-form-urlencoded\n\naddress=unsubscribed@example.com&tag=*\n\n# Delete unsubscribe\nDELETE /mailgun/v3/{domain_name}/unsubscribes/{address}\n\nComplaints\n# List complaints\nGET /mailgun/v3/{domain_name}/complaints\n\n# Add complaint\nPOST /mailgun/v3/{domain_name}/complaints\nContent-Type: application/x-www-form-urlencoded\n\naddress=complainer@example.com\n\n# Delete complaint\nDELETE /mailgun/v3/{domain_name}/complaints/{address}\n\nWhitelists\n# List whitelists\nGET /mailgun/v3/{domain_name}/whitelists\n\n# Add to whitelist\nPOST /mailgun/v3/{domain_name}/whitelists\nContent-Type: application/x-www-form-urlencoded\n\naddress=allowed@example.com\n\n# Delete from whitelist\nDELETE /mailgun/v3/{domain_name}/whitelists/{address}\n\nStatistics\nGet Stats\nGET /mailgun/v3/{domain_name}/stats/total?event=delivered&event=opened\n\n\nQuery parameters:\n\nevent (required) - Event type(s): accepted, delivered, failed, opened, clicked, unsubscribed, complained\nstart - Start date (RFC 2822 or Unix timestamp)\nend - End date\nresolution - Data resolution (hour, day, month)\nduration - Period to show stats for\nTags\nList Tags\nGET /mailgun/v3/{domain_name}/tags\n\nGet Tag\nGET /mailgun/v3/{domain_name}/tags/{tag_name}\n\nDelete Tag\nDELETE /mailgun/v3/{domain_name}/tags/{tag_name}\n\nIPs\nList IPs\nGET /mailgun/v3/ips\n\nGet IP\nGET /mailgun/v3/ips/{ip_address}\n\nDomain Tracking\nGet Tracking Settings\nGET /mailgun/v3/domains/{domain_name}/tracking\n\nUpdate Open Tracking\nPUT /mailgun/v3/domains/{domain_name}/tracking/open\nContent-Type: application/x-www-form-urlencoded\n\nactive=yes\n\nUpdate Click Tracking\nPUT /mailgun/v3/domains/{domain_name}/tracking/click\nContent-Type: application/x-www-form-urlencoded\n\nactive=yes\n\nUpdate Unsubscribe Tracking\nPUT /mailgun/v3/domains/{domain_name}/tracking/unsubscribe\nContent-Type: application/x-www-form-urlencoded\n\nactive=yes&html_footer=<a href=\"%unsubscribe_url%\">Unsubscribe</a>\n\nCredentials\nList Credentials\nGET /mailgun/v3/domains/{domain_name}/credentials\n\nCreate Credential\nPOST /mailgun/v3/domains/{domain_name}/credentials\nContent-Type: application/x-www-form-urlencoded\n\nlogin=alice&password=supersecret\n\nDelete Credential\nDELETE /mailgun/v3/domains/{domain_name}/credentials/{login}\n\nPagination\n\nMailgun uses cursor-based pagination:\n\n{\n  \"items\": [...],\n  \"paging\": {\n    \"first\": \"https://api.mailgun.net/v3/.../pages?page=first&limit=100\",\n    \"last\": \"https://api.mailgun.net/v3/.../pages?page=last&limit=100\",\n    \"next\": \"https://api.mailgun.net/v3/.../pages?page=next&limit=100\",\n    \"previous\": \"https://api.mailgun.net/v3/.../pages?page=prev&limit=100\"\n  }\n}\n\n\nUse limit parameter to control page size (default: 100).\n\nCode Examples\nJavaScript - Send Email\nconst formData = new URLSearchParams();\nformData.append('from', 'sender@example.com');\nformData.append('to', 'recipient@example.com');\nformData.append('subject', 'Hello');\nformData.append('text', 'Hello World!');\n\nconst response = await fetch(\n  'https://gateway.maton.ai/mailgun/v3/example.com/messages',\n  {\n    method: 'POST',\n    headers: {\n      'Authorization': `Bearer ${process.env.MATON_API_KEY}`,\n      'Content-Type': 'application/x-www-form-urlencoded'\n    },\n    body: formData.toString()\n  }\n);\nconst result = await response.json();\nconsole.log(result);\n\nPython - Send Email\nimport os\nimport requests\n\nresponse = requests.post(\n    'https://gateway.maton.ai/mailgun/v3/example.com/messages',\n    headers={'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'},\n    data={\n        'from': 'sender@example.com',\n        'to': 'recipient@example.com',\n        'subject': 'Hello',\n        'text': 'Hello World!'\n    }\n)\nprint(response.json())\n\nPython - List Domains\nimport os\nimport requests\n\nresponse = requests.get(\n    'https://gateway.maton.ai/mailgun/v3/domains',\n    headers={'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\n)\ndomains = response.json()\nfor domain in domains['items']:\n    print(f\"{domain['name']}: {domain['state']}\")\n\nPython - Create Route and Webhook\nimport os\nimport requests\n\nheaders = {'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\ndomain = 'example.com'\n\n# Create route\nroute_response = requests.post(\n    'https://gateway.maton.ai/mailgun/v3/routes',\n    headers=headers,\n    data={\n        'priority': 0,\n        'description': 'Forward to webhook',\n        'expression': 'match_recipient(\"support@example.com\")',\n        'action': 'forward(\"https://myapp.com/incoming-email\")'\n    }\n)\nprint(f\"Route created: {route_response.json()}\")\n\n# Create webhook\nwebhook_response = requests.post(\n    f'https://gateway.maton.ai/mailgun/v3/domains/{domain}/webhooks',\n    headers=headers,\n    data={\n        'id': 'delivered',\n        'url': 'https://myapp.com/webhook/delivered'\n    }\n)\nprint(f\"Webhook created: {webhook_response.json()}\")\n\nNotes\nMailgun uses application/x-www-form-urlencoded for POST/PUT requests, not JSON\nDomain names must be included in most endpoint paths\nRoutes are global (per account), not per domain\nSandbox domains require authorized recipients for sending\nDates are returned in RFC 2822 format\nEvent logs are stored for at least 3 days\nStats require at least one event parameter\nTemplates use Handlebars syntax by default\nIMPORTANT: When using curl commands, use curl -g when URLs contain brackets to disable glob parsing\nIMPORTANT: When piping curl output to jq, environment variables may not expand correctly. Use Python examples instead.\nRate Limits\nOperation\tLimit\nSending\tVaries by plan\nAPI calls\tNo hard limit, but excessive requests may be throttled\n\nWhen rate limited, implement exponential backoff for retries.\n\nError Handling\nStatus\tMeaning\n400\tBad request or missing Mailgun connection\n401\tInvalid or missing Maton API key\n403\tForbidden (e.g., sandbox domain restrictions)\n404\tResource not found\n429\tRate limited\n4xx/5xx\tPassthrough error from Mailgun API\nTroubleshooting: API Key Issues\nCheck that the MATON_API_KEY environment variable is set:\necho $MATON_API_KEY\n\nVerify the API key is valid by listing connections:\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nTroubleshooting: Invalid App Name\nEnsure your URL path starts with mailgun. For example:\nCorrect: https://gateway.maton.ai/mailgun/v3/domains\nIncorrect: https://gateway.maton.ai/v3/domains\nTroubleshooting: Sandbox Domain Restrictions\n\nSandbox domains can only send to authorized recipients. To send emails:\n\nUpgrade to a paid plan, or\nAdd recipient addresses to authorized recipients in the Mailgun dashboard\nResources\nMailgun API Documentation\nMailgun API Reference\nMailgun Postman Collection\nMaton Community\nMaton Support"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/byungkyu/mailgun-api",
    "publisherUrl": "https://clawhub.ai/byungkyu/mailgun-api",
    "owner": "byungkyu",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/mailgun-api",
    "downloadUrl": "https://openagent3.xyz/downloads/mailgun-api",
    "agentUrl": "https://openagent3.xyz/skills/mailgun-api/agent",
    "manifestUrl": "https://openagent3.xyz/skills/mailgun-api/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/mailgun-api/agent.md"
  }
}