{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/nylas/refs/heads/main/json-schema/nylas-message-created-cleaned.schema.json",
  "title": "Nylas message.created.cleaned notification object",
  "description": "Sent when a new message is synced and the [Clean Conversations](/docs/v3/email/parse-messages/) feature is enabled for the application. The message `body` contains cleaned markdown content instead of the original HTML. This schema describes `data.object` inside the Nylas notification envelope.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The Nylas message ID."
    },
    "grant_id": {
      "type": "string",
      "description": "The grant ID that owns this message."
    },
    "object": {
      "type": "string",
      "description": "Always `message`.",
      "enum": [
        "message"
      ]
    },
    "thread_id": {
      "type": "string",
      "description": "The thread this message belongs to."
    },
    "subject": {
      "type": "string",
      "description": "The message subject line."
    },
    "from": {
      "type": "array",
      "description": "Sender information.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name of the sender."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Email address of the sender."
          }
        }
      }
    },
    "to": {
      "type": "array",
      "description": "Primary recipients.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      }
    },
    "cc": {
      "type": "array",
      "description": "CC recipients.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      }
    },
    "bcc": {
      "type": "array",
      "description": "BCC recipients.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      }
    },
    "reply_to": {
      "type": "array",
      "description": "Reply-to addresses.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      }
    },
    "date": {
      "type": "integer",
      "description": "Unix timestamp when the message was sent."
    },
    "body": {
      "type": "string",
      "description": "Cleaned markdown content of the message. Contains the original HTML when `cleaning_status` is `failed`."
    },
    "snippet": {
      "type": "string",
      "description": "A short plaintext preview of the message body."
    },
    "starred": {
      "type": "boolean",
      "description": "Whether the message is starred/flagged."
    },
    "unread": {
      "type": "boolean",
      "description": "Whether the message is unread."
    },
    "folders": {
      "type": "array",
      "description": "Folder names the message belongs to (e.g. `INBOX`, `SENT`).",
      "items": {
        "type": "string"
      }
    },
    "attachments": {
      "type": "array",
      "description": "Attachment metadata. Does not include file content.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Attachment ID. Use with the [Attachments API](/docs/reference/api/attachments/) to download."
          },
          "filename": {
            "type": "string",
            "description": "Original filename."
          },
          "content_type": {
            "type": "string",
            "description": "MIME type."
          },
          "size": {
            "type": "integer",
            "description": "Size in bytes."
          },
          "is_inline": {
            "type": "boolean",
            "description": "Whether the attachment is an inline image."
          },
          "content_id": {
            "type": "string",
            "description": "Content ID for inline attachments (used in HTML img tags). Only present for inline attachments."
          },
          "content_disposition": {
            "type": "string",
            "description": "Content-Disposition header value."
          }
        }
      }
    },
    "metadata": {
      "type": "object",
      "description": "Custom key-value metadata you attached when sending the message.",
      "additionalProperties": true
    },
    "cleaning_status": {
      "type": "string",
      "enum": [
        "success",
        "failed"
      ],
      "description": "Whether cleaning succeeded. `failed` indicates cleaning failed after retries and `body` contains the original HTML."
    },
    "cleaning_error": {
      "type": "string",
      "description": "Description of the cleaning error. Only present when `cleaning_status` is `failed`."
    }
  },
  "required": [
    "id",
    "grant_id",
    "object",
    "cleaning_status"
  ],
  "x-nylas-trigger": "message.created.cleaned",
  "x-nylas-category": "Messages",
  "x-provenance": {
    "method": "authored",
    "publisher": "Nylas",
    "source": "https://developer.nylas.com/docs/reference/notifications/messages/message-created-cleaned/",
    "derived_from": "nylas/developer.nylas.com@a7995fb6:src/_component-data/notification-schemas.json",
    "generated": "2026-09-28"
  },
  "examples": [
    {
      "attachments": [
        {
          "content_disposition": "attachment; filename=\"image.jpg\"",
          "content_id": "<CID>",
          "content_type": "image/jpeg; name=\"image.jpg\"",
          "filename": "image.jpg",
          "grant_id": "<NYLAS_GRANT_ID>",
          "id": "<ATTACHMENT_ID>",
          "is_inline": false,
          "size": 4860136
        }
      ],
      "bcc": [
        {
          "email": "leyah@example.com"
        }
      ],
      "body": "# Team Update\n\nHi everyone,\n\nHere are the key updates from this week:\n\n* Project Alpha launched successfully\n* New API endpoints are live in staging\n* Next sprint planning is on Monday\n\nLet me know if you have questions.",
      "cc": [
        {
          "email": "kaveh@example.com"
        }
      ],
      "cleaning_status": "success",
      "date": 1723821981,
      "folders": [
        "INBOX"
      ],
      "from": [
        {
          "email": "swag@example.com",
          "name": "Nylas Swag"
        }
      ],
      "grant_id": "<NYLAS_GRANT_ID>",
      "id": "<MESSAGE_ID>",
      "metadata": {
        "key1": "all-meetings",
        "key2": "on-site"
      },
      "object": "message",
      "reply_to": [],
      "snippet": "Hi everyone, Here are the key updates from this week.",
      "starred": false,
      "subject": "Team Update - Week of Aug 12",
      "thread_id": "<THREAD_ID>",
      "to": [
        {
          "email": "nyla@example.com"
        }
      ],
      "unread": true
    }
  ]
}