MJML API API Reference

The only API to provide responsive email as a service. The MJML API is the ideal way to integrate MJML in your app and seamlessly generate responsive emails.

API Endpoint
https://api.mjml.io/v1
Contact: hi@mjml.io
Schemes: https
Version: 1.0.0

Authentication

basicAuth

description
Each account is granted one Application ID with two API keys. The Application ID acts as a username, the API keys act as a password. The Public Key should be used when calling the MJML API from a web browser while the Secret Key should be used from a back-end application

Paths

Render MJML to HTML

POST /render

The MJML markup to transpile to responsive HTML (can be passed in the string as XML or JSON).

Request Example
{
  "mjml": "string"
}
200 OK

Returns a JSON object containing the rendered HTML along with the MJML markup used, the MJML version used to transpile and potential errors in the MJML markup.

400 Bad Request

Sending invalid JSON or wrong parameters will return a 400 Bad Request response.

401 Unauthorized

Authenticating with invalid credentials will return a 401 Unauthorized response.

403 Forbidden

Trying to make a call unauthorised with the credentials used will return a 403 Forbidden response.

500 Internal Server Error

When an unknow error occurs, the API will return a 500 Internal Error response.

Response Example (200 OK)
{
  "errors": "array",
  "html": "string",
  "mjml": "string",
  "mjml_version": "string"
}
Response Example (400 Bad Request)
{
  "message": "string",
  "request_id": "string",
  "started_at": "string(date-time)"
}
Response Example (401 Unauthorized)
{
  "message": "string",
  "request_id": "string",
  "started_at": "string(date-time)"
}
Response Example (403 Forbidden)
{
  "message": "string",
  "request_id": "string",
  "started_at": "string(date-time)"
}
Response Example (500 Internal Server Error)
{
  "message": "string",
  "request_id": "string",
  "started_at": "string(date-time)"
}

Models

Error: object

request_id: string
started_at: string (date-time)
message: string

mjml_error: object

message: string
tagName: string
formattedMessage: string
line: integer

render_mjml: object

mjml: string

The MJML input to transpile into responsive HTML

Reply: object

html: string

The responsive HTML transpiled from the MJML input

mjml: string

The MJML input to transpile into responsive HTML

mjml_version: string

The version of MJML used by the API to transpile

errors: object[]