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

Deletes all versions of a code analysis test by test ID.

Security
basicAuth
Path
test_idstringrequired

The ID of the code analysis test to delete

curl -i -X DELETE \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/analyze/{test_id}'

Responses

A 200 response

Bodyapplication/json
messagestringrequired

Response message

Response
application/json
{ "message": "Test <id> has been successfully deleted." }

Get Code Analysis Results by Version

Request

Returns code analysis test results for a specific test ID and version.

Security
basicAuth
Path
test_idstringrequired

The ID of the code analysis test

version_idstringrequired

The version number of the test results

Query
slugstring

Filter results by feature slug

support_typestring

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

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}/versions/{version_id}?slug=string&support_type=string&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, "inbox_provider_support": {}, "market_support": {}, "status": "Completed", "version": 2 }, "items": { "id": "67a654ba0f53254b9fdca3e2", "version": 2, "features": [] } }

Request

Returns all versions available for a given test ID.

Security
basicAuth
Path
test_idstringrequired

The ID of the code analysis test

curl -i -X GET \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/analyze/{test_id}/versions'

Responses

A 200 response

Bodyapplication/json
metaobject or null

Metadata about the version list including count

itemsobjectrequired

List of available versions for the test

items.​versionsArray of objects(github.com-mailgun-inspect-internal-codeanalysis-VersionInfo)required
items.​versions[].​idstringrequired

Unique identifier for the test

items.​versions[].​versioninteger(int32)required

Version number of the test result

items.​versions[].​linksobjectrequired

Hypermedia links for accessing version-specific resources

items.​versions[].​links.​selfstringrequired

URL to access this resource

Response
application/json
{ "meta": { "count": 3 }, "items": { "versions": [] } }

Email Preview

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

Operations