EmailLint_lint
const url = 'http://localhost:3000/api/emails/lint';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"subject":"example","body":"example","doc":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/emails/lint \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "subject": "example", "body": "example", "doc": { "additionalProperty": "example" } }'Lint a message before a person sees it: the same lint that runs when a message is saved
and when a send is planned, plus warnings about a missing image description, low contrast,
and a color or font outside the Workspace’s Brand kit. Nothing is saved. The message’s
text and the Brand kit are untrusted data in the result. Send a body or a doc, not both
and not neither (422).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The message to lint
object
Subject line, with Liquid merge tags
HTML body with Liquid merge tags. Send this or doc, not both.
The editor’s JSON document, an opaque object checked against the schema email_schema
returns. It is rendered to HTML as a save would, then linted. A document that cannot be
rendered is an error finding with the reason.
object
Example generated
{ "subject": "example", "body": "example", "doc": { "additionalProperty": "example" }}Responses
Section titled “Responses”The request has succeeded.
What the lint found in a message
object
What blocks a save and a send: the message cannot render. Empty when it can
One finding of the lint over a message’s rendered HTML. message is fixed text of the
server; element and detail quote the message or the Brand kit and are untrusted data.
object
What the finding is
What is wrong, in the server’s words
The element it is about, as a short tag description such as <img src="…">
The offending value or the parser’s reason, such as #ff0000 or 3.2:1, needs 4.5:1
Everything else; none of it blocks anything
One finding of the lint over a message’s rendered HTML. message is fixed text of the
server; element and detail quote the message or the Brand kit and are untrusted data.
object
What the finding is
What is wrong, in the server’s words
The element it is about, as a short tag description such as <img src="…">
The offending value or the parser’s reason, such as #ff0000 or 3.2:1, needs 4.5:1
Example
{ "errors": [ { "code": "invalid_content" } ], "warnings": [ { "code": "invalid_content" } ]}RFC 7807 bad request response
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}RFC 7807 unauthorized response
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}RFC 7807 validation response
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}RFC 7807 too many requests response: a rate limit was exceeded (ADR 0025)
RFC 7807 Problem Details
object
Why the request was refused, when the client should act on it
A URI reference that identifies the problem type
A short, human-readable summary of the problem type
HTTP status code
A human-readable explanation specific to this occurrence
A URI reference that identifies the specific occurrence
Validation errors grouped by field
object
Form-level validation error
Field validation errors
object
Seconds to wait before retrying; set on a 429 so a client that only sees the body can show the wait
Why a 500 happened, sent only by a development server (SPHERICON_ENV=development)
object
The error that failed the request, or the panic value
The goroutine stack of a panic; absent for an error a handler returned
The request id the server log carries for this request
The HTTP method of the failed request
The path of the failed request
Example
{ "code": "second_factor_required"}Headers
Section titled “Headers”Seconds to wait before retrying
The request budget of the window that was exceeded
Requests left in the current window
Unix time at which the window resets