### Install Mailgun SDK from source Source: https://documentation.mailgun.com/docs/mailgun/sdk/python_sdk.md Commands to clone the repository and install the package locally. ```bash git clone https://github.com/mailgun/mailgun-python cd mailgun-python ``` ```bash pip install . ``` -------------------------------- ### Install Composer Source: https://documentation.mailgun.com/docs/mailgun/sdk/php_sdk.md Command to install Composer in your project. ```bash curl -sS https://getcomposer.org/installer | php ``` -------------------------------- ### Install Mailgun Go SDK Source: https://documentation.mailgun.com/docs/mailgun/sdk/go_sdk.md Use this command to install the SDK via Go modules. ```bash $ go get github.com/mailgun/mailgun-go/v5 ``` -------------------------------- ### Install Mailgun SDK using conda and make Source: https://documentation.mailgun.com/docs/mailgun/sdk/python_sdk.md Installation method for Unix platforms using make. ```bash make install ``` -------------------------------- ### Install Mailgun SDK via pip Source: https://documentation.mailgun.com/docs/mailgun/sdk/python_sdk.md Standard installation command for the Mailgun Python SDK. ```bash pip install mailgun-python ``` -------------------------------- ### Install Mailgun SDK via Composer Source: https://documentation.mailgun.com/docs/mailgun/sdk/php_sdk.md Commands to install the Mailgun SDK and required PSR-7/PSR-18 dependencies. ```bash composer require mailgun/mailgun-php symfony/http-client nyholm/psr7 ``` ```bash php composer.phar require mailgun/mailgun-php symfony/http-client nyholm/psr7 ``` -------------------------------- ### Install and Use Swaks for SMTP Source: https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-smtp.md Install Swaks, a command-line tool for sending emails via SMTP, and use it to send a test email through Mailgun's SMTP server. Ensure Perl is installed before running Swaks. ```bash # Swaks is the cURL equivalent for SMTP, install it first: curl http://www.jetmore.org/john/code/swaks/files/swaks-20130209.0/swaks -o swaks # Set the permissions for the script so you can run it chmod +x swaks # It's based on perl, so install perl sudo apt-get -y install perl # now send! ./swaks --auth \ --server smtp.mailgun.org \ --au YOUR-SMTP-USER \ --ap YOUR-SMTP-PASSWORD \ --to recipient@example.com \ --h-Subject: "Hello" \ --body 'Testing some Mailgun awesomness!' ``` -------------------------------- ### Install mailgun.js SDK Source: https://documentation.mailgun.com/docs/mailgun/sdk/nodejs_sdk.md Install the mailgun.js package using npm. Requires Node.js version 18.x or higher. ```sh npm install mailgun.js ``` -------------------------------- ### Install Mailgun Ruby Gem Source: https://documentation.mailgun.com/docs/mailgun/sdk/ruby_sdk.md Install the Mailgun Ruby gem using RubyGems. This is the first step to using the library. ```ruby gem install mailgun-ruby ``` -------------------------------- ### Example Webhook Payload with User Variables Source: https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-attachments.md This is an example of a webhook payload showing how attached user variables are structured in the 'user-variables' field. ```JSON { "event": "delivered", "user-variables": { "first_name": "John", "last_name": "Smith", "my_message_id": "123" } } ``` -------------------------------- ### Get a version Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Retrieves the information and content of a specific version of a template. ```APIDOC ## GET /v3/{domain_name}/templates/{template_name}/versions/{version_name} ### Description Retrieve the information and content of the specified version of a template. ### Method GET ### Endpoint /v3/{domain_name}/templates/{template_name}/versions/{version_name} ``` -------------------------------- ### GET /v4/templates Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/account-templates.md Retrieves a list of all account-level templates. ```APIDOC ## GET /v4/templates ### Description Returns a list of account-level templates. ### Method GET ### Endpoint /v4/templates ``` -------------------------------- ### GET /v3/{domain_name}/templates Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-templates.md Returns a list of templates for the specified domain. ```APIDOC ## GET /v3/{domain_name}/templates ### Description Returns a list of templates for the domain. ### Method GET ### Endpoint /v3/{domain_name}/templates ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name. ``` -------------------------------- ### GET /v3/routes Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/routes.md Retrieves a list of all routes defined globally per account. ```APIDOC ## GET /v3/routes ### Description Get the list of routes. Note that routes are defined globally, per account, not per domain. ### Method GET ### Endpoint /v3/routes ``` -------------------------------- ### Get all template versions Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Retrieves a paginated list of all versions for a specified template within a domain. ```APIDOC ## GET /v3/{domain_name}/templates/{template_name}/versions ### Description Returns a paginated list of template versions. ### Method GET ### Endpoint /v3/{domain_name}/templates/{template_name}/versions ``` -------------------------------- ### Setup development environment Source: https://documentation.mailgun.com/docs/mailgun/sdk/python_sdk.md Commands to clone the repository and set up development environments using conda. ```bash git clone https://github.com/mailgun/mailgun-python cd mailgun-python ``` ```bash make dev conda activate mailgun ``` ```bash make dev-full conda activate mailgun-dev ``` -------------------------------- ### GET /v3/domains/{domain}/limits/tag Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/tags.md Get tag limits configured for a specific domain. ```APIDOC ## GET /v3/domains/{domain}/limits/tag ### Description Get tag limits by domain. ### Method GET ### Endpoint /v3/domains/{domain}/limits/tag ### Parameters #### Path Parameters - **domain** (string) - Required - The domain name. ``` -------------------------------- ### GET /v1/analytics/tags/limits Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/tags-new.md Gets the tag limit and current number of unique tags for an account. ```APIDOC ## GET /v1/analytics/tags/limits ### Description Gets the tag limit and current number of unique tags for an account. ### Method GET ### Endpoint /v1/analytics/tags/limits ``` -------------------------------- ### Send an email with Mailgun Source: https://documentation.mailgun.com/docs/mailgun/sdk/python_sdk.md Example demonstrating how to initialize the client and send a message with required parameters. ```python import os from pathlib import Path from mailgun.client import Client key: str = os.environ["MAILGUN_API_KEY"] domain: str = os.environ["DOMAIN"] client: Client = Client(auth=("api", key)) def post_message() -> None: # Messages # POST //messages data = { "from": os.getenv("MESSAGES_FROM", "test@test.com"), "to": os.getenv("MESSAGES_TO", "recipient@example.com"), "subject": "Hello from python!", "text": "Hello world!", "o:tag": "Python test", } req = client.messages.create(data=data, domain=domain) print(req.json()) ``` -------------------------------- ### GET /v3/stats/total Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets stat totals for an entire Mailgun account. This endpoint is deprecated. ```APIDOC ## GET /v3/stats/total ### Description Gets stat totals for an entire Mailgun account. This endpoint is deprecated. ### Method GET ### Endpoint /v3/stats/total ### Parameters No parameters are specified for this endpoint. ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **stats** (object) - Contains various statistical data for the account. #### Response Example { "stats": { "sent": 1000, "delivered": 950, "failed": 50 } } ``` -------------------------------- ### POST /v3/ip_warmups/{addr} Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-address-warmup.md Creates a new warmup plan for an IP address. The IP must be dedicated and owned by the account. ```APIDOC ## POST /v3/ip_warmups/{addr} ### Description Creates a new warmup plan for an IP address. The IP must be dedicated and owned by the account. ### Method POST ### Endpoint /v3/ip_warmups/{addr} ### Parameters #### Path Parameters - **addr** (string) - Required - The IP address for which to create a warmup plan. #### Request Body - **start_time** (string) - Required - The desired start time for the warmup plan (ISO 8601 format). - **end_time** (string) - Required - The desired end time for the warmup plan (ISO 8601 format). ### Request Example ```json { "start_time": "2023-01-01T10:00:00Z", "end_time": "2023-01-15T10:00:00Z" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **ip** (string) - The IP address for which the warmup plan was created. - **status** (string) - The initial status of the warmup plan. #### Response Example ```json { "message": "Warmup plan created successfully.", "ip": "1.2.3.4", "status": "pending" } ``` ``` -------------------------------- ### Create a Forward Rule with Wildcard Matching Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md This example demonstrates creating a forward rule using a wildcard in the 'match' parameter to capture emails from a subdomain. ```bash curl -X POST https://api.mailgun.net/v3/forwards \ -F match='match*@mg.example.com' \ -F forward.recipient=catchall@gmail.com ``` -------------------------------- ### Initialize Mailgun SDK Source: https://documentation.mailgun.com/docs/mailgun/sdk/php_sdk.md Include the Composer autoloader and import the Mailgun class. ```php require 'vendor/autoload.php'; use Mailgun or Mailgun; ``` -------------------------------- ### GET /v3/stats/filter Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets filtered and grouped stat totals for an entire Mailgun account. This endpoint is deprecated. ```APIDOC ## GET /v3/stats/filter ### Description Gets filtered and group stat totals for an entire account. This endpoint is deprecated. ### Method GET ### Endpoint /v3/stats/filter ### Parameters #### Query Parameters - **event** (string) - Optional - Filter stats by a specific event type (e.g., 'delivered', 'failed'). - **domain** (string) - Optional - Filter stats for a specific domain. - **groupby** (string) - Optional - Group results by a specific dimension (e.g., 'day', 'hour', 'recipient'). - **resolution** (string) - Optional - The time resolution for the stats (e.g., 'hour', 'day', 'week', 'month'). ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **stats** (object) - Contains filtered and grouped statistical data. #### Response Example { "stats": { "daily": { "2023-10-26": { "sent": 100, "delivered": 95 } } } } ``` -------------------------------- ### Create an Account-Level Template Source: https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates.md Use the v4 API endpoint to create a template available across all domains and subaccounts. ```bash curl -X POST -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v4/templates \ --form-string template='

{{title}}

{{body}}
' \ -F name='template.test' \ -F description='Sample template' ``` ```json { "message": "template has been stored", "template": { "createdAt": "Sat, 12 Nov 1955 06:38:00 UTC", "createdBy": "user-supplied-value", "description": "Sample template", "id": "46565d87-68b6-4edb-8b3c-34554af4bb77", "name": "template.test", "version": { "active": true, "comment": "Version comment", "createdAt": "Sat, 12 Nov 1955 06:38:00 UTC", "headers": { "From": "from@header.tld", "Reply-To": "reply-to@header.tld", "Subject": "Subject Value" }, "id": "3efd2b85-0f41-4a1d-9898-05d7e7459c4a", "tag": "tag", "template": "template content" } } } ``` -------------------------------- ### Create a Forward Rule with Wildcard Match Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/forwards.md This example demonstrates creating a forward rule using a wildcard in the 'match' parameter to capture a range of email addresses. The wildcard '*' matches any sequence of characters. ```bash $ curl -X POST https://api.mailgun.net/v3/forwards \ -F match='match*@mg.example.com' \ -F forward.recipient=catchall@gmail.com ``` -------------------------------- ### GET /v3/stats/total/domains Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets stat totals for all domains in an account for a single time resolution. This endpoint is deprecated. ```APIDOC ## GET /v3/stats/total/domains ### Description Gets stat totals for domains in an account for a single time resolution. This endpoint is deprecated. ### Method GET ### Endpoint /v3/stats/total/domains ### Parameters No parameters are specified for this endpoint. ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **stats** (object) - Contains statistical data aggregated by domain for a specific time resolution. #### Response Example { "stats": { "example.com": { "sent": 1000, "delivered": 950 }, "another.com": { "sent": 200, "delivered": 190 } } } ``` -------------------------------- ### Setup Mailgun Client in Node.js Source: https://documentation.mailgun.com/docs/mailgun/sdk/nodejs_sdk.md Instantiate a Mailgun client using your API key. For Node.js, you need to use the 'form-data' library. If using EU infrastructure, specify the 'url'. ```js const formData = require('form-data'); const Mailgun = require('mailgun.js'); const mailgun = new Mailgun(formData); const mg = mailgun.client({username: 'api', key: process.env.MAILGUN_API_KEY || 'MAILGUN_API_KEY'}); ``` -------------------------------- ### GET /v3/{domain}/stats/total Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets stat totals for a specific Mailgun domain. This endpoint is deprecated. ```APIDOC ## GET /v3/{domain}/stats/total ### Description Gets stat totals for an entire domain. This endpoint is deprecated. ### Method GET ### Endpoint /v3/{domain}/stats/total ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve stats. ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **stats** (object) - Contains various statistical data for the specified domain. #### Response Example { "stats": { "sent": 500, "delivered": 480, "failed": 20 } } ``` -------------------------------- ### Create a Mailing List via API Source: https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/mailing-lists.md Creates a new mailing list address with a description. ```bash curl -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/lists \ -F address='LIST@YOUR_DOMAIN_NAME' \ -F description='Mailgun developers list' ``` -------------------------------- ### Create a Domain-Level Template Source: https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates.md Use the POST endpoint to store a template scoped to a specific sending domain. ```bash curl -X POST -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/templates \ --form-string template='

{{title}}

{{body}}
' \ -F name='template.test' \ -F description='Sample template' ``` ```json { "template": { "createdAt": "Wed, 29 Aug 2018 23:31:13 UTC", "description": "Sample template", "name": "template.test" }, "message": "template has been stored" } ``` -------------------------------- ### GET /v3/{domain}/aggregates/countries Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets aggregate counts by country for events originating from a given domain. This endpoint is deprecated. ```APIDOC ## GET /v3/{domain}/aggregates/countries ### Description Gets aggregate counts by country (USA, RUS, etc…). This endpoint is deprecated. ### Method GET ### Endpoint /v3/{domain}/aggregates/countries ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve aggregate counts. ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **aggregates** (object) - Contains aggregate counts broken down by country. #### Response Example { "aggregates": { "US": { "sent": 800, "delivered": 780 }, "RU": { "sent": 100, "delivered": 90 } } } ``` -------------------------------- ### Import Allowlist Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/allowlist.md Import a CSV file containing a list of addresses and/or domains to add to the allowlist. The CSV file must be 25MB or under and must contain the following column headers: address, domain. For each row provide either an address or a domain, but not both - choose one, keep the other blank. ```APIDOC ## POST /v3/{domain_name}/whitelists/import ### Description Import a CSV file containing a list of addresses and/or domains to add to the allowlist. ### Method POST ### Endpoint /v3/{domain_name}/whitelists/import ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name for which to import the allowlist. #### Request Body - **file** (file) - Required - The CSV file containing the allowlist entries. Max size: 25MB. Must contain 'address' and 'domain' column headers. Provide either an address or a domain per row. ``` -------------------------------- ### Send Email with Mailgun SDK Source: https://documentation.mailgun.com/docs/mailgun/sdk/nodejs_sdk.md Send an email using the Mailgun SDK. This example demonstrates sending a simple text and HTML email. Ensure your sandbox domain is correctly configured. ```JS mg.messages.create('sandbox-123.mailgun.org', { from: "Excited User ", to: ["test@example.com"], subject: "Hello", text: "Testing some Mailgun awesomness!", html: "

Testing some Mailgun awesomness!

" }) .then(msg => console.log(msg)) // logs response data .catch(err => console.error(err)); // logs any error ``` -------------------------------- ### GET /v3/{domain}/aggregates/devices Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets aggregate counts on devices that triggered events for a given domain. This endpoint is deprecated. ```APIDOC ## GET /v3/{domain}/aggregates/devices ### Description Gets aggregate counts on devices that triggered events ('tablet', 'phone', 'pc', etc…). This endpoint is deprecated. ### Method GET ### Endpoint /v3/{domain}/aggregates/devices ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve aggregate counts. ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **aggregates** (object) - Contains aggregate counts broken down by device type. #### Response Example { "aggregates": { "phone": { "sent": 700, "delivered": 680 }, "pc": { "sent": 300, "delivered": 270 } } } ``` -------------------------------- ### GET /v1/bounce-classification/config/rules (Deprecated) Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/bounce-classification.md Deprecated: use GET /v2/bounce-classification/config/groups/{group-id} instead. Retrieves a list of all bounce classification rules. ```APIDOC ## GET /v1/bounce-classification/config/rules ### Description Deprecated: use GET /v2/bounce-classification/config/groups/{group-id} instead. Retrieves a list of all bounce classification rules. ### Method GET ### Endpoint /v1/bounce-classification/config/rules ### Parameters #### Query Parameters - **limit** (integer) - Optional - Maximum number of items to return. - **offset** (integer) - Optional - Number of items to skip before returning results. ### Response #### Success Response (200) - **rules** (array) - An array of bounce classification rules. - **rule_id** (string) - The ID of the rule. - **description** (string) - A description of the rule. - **entity_id** (string) - The entity this rule applies to. - **bounce_type** (string) - The type of bounce this rule classifies. #### Response Example ```json { "rules": [ { "rule_id": "rule_123", "description": "Invalid email address format", "entity_id": "user_signup", "bounce_type": "hard" }, { "rule_id": "rule_456", "description": "Mailbox full", "entity_id": "user_signup", "bounce_type": "soft" } ] } ``` ``` -------------------------------- ### GET /v3/{domain}/aggregates/providers Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats.md Gets aggregate counts by email service provider (ESP) for a given domain. This endpoint is deprecated. ```APIDOC ## GET /v3/{domain}/aggregates/providers ### Description Gets aggregate counts by email service provider. This endpoint is deprecated. ### Method GET ### Endpoint /v3/{domain}/aggregates/providers ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve aggregate counts. ### Request Example No request body is applicable for this GET request. ### Response #### Success Response (200) - **aggregates** (object) - Contains aggregate counts broken down by ESP. #### Response Example { "aggregates": { "gmail.com": { "sent": 500, "delivered": 480 }, "yahoo.com": { "sent": 200, "delivered": 190 } } } ``` -------------------------------- ### Create a template Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Stores a new template, including its name, description, and optionally its content. If content is provided, a new active version is automatically created. ```APIDOC ## POST /v3/{domain_name}/templates ### Description Store a new template, including its name, description and (optionally) the template content. If the template content is provided, a new version is automatically created and becomes the active version. ### Method POST ### Endpoint /v3/{domain_name}/templates ``` -------------------------------- ### POST /v1/dkim/keys Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-keys.md Create a domain key or import an existing PEM file. ```APIDOC ## POST /v1/dkim/keys ### Description Create a domain key. Alternatively, you can import an existing PEM file containing a RSA private key in PKCS #1, ASn.1 DER format. ### Method POST ### Endpoint /v1/dkim/keys ``` -------------------------------- ### Time Range Selection: Start and End Dates Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Specify a precise time range for your data queries using start and end dates in RFC 2822 format. ```json { "start": "Mon, 13 Nov 2023 00:00:00 -0600", "end": "Mon, 20 Nov 2023 23:59:59 -0600" } ``` -------------------------------- ### GET /v1/thresholds/hits Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/send-alerts.md List account hits for monitoring. ```APIDOC ## GET /v1/thresholds/hits ### Description Retrieves a list of account hits. ### Method GET ### Endpoint /v1/thresholds/hits ``` -------------------------------- ### Send Email with Mailgun Java SDK Source: https://documentation.mailgun.com/docs/mailgun/sdk/java_sdk.md A basic example of sending an email using the Mailgun Java SDK. Ensure you have configured the necessary constants like EMAIL_FROM, USER_EMAIL, SUBJECT, and TEXT. ```java Message message = Message.builder() .from(EMAIL_FROM) .to(USER_EMAIL) .subject(SUBJECT) .text(TEXT) .build(); MessageResponse messageResponse = mailgunMessagesApi.sendMessage(DOMAIN, message); ``` -------------------------------- ### Create Mailgun Template with All Handlebars Helpers Source: https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates.md This bash command demonstrates creating a Mailgun template that utilizes all supported Handlebars helpers (`with`, `equal`, `unless`, `if`, `each`) for dynamic content generation. ```bash curl -X POST -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/templates \ -F name='comprehensive.test' \ -F description='Complete test template with all Handlebars helpers' \ --form-string template='

Order Confirmation

{{#with customer}}

Hello {{firstName}} {{lastName}},

Email: {{email}}

{{/with}} {{#equal accountType "premium"}}

🎉 Premium Member Perk: You have earned 2x points on this order!

{{/equal}} {{#equal accountType "basic"}}

Upgrade to Premium for exclusive benefits and rewards!

{{/equal}} {{#unless paymentReceived}}

⚠️ WARNING: Payment pending. Your order will ship once payment is confirmed.

{{/unless}} {{#if paymentReceived}}

✓ Payment confirmed! Your order is being processed.

{{/if}}

Order Items:

{{#if spanish}}

Gracias por su compra!

{{else if french}}

Merci pour votre achat!

{{else}}

Thank you for your purchase!

{{/if}} ' ``` -------------------------------- ### Enable Subaccount Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Enable a subaccount. ```APIDOC ## POST /v5/accounts/subaccounts/{subaccount_id}/enable ### Description Enable a subaccount. ### Method POST ### Endpoint /v5/accounts/subaccounts/{subaccount_id}/enable #### Path Parameters - **subaccount_id** (string) - Required - The ID of the subaccount to enable. ``` -------------------------------- ### GET /v1/thresholds/alerts/send Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/send-alerts.md Retrieve a list of all configured send alerts. ```APIDOC ## GET /v1/thresholds/alerts/send ### Description Returns a list of all send alerts configured for the account. ### Method GET ### Endpoint /v1/thresholds/alerts/send ``` -------------------------------- ### Get domain webhooks Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-webhooks.md Returns all webhooks configured for a specific domain. ```APIDOC ## Get domain webhooks ### Description Returns all webhooks for the domain. ### Method GET ### Endpoint /v3/domains/{domain}/webhooks ``` -------------------------------- ### GET /v3/{domain}/tag/stats Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/tags.md Retrieve statistics filtered by tag. ```APIDOC ## GET /v3/{domain}/tag/stats ### Description Retrieve stats by tag. ### Method GET ### Endpoint /v3/{domain}/tag/stats ### Parameters #### Path Parameters - **domain** (string) - Required - The domain name. ``` -------------------------------- ### Enroll all account domains Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Initiates an asynchronous background job to assign all domains within the account, including those in subaccounts, to Dynamic IP Pools. Requires the Dynamic IP Pools feature to be enabled and the request to originate from a parent account user. ```APIDOC ## POST /v3/domains/all/dynamic_pools/enroll ### Description Begins a background job to assign all account domains to Dynamic IP Pools. ### Method POST ### Endpoint /v3/domains/all/dynamic_pools/enroll ### Notes - The Dynamic IP Pools feature must be enabled for the account. - The request must come from a parent account user. - Can include domains belonging to subaccounts depending on provided parameters (not detailed in source). ``` -------------------------------- ### GET /v3/{domain_name}/unsubscribes Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/unsubscribe.md Paginate over a list of unsubscribes for a domain. ```APIDOC ## GET /v3/{domain_name}/unsubscribes ### Description Paginate over a list of unsubscribes for domain. ### Method GET ### Endpoint /v3/{domain_name}/unsubscribes ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name. ``` -------------------------------- ### Initialize/set IPs for all pools Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun.md Replaces any existing IPs in dynamic IP pools with new ones. All provided IPs must be dedicated and belong to the account, and each pool must contain at least one IP that is not currently warming. ```APIDOC ## POST /v3/dynamic_pools/all ### Description Initializes or sets IPs for all dynamic IP pools, replacing existing IPs. ### Method POST ### Endpoint /v3/dynamic_pools/all ### Notes - Any existing IPs in dynamic IP pools will be replaced. - All IPs must be dedicated and belong to the account. - Each dynamic IP pool must contain at least 1 IP that is not currently warming. ``` -------------------------------- ### GET /v3/{domain_name}/templates/{template_name}/versions Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-templates.md Returns a paginated list of template versions. ```APIDOC ## GET /v3/{domain_name}/templates/{template_name}/versions ### Description Returns a paginated list of template versions. ### Method GET ### Endpoint /v3/{domain_name}/templates/{template_name}/versions ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name. - **template_name** (string) - Required - The name of the template. ``` -------------------------------- ### GET /v5/users Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/users.md Retrieves a list of all users associated with the Mailgun account. ```APIDOC ## GET /v5/users ### Description Get users on an account. ### Method GET ### Endpoint /v5/users ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) #### Response Example ``` -------------------------------- ### GET /v5/users/{user_id} Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/users/get-v5-users-user_id Retrieves the details for a specific user on the account. ```APIDOC ## GET /v5/users/{user_id) ### Description Get details for a user on the account. ### Method GET ### Endpoint /v5/users/{user_id} ### Parameters #### Path Parameters - **user_id** (string) - Required - The ID of the user on the account ### Response #### Success Response (200) - **id** (string) - the user ID - **activated** (boolean) - user activation status - **name** (string) - full name of user - **is_disabled** (boolean) - disablement status of user - **email** (string) - user email address - **email_details** (object) - **email_details.address** (string) - the full email address - **email_details.is_valid** (boolean) - whether the email address is valid - **email_details.reason** (string) - reason why user email is not valid, if applicable - **email_details.parts** (object) - **email_details.parts.domain** (string) - email domain - **email_details.parts.local_part** (string) - user email identifier - **email_details.parts.display_name** (string) - email display name, if applicable - **role** (string) - role of user on the account - **account_id** (string) - account ID - **opened_ip** (string) - IP address from which the user opened the account, if applicable - **is_master** (boolean) - whether the user is the account owner - **metadata** (object) - any optional metadata for the user - **tfa_enabled** (boolean) - whether 2-factor auth has been enabled for the user - **tfa_active** (boolean) - whether 2-factor auth has been activated for the user - **tfa_created_at** (any) - Example: "2022-12-20T16:52:01.892000" - **password_updated_at** (any) - Example: "2022-12-20T16:52:01.892000" - **preferences** (object) - **preferences.time_zone** (string) - time zone for the user - **preferences.time_format** (string) - preferred timestamp format for the user's in-app experience - **preferences.programming_language** (string) - preferred programming language - **auth** (object) - **auth.method** (string) - Required - The user-level auth method - **auth.prior_method** (string) - The previous auth method for the user, if applicable - **auth.prior_details** (object) - Details that may be needed for an auth method - **github_user_id** (any) - **salesforce_user_id** (any) - **migration_status** (string) - status of migration to Sinch ID for user authentication, if applicable #### Response Example { "id": "user123", "activated": true, "name": "John Doe", "is_disabled": false, "email": "john.doe@example.com", "email_details": { "address": "John Doe ", "is_valid": true, "reason": null, "parts": { "domain": "example.com", "local_part": "john.doe", "display_name": "John Doe" } }, "role": "admin", "account_id": "acc456", "opened_ip": "192.168.1.1", "is_master": true, "metadata": {}, "tfa_enabled": true, "tfa_active": true, "tfa_created_at": "2022-12-20T16:52:01.892000", "password_updated_at": "2022-12-20T16:52:01.892000", "preferences": { "time_zone": "UTC", "time_format": "HH:mm", "programming_language": "en" }, "auth": { "method": "basic", "prior_method": null, "prior_details": null }, "github_user_id": null, "salesforce_user_id": null, "migration_status": "completed" } #### Error Response (404) - **message** (string) - Required - Status message #### Response Example { "message": "User not found" } ``` -------------------------------- ### PUT /v3/{domain_name}/templates/{template_name}/versions/{version_name}/copy/{new_version_name} Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-templates.md Copies an existing version into a new version. ```APIDOC ## PUT /v3/{domain_name}/templates/{template_name}/versions/{version_name}/copy/{new_version_name} ### Description Copies an existing version into a new version with the provided name. ### Method PUT ### Endpoint /v3/{domain_name}/templates/{template_name}/versions/{version_name}/copy/{new_version_name} ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name. - **template_name** (string) - Required - The name of the template. - **version_name** (string) - Required - The name of the version. - **new_version_name** (string) - Required - The name of the new version. ``` -------------------------------- ### POST /v3/{domain_name}/templates Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domain-templates.md Stores a new template, including its name, description, and optional content. ```APIDOC ## POST /v3/{domain_name}/templates ### Description Store a new template, including its name, description and (optionally) the template content. If the template content is provided, a new version is automatically created and becomes the active version. ### Method POST ### Endpoint /v3/{domain_name}/templates ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name. ``` -------------------------------- ### Get Members by Page Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/mailing-lists.md Paginate over list members to retrieve them in batches. ```APIDOC ## GET /v3/lists/{list_address}/members/pages ### Description Paginate over list members in a given mailing list in ascending order. ### Method GET ### Endpoint /v3/lists/{list_address}/members/pages ### Parameters #### Path Parameters - **list_address** (string) - Required - The email address of the mailing list. #### Query Parameters - **limit** (integer) - Optional - Maximum number of members to return per page. - **page** (integer) - Optional - The page number to retrieve. ### Response #### Success Response (200) - **items** (array) - An array of member objects. - **address** (string) - The email address of the member. - **name** (string) - The name of the member. - **created_at** (string) - Timestamp of creation. - **member_type** (string) - Type of member. - **list_address** (string) - The mailing list address. - **vars** (object) - Custom variables. - **next_page** (string) - URL for the next page of results, if available. #### Response Example ```json { "items": [ { "address": "member1@example.com", "name": "Jane Doe", "created_at": "2023-10-27T10:15:00Z", "member_type": "list", "list_address": "my-list@yourdomain.com", "vars": {"city": "New York"} } ], "next_page": "/v3/lists/my-list@yourdomain.com/members/pages?limit=10&page=2" } ``` ``` -------------------------------- ### GET /v3/routes/match Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/routes.md Checks if an address matches at least one route. ```APIDOC ## GET /v3/routes/match ### Description Checks if an address matches at least one route. ### Method GET ### Endpoint /v3/routes/match ``` -------------------------------- ### Import list of bounces Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/bounces.md Import a CSV file containing a list of addresses to add to the bounce list. The CSV file must be 25MB or under and must contain the following column headers: address, code, error, created_at. ```APIDOC ## POST /v3/{domain_name}/bounces/import ### Description Import a CSV file containing a list of addresses to add to the bounce list. The CSV file must be 25MB or under and must contain the following column headers: address, code, error, created_at. address is a valid email address. code is error code (optional, default: 550). error is error description (optional, default: empty string). created_at is timestamp of bounce event in RFC2822 format (optional, default: current time) ### Method POST ### Endpoint /v3/{domain_name}/bounces/import ### Parameters #### Path Parameters - **domain_name** (string) - Required - The domain name for which to manage bounces. #### Request Body - **file** (file) - Required - The CSV file containing bounce data. - **address** (string) - Required - A valid email address. - **code** (string) - Optional - Error code (default: 550). - **error** (string) - Optional - Error description (default: empty string). - **created_at** (string) - Optional - Timestamp of bounce event in RFC2822 format (default: current time). ``` -------------------------------- ### POST /v4/templates Source: https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/account-templates.md Creates a new account-level template. ```APIDOC ## POST /v4/templates ### Description Store a new account-level template that is available across all domains for the account. Include the template name, description and (optionally) the template content. If the template content is provided, a new version is automatically created and becomes the active version. ### Method POST ### Endpoint /v4/templates ```