---
title: "Create Email Preview Test V2"
method: POST
path: "/v2/preview/tests"
tags: ["Email Preview"]
---

# Create Email Preview Test V2

`POST /v2/preview/tests`

## Request

- Base URL: `https://api.mailgun.net`
- URL: `https://api.mailgun.net/v2/preview/tests`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/mailgun/apis/email-preview-api/docs/v2/preview/tests/post.ts> (a function with typed inputs; its response is checked against the schema)

This call creates a new email test and submits it to our system for processing.<br>All requests must contain a subject property and one source property (either html or url). All other properties are optional. In the following table, each property and its default value is shown. <br>If content-checking variables (such as those for link validation, image validation, or accessibility) are set in the body of the request, the endpoint will run content-checking on the email content. <br>The response will include an id property that should be used to request the results or trigger further processes on the email content.<br>For enterprise customers, the response will also include the customer_id and reference_id that were submitted with the test.

## Request body

- GithubComMailgunEmailpreviewClientsPreviewCreateTestRequest
  - `subject` string, required
  - `html` string
  - `mime` string
  - `url` string
  - `transfer_encoding` string
  - `charset` string
  - `reference_id` string
  - `customer_id` string
  - `clients` string[]
  - `image_blocking` boolean
  - `headers` object
  - `spam` object, nullable
    - `test_method` string
    - `from_address` string
    - `key` string
    - `smtp_info` object, nullable
      - `host` string
      - `port` integer
      - `secure` string
      - `username` string
      - `password` string
  - `content_checking` GithubComMailgunEmailpreviewClientsPreviewTestRequestContentChecking
    - `link_validation` boolean: Enable comprehensive link analysis
    - `image_validation` boolean: Enable comprehensive image analysis
    - `accessibility` boolean: Enable comprehensive accessibility analysis
    - `code_analysis` boolean: Enable comprehensive code analysis of the email content to detect HTML and CSS features and provides a compatibility report across major email clients.
  - `user_id` string
  - `folder_id` string
  - `project_name` string

## Response `200`

A 200 response

- GithubComMailgunEmailpreviewClientsPreviewCreateTestResponse
  - `id` string
  - `reference_id` string
  - `customer_id` string
  - `spam` object, nullable
    - `key` string
    - `address_list` string[]
  - `warnings` GithubComMailgunEmailpreviewClientsPreviewWarning[]
    - `name` string
    - `message` string
  - `content_checking` GithubComMailgunEmailpreviewClientsPreviewContentCheckingResult
    - `link_validation` GithubComMailgunEmailpreviewClientsInspectInspectDtoRepsponse
      - `items` GithubComMailgunEmailpreviewClientsInspectItem
        - `id` string
        - `links` GithubComMailgunEmailpreviewClientsInspectLinks
          - `self` string
      - `errors` GithubComMailgunEmailpreviewClientsInspectErrorDetail[]
        - `status` string
        - `title` string
        - `detail` string
    - `image_validation` GithubComMailgunEmailpreviewClientsInspectInspectDtoRepsponse
      - `items` GithubComMailgunEmailpreviewClientsInspectItem
        - `id` string
        - `links` GithubComMailgunEmailpreviewClientsInspectLinks
          - `self` string
      - `errors` GithubComMailgunEmailpreviewClientsInspectErrorDetail[]
        - `status` string
        - `title` string
        - `detail` string
    - `accessibility` GithubComMailgunEmailpreviewClientsInspectInspectDtoRepsponse
      - `items` GithubComMailgunEmailpreviewClientsInspectItem
        - `id` string
        - `links` GithubComMailgunEmailpreviewClientsInspectLinks
          - `self` string
      - `errors` GithubComMailgunEmailpreviewClientsInspectErrorDetail[]
        - `status` string
        - `title` string
        - `detail` string
    - `code_analysis` GithubComMailgunEmailpreviewClientsInspectCodeAnalysisResponse
      - `meta` object, nullable
      - `items` GithubComMailgunEmailpreviewClientsInspectCodeAnalysisItem, required
        - `id` string, required
        - `links` GithubComMailgunEmailpreviewClientsInspectLinks, required
          - `self` string

## Other responses

- `400`: A 400 response
- `401`: A 401 response
- `500`: A 500 response
- `default`: A default response

---

[API](https://skmtc.dev/mailgun/apis/email-preview-api.md) - [All operations](https://skmtc.dev/mailgun/apis/email-preview-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mailgun/apis/email-preview-api/revisions/c8a18f02bc8b?raw)
