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/

Email Preview

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

Operations

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

Get Image Validation Results

Request

Returns the results of an image validation test.

Security
basicAuth
Path
idstringrequired

The ID of the validation test we want to check the results for

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

Responses

A 200 response

Bodyapplication/json
metaobject
itemsobject
Response
application/json
{ "meta": { "status": "Completed" }, "items": { "id": "67a654ba0f53254b9fdca3e2", "images": [] } }

Delete Image Validation Test

Request

Delete a specific image validation test by its unique test ID. This endpoint allows you to remove an image validation test from the system. If the test ID does not exist, the appropriate error message is returned.

Security
basicAuth
Path
idstringrequired

The unique identifier of the test.

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

Responses

A 200 response

Bodyapplication/json
messagestringrequired
Response
application/json
{ "message": "Image validation test with test id <id> has been successfully deleted." }

Get Image Validation Tests

Request

Retrieve a paginated list of all image validation tests that have been submitted. The response is paginated, with a limit of up to 1000 items per page. The total count of records will display in the meta object under the key, 'count'.

Security
basicAuth
Query
limitinteger

Max count of items. Max: 1000. Default: 100

skipinteger

Get the list of items starting at the nth element (paging). Default: 0

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

Responses

A 200 response

Bodyapplication/json
metaobject
pagingobject
itemsArray of objects
Response
application/json
{ "meta": { "count": 17 }, "paging": { "first": "https://api.mailgun.net/v1/inspect/accessibility/tests?limit=100&skip=0", "last": "https://api.mailgun.net/v1/inspect/accessibility/tests?limit=100&skip=0" }, "items": [ {} ] }

Create an Image Validation Test

Request

Create an image validation test.

Security
basicAuth
Bodyapplication/jsonrequired
linksArray of strings
curl -i -X POST \
  -u <username>:<password> \
  https://api.mailgun.net/v1/inspect/images \
  -H 'Content-Type: application/json' \
  -d '{
    "links": [
      "string"
    ]
  }'

Responses

A 200 response

Bodyapplication/json
metaobject
itemsobject(github.com-mailgun-inspect-internal-imagevalidation-CreateResource)
Response
application/json
{ "meta": { "status": "Processing" }, "items": { "id": "67a654ba0f53254b9fdca3e2", "links": {} } }

Create an Image Validation Test by HTML

Request

Create an image validation test with HTML

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

Responses

A 200 response

Bodyapplication/json
metaobject
itemsobject(github.com-mailgun-inspect-internal-imagevalidation-CreateResource)
Response
application/json
{ "meta": { "status": "Complete" }, "items": { "id": "67b625524b911fa30a4d7858", "links": {} } }

Create an Image Validation Test by Image Upload

Request

Create an image validation test by image upload

Security
basicAuth
Bodyapplication/jsonrequired
imagestring(binary)
curl -i -X POST \
  -u <username>:<password> \
  https://api.mailgun.net/v1/inspect/images/upload \
  -H 'Content-Type: application/json' \
  -d '{
    "image": "string"
  }'

Responses

A 200 response

Bodyapplication/json
metaobject
itemsobject
Response
application/json
{ "meta": { "status": "Complete" }, "items": { "id": "67b629564b911fa30a4d7873", "images": [] } }

Reprocess Image Validation Test

Request

Reprocess an image validation test.

Security
basicAuth
Path
idstringrequired

Test ID

curl -i -X POST \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/images/{id}/reprocess'

Responses

A 200 response

Bodyapplication/json
metaobject
itemsobject(github.com-mailgun-inspect-internal-imagevalidation-CreateResource)
Response
application/json
{ "meta": { "status": "Processing" }, "items": { "id": "67a654ba0f53254b9fdca3e2", "links": {} } }

Optimize Images By Test ID

Request

Optimizes images by test id

Security
basicAuth
Path
idstringrequired

The ID of the image validation test we want to optimize the images for.

curl -i -X POST \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/images/{id}/optimize'

Responses

A 200 response

Bodyapplication/json
metaobject
pagingobject
itemsArray of objects
Response
application/json
{ "meta": { "status": "Completed" }, "items": [ {} ] }

Optimize Single Image By Test ID

Request

Optimizes a single image by test id

Security
basicAuth
Path
test_idstringrequired

The ID of the image validation test we want to optimize the images for.

image_idstringrequired

The ID of the image we want to optimize

curl -i -X POST \
  -u <username>:<password> \
  'https://api.mailgun.net/v1/inspect/images/{id}/optimize/{image_id}'

Responses

A 200 response

Bodyapplication/json
metaobject
pagingobject
itemsobject
Response
application/json
{ "meta": { "status": "Completed" }, "items": { "optimized_images": [] } }

Accessibility

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

Operations