Messages

Removes extra information from structured messages.

Note: Nylas removes all extra information, such as HTML script and style tags, regardless of the configuration.

put/v3/grants/{grant_id}/messages/clean

Request

  • Base URL
    https://api.us.nylas.com
  • Auth
    • HTTP bearer
    • or HTTP bearer

Query parameters

selectstring

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.

shared_fromstring

(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.

Request body

message_idstring[]

An array of IDs for the messages Nylas will clean.

ignore_linksboolean

If true, removes link-related tags (<a>) from the message while keeping the text.

ignore_imagesboolean

If true, removes images from the message.

images_as_markdownboolean

If true, converts images in the message to Markdown. Can't be false when html_as_markdown is true.

ignore_tablesboolean

If true, removes table-related tags (<table>, <th>, <td>, <tr>) from the message while keeping rows.

remove_conclusion_phrasesboolean

If true, removes phrases such as "Best" and "Regards" from the message signature.

html_as_markdownboolean

This property is in beta. If true, converts the message to Markdown. Can't be true when images_as_markdown is false.

Example request

{
  "message_id": [
    "18df98cadcc8534a"
  ],
  "ignore_links": true,
  "ignore_images": true,
  "images_as_markdown": true,
  "ignore_tables": true,
  "remove_conclusion_phrases": true
}

Response

Clean message response

request_idstring

The request ID.

Example response

{
  "data": [
    {
      "attachments": [
        {
          "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
        }
      ],
      "bcc": [
        {
          "name": "Jon Snow",
          "email": "jon.snow@example.com"
        }
      ],
      "body": "Hello, I just sent a message using Nylas!",
      "cc": [
        {
          "name": "Jon Snow",
          "email": "jon.snow@example.com"
        }
      ],
      "date": 1635355739,
      "folders": [
        "8l6c4d11y1p4dm4fxj52whyr9",
        "d9zkcr2tljpu3m4qpj7l2hbr0"
      ],
      "from": [
        {
          "name": "Jon Snow",
          "email": "jon.snow@example.com"
        }
      ],
      "grant_id": "41009df5-bf11-4c97-aa18-b285b5f2e386",
      "headers": [
        {
          "name": "Date",
          "value": "Thu, 15 Aug 2024 00:59:58 +0000 (UTC)"
        }
      ],
      "id": "5d3qmne77v32r8l4phyuksl2x, nyla@example.com",
      "in_reply_to": "<b0582d2c-816d-42a4-9ff8-46073170d827@me.com>",
      "object": "message",
      "reply_to": [
        {
          "name": "Jon Snow",
          "email": "jon.snow@example.com"
        }
      ],
      "snippet": "You have been invited to the following event. Welcome! WhenThu Oct 28, 2021\n7am - 8am Eastern Time - Toronto Joining info",
      "subject": "Nylas Send v3 Email",
      "thread_id": "1t8tv3890q4vgmwq6pmdwm8qgsaer",
      "to": [
        {
          "name": "Jon Snow",
          "email": "jon.snow@example.com"
        }
      ],
      "tracking_options": {
        "opens": true,
        "thread_replies": true,
        "links": true,
        "label": "Tracking test"
      },
      "unread": true,
      "conversation": "Hello, I just sent a message using Nylas!"
    }
  ]
}

Changes

    • breaking

      the response's body type changed from no type to object for status

    • info

      removed subschema #2 from the response body allOf list for the response status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property / to the response with the status