Skip to content

Email Preview API (1.0.0)

Mailgun Email Preview service with RESTful JSON HTTP API for providing email previews.

Download OpenAPI description
Languages
Servers
US Mailgun

https://api.mailgun.net/

EU Mailgun

https://api.eu.mailgun.net/

Image Validation

The Image Validation API processes image URLs or uploads to provide comprehensive details such as dimensions, type, file size, and format, reports frame count, animation duration, color depth, and transparency for GIFs, and include image optimization capabilities.

Operations

Accessibility

The Accessibility API evaluates HTML emails against WCAG standards, providing a clear pass/fail assessment to ensure compliance with accessibility guidelines.

Operations

Code Analysis

The Code Analysis API analyzes HTML email content to detect CSS features and provides comprehensive compatibility reports across major email clients, including support statistics, version-specific compatibility data, and detailed feature breakdowns to ensure optimal email rendering.

Operations

Request

Returns a paginated list of all code analysis jobs under the account, showing only the latest version of each test. Uses skip/limit pagination and supports filtering by status.

Security
basicAuth
Query
statusstring

Filter jobs by status (Processing, Completed, Failed)

Enum ValueDescription
Processing

Filter by jobs that are currently processing

Completed

Filter by jobs that have completed

Failed

Filter by jobs that have failed

limitintegerrequired

Limits the number of items returned in a request

curl -i -X GET \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/analyze?status=Processing&limit=0'

Responses

A 200 response

Bodyapplication/json
metaobject or null

Metadata including pagination links and result counts

itemsArray of objects(github.com-mailgun-inspect-internal-codeanalysis-CodeAnalysisListItem)required

List of code analysis tests

items[].​test_idstringrequired

Unique identifier for the code analysis test

items[].​statusstringrequired

Current processing status of the test

items[].​versioninteger(int32)required

Latest version number of this test

items[].​created_atstring(date-time)required

Timestamp when the test was created

items[].​linksobjectrequired

Hypermedia links for accessing test resources

items[].​links.​selfstringrequired

URL to access this resource

Response
application/json
{ "meta": { "count": 25, "first": "https://api.mailgun.com/v1/inspect/analyze?skip=0&limit=10", "last": "https://api.mailgun.com/v1/inspect/analyze?skip=240&limit=10", "next": "https://api.mailgun.com/v1/inspect/analyze?skip=20&limit=10", "previous": "https://api.mailgun.com/v1/inspect/analyze?skip=0&limit=10" }, "items": [ {}, {} ] }

Request

Create a code analysis test to analyze HTML content for email client feature compatibility.

Security
basicAuth
Bodyapplication/jsonrequired
htmlstring
urlstring
mimestring
transfer_encodingstring
charsetstring
curl -i -X POST \
  -u <username>:<password> \
  https://api.mailgun.net/v1/inspect/analyze \
  -H 'Content-Type: application/json' \
  -d '{
    "html": "string",
    "url": "string",
    "mime": "string",
    "transfer_encoding": "string",
    "charset": "string"
  }'

Responses

A 200 response

Bodyapplication/json
metaobject or null

Metadata about the test creation including status and version

itemsobjectrequired

Details of the created test including ID and links

items.​idstringrequired

Unique identifier for the created test

items.​linksobjectrequired

Hypermedia links for accessing test resources

items.​links.​selfstringrequired

URL to access this resource

Response
application/json
{ "meta": { "status": "Processing", "version": 1 }, "items": { "id": "67a654ba0f53254b9fdca3e2", "links": {} } }

Request

Returns the latest version of code analysis test results for a given test ID.

Security
basicAuth
Path
test_idstringrequired

The ID of the code analysis test we want to check the results for

Query
slugstring

Filter results by feature slug

support_typestring

Filter results by support type (y=supported, a=partial, n=not supported, u=unknown)

Enum ValueDescription
y

Filter by supported clients

a

Filter by partially supported clients

n

Filter by not supported clients

u

Filter by unknown clients

group_bystring

Group variants by their implementation notes. When set to 'notes', variants within each support level are grouped by their note content. The response structure changes: instead of VariantReference arrays, each support level (y/a/n/u) contains GroupedVariantsByNote objects with 'note' field and 'variants' array. A 'grouped_by' field is added to meta.

ValueDescription
notes

Group variants by their implementation notes

curl -i -X GET \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/analyze/{test_id}?slug=string&support_type=y&group_by=notes'

Responses

A 200 response

Bodyapplication/json
metaobject or null

Metadata including status and counts and support statistics

itemsobjectrequired

Test results including detected features and their support data

items.​idstringrequired

Unique identifier for the test

items.​versioninteger(int32)required

Version number of this test result

items.​featuresArray of objects(github.com-mailgun-inspect-internal-codeanalysis-MatchedResult)required

List of email features detected in the analyzed HTML

items.​features[].​slugstring

URL-friendly identifier for this feature

items.​features[].​namestring

Name of the email feature

items.​features[].​descriptionstring or null

Detailed information about what this email feature does

items.​features[].​categorystring

Machine-readable category code that groups related features

items.​features[].​notes_lookupobject

Maps note reference IDs to their corresponding implementation notes

items.​features[].​instancesArray of objects(github.com-mailgun-inspect-internal-codeanalysis-Instance)required
items.​features[].​instances[].​idstringrequired

Unique identifier for this instance of the feature in the HTML

items.​features[].​instances[].​lineinteger(int32)required

Line number where the feature was found in the HTML source

items.​features[].​instances[].​columninteger(int32)required

Column number where the feature was found in the HTML source

items.​features[].​supportobject(github.com-mailgun-inspect-internal-codeanalysis-Support)required
items.​features[].​support.​yArray of objects(github.com-mailgun-inspect-internal-codeanalysis-VariantReference)

Email clients that fully support this feature

items.​features[].​support.​aArray of objects(github.com-mailgun-inspect-internal-codeanalysis-VariantReference)

Email clients that partially support this feature

items.​features[].​support.​nArray of objects(github.com-mailgun-inspect-internal-codeanalysis-VariantReference)

Email clients that do not support this feature

items.​features[].​support.​uArray of objects(github.com-mailgun-inspect-internal-codeanalysis-VariantReference)

Email clients with unknown support for this feature

Response
application/json
{ "meta": { "application_support": {}, "count": 1, "grouped_by": "notes", "inbox_provider_support": {}, "market_support": {}, "status": "Completed", "version": 1 }, "items": { "id": "67a654ba0f53254b9fdca3e2", "version": 1, "features": [] } }

Email Preview

This API provides functionality to create and manage email preview tests, as well as create shareable links.

Operations