- API reference
- Messages
- Clean messages
https://api.us.nylas.com/v3/grants/{grant_id}/messages/cleanClean messages
Removes extra information from structured messages.
Note: Nylas removes all extra information, such as HTML script and style tags, regardless
of the configuration.
Path parameters
Query parameters
Specify fields that you want Nylas to return, as a comma-separated list (for example,
select=id,updated_at). This allows you to receive only the portion of object data that you're
interested in. You can use select to optimize response size and reduce latency by limiting queries
to only the information that you need.
(Microsoft only) When provided, Nylas returns items that were shared from the specified email address. It also accepts grant ID. This parameter only accepts single email address or grant ID. Check out the Shared folders guide for more information.
["18df98cadcc8534a"]ignore_linksbooleanIf true, removes link-related tags (<a>) from the message while keeping the text.
truetrueimages_as_markdownbooleanIf true, converts images in the message to
Markdown. Can't be false when html_as_markdown
is true.
truetrueignore_tablesbooleanIf true, removes table-related tags (<table>, <th>, <td>, <tr>) from the message
while keeping rows.
truetrueremove_conclusion_phrasesbooleanIf true, removes phrases such as "Best" and "Regards" from the message signature.
truetruehtml_as_markdownbooleanThis property is in beta. If true, converts the message to
Markdown. Can't be true when
images_as_markdown is false.
falsefalseattachmentsarray<object>An array of Attachment objects. For Google, linked Google Drive files are not included. For Microsoft, linked OneDrive files are not included.
[{"content_disposition":"attachment","content_type":"text/calendar","id":"4kj2jrcoj9ve5j9yxqz5cuv98","size":1708},{"content_disposition":"attachment","content_type":"application/ics","filename":"invite.ics","id":"70jcsv367jaiavt4njeu4xswg","size":1708}]content_typestringThe MIME type of the attachment, used by the email client to determine how to display the attachment. If you don't provide a type, Nylas infers it from the file name.
The value of this field is exactly the same as the email attachment's Content-Type header.
The provider might set additional parameters, such as name and charset.
Nylas returns an empty content_type field if an attachment file name contains non-ASCII characters (for example, accented characters like ü). This is because Google can't detect its content type.
"image/png; name=\"pic.png\"""41009df5-bf11-4c97-aa18-b285b5f2e386"content_idstring(Inline attachments only) The alphanumeric cid from the <img> tag in the message's HTML. For
example, you might see something like <img src=\"cid:ce9b9547-9eeb-43b2-ac4e-58768bdf04e4\"> in
the message body.
Sometimes, the content_id value is contained in angle brackets (for example,
<ce9b9547-9eeb-43b2-ac4e-58768bdf04e4>).
"ce9b9547-9eeb-43b2-ac4e-58768bdf04e4"bodystringThe body of the message as either plain-text or HTML content. If the message has both plain-text and HTML, Nylas returns the HTML version.
"Hello, I just sent a message using Nylas!"dateintegerUnix timestamp in seconds that represents when the mail server received the message. This might be
different from the unified Date header in a raw Message object.
1635355739foldersarray<string>The IDs of the folders that the message appears in. Microsoft messages can be in a single folder only. Google allows a single message to appear in multiple folders.
["8l6c4d11y1p4dm4fxj52whyr9","d9zkcr2tljpu3m4qpj7l2hbr0"]"41009df5-bf11-4c97-aa18-b285b5f2e386"headersarray<object>An array of key-value pairs that contain the message headers. Nylas returns this field when you
set the fields query parameter to either include_headers or include_basic_headers.
fields=include_headers: Returns the full set of headers on the message.fields=include_basic_headers: Returns only the three RFC threading headers (Message-ID,In-Reply-To,References). Use this option when you only need to track message identity and thread relationships — payload size is significantly smaller thaninclude_headers.
A single message can sometimes have multiple headers with the same key name. Nylas adds all of
the headers to the headers array without merging or de-duplicating the data. When the headers
contain encoded data, Nylas adds it to the headers array without decoding it. If you need the
decoded data, you need to build decoding logic into your project.
Some headers might contain raw MIME information (for example,
=?Windows-1252?Q?Re:_Candidature_de_Mme_Leyah_Miller?=).
idstringA globally unique object identifier for Microsoft accounts. An email address for Google accounts.
"5d3qmne77v32r8l4phyuksl2x, [email protected]"in_reply_tostring(EWS only) The ID of the message that this message replies to. This ID is the same as the
In-Reply-To header.
"<[email protected]>"snippetstringA short snippet (the first 100 characters, with HTML tags removed) of the message body. This is useful for displaying a preview of the message.
"You have been invited to the following event. Welcome! WhenThu Oct 28, 2021\n7am - 8am Eastern Time - Toronto Joining info"starredbooleanIf true, shows that the message has been starred by the user. For EWS, this is only supported
on Microsoft Exchange 2010 or later.
falsethread_idstringA reference to the parent Thread object. Every message is associated with a thread, whether that
thread contains one message or many. If the message is new, Nylas assigns a thread_id to it.
"1t8tv3890q4vgmwq6pmdwm8qgsaer"Rate limited. The provider or Nylas throttled the request. If a provider throttles a request and
says how long to wait, the Retry-After header gives that number of seconds. When the header
is missing, retry with exponential backoff. See
429 rate limit errors by provider.