{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/senderkit-com/json-schema/senderkit-com-inbound-message-schema.json",
  "title": "InboundMessage",
  "description": "A received message, as returned by the message detail endpoint.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/senderkit-com-openapi.yaml#/components/schemas/InboundMessage",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Public inbound message ID."
    },
    "status": {
      "$ref": "#/$defs/InboundMessageStatus"
    },
    "channel": {
      "$ref": "#/$defs/Channel"
    },
    "address": {
      "type": [
        "string",
        "null"
      ],
      "description": "Canonical receiving address, or null for catch-all/unmatched mail."
    },
    "plusTag": {
      "type": [
        "string",
        "null"
      ]
    },
    "from": {
      "type": "object",
      "properties": {
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "to": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "cc": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "envelope": {
      "type": "object",
      "properties": {
        "from": {
          "type": [
            "string",
            "null"
          ]
        },
        "to": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "messageId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The mail's `Message-ID` header."
    },
    "inReplyTo": {
      "type": [
        "string",
        "null"
      ]
    },
    "text": {
      "type": [
        "string",
        "null"
      ]
    },
    "html": {
      "type": [
        "string",
        "null"
      ]
    },
    "strippedReply": {
      "type": [
        "string",
        "null"
      ],
      "description": "The plain-text reply with quoted history/signature stripped."
    },
    "truncated": {
      "type": "boolean",
      "description": "Whether the stored body was truncated."
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "attachments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "Zero-based index; matches the attachments-endpoint path segment."
          },
          "filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "contentType": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "description": "Authenticated API URL. Fetch it with an `Authorization: Bearer`\nheader carrying an API key with the `inbound` scope — this is\nnot a public/signed link.\n"
          }
        }
      }
    },
    "verdicts": {
      "type": "object",
      "description": "SES scanning verdicts (e.g. spam/virus/SPF/DKIM), as reported.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "sizeBytes": {
      "type": "integer"
    },
    "rawUrl": {
      "type": "string",
      "description": "Authenticated API URL for the raw RFC 822 source. Same auth\nrequirement as attachment `url`s.\n"
    },
    "receivedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Channel": {
      "type": "string",
      "enum": [
        "email",
        "sms",
        "push",
        "web-push"
      ]
    },
    "InboundMessageStatus": {
      "type": "string",
      "description": "`received` means the message was stored and the webhook/forward\npipeline ran; `dropped` means it arrived on a verified inbound domain\nbut matched no address (mail to an unknown local part); `quota_exceeded`\nmeans the workspace's inbound quota was hit — the full message row is\nstill stored, but the webhook/forward pipeline was skipped.\n",
      "enum": [
        "received",
        "dropped",
        "quota_exceeded"
      ]
    }
  }
}