{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/callnode-io/json-schema/callnode-io-email-message-schema.json",
  "title": "EmailMessage",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/callnode-io-openapi.yml#/components/schemas/EmailMessage",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "sent",
        "delivered",
        "delayed",
        "bounced",
        "complained",
        "failed"
      ],
      "description": "`queued` only for the moment the message is being handed over (a list can catch it); the send answers `sent` or `failed`."
    },
    "from": {
      "type": "string"
    },
    "to": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "cc": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "bcc": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "recipientCount": {
      "type": "integer",
      "description": "What is billed - to + cc + bcc."
    },
    "subject": {
      "type": "string"
    },
    "messageId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The RFC 5322 Message-ID of the message as sent."
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "The receiving server's reason on a bounce or failure."
    },
    "costUsd": {
      "type": [
        "number",
        "null"
      ]
    },
    "chargeStatus": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "charged",
        "skipped",
        "insufficient_balance",
        "test",
        "error",
        null
      ]
    },
    "statusWebhookUrl": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "tags": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      }
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ]
    },
    "testMode": {
      "type": "boolean"
    },
    "source": {
      "type": "string",
      "enum": [
        "api",
        "dashboard",
        "mcp"
      ]
    },
    "sizeBytes": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Body plus decoded attachments."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "sentAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "deliveredAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lastEventAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "events": {
      "type": "array",
      "description": "On the retrieve response only, oldest first.",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "estimatedCost": {
      "type": [
        "number",
        "null"
      ],
      "description": "On the send response only - what this message cost at its place on the volume curve."
    },
    "billing": {
      "type": [
        "object",
        "null"
      ],
      "description": "On the send response only - how the message was priced.",
      "properties": {
        "recipients": {
          "type": "integer",
          "description": "to + cc + bcc."
        },
        "includedRecipients": {
          "type": "integer",
          "description": "How many of them fell inside the plan's included allowance this period."
        },
        "billableRecipients": {
          "type": "integer"
        },
        "perRecipientUsd": {
          "type": "number",
          "description": "The marginal rate applied."
        },
        "estimatedCostUsd": {
          "type": "number",
          "description": "The amount charged (the quote",
          "on a test key).": null
        },
        "includedRemaining": {
          "type": "integer",
          "description": "Included recipients left this period after this message."
        },
        "periodEndsAt": {
          "type": "string",
          "format": "date-time",
          "description": "When the volume window resets."
        }
      }
    },
    "replay": {
      "type": "boolean",
      "description": "On the send response only - true when an idempotency key replayed an earlier send."
    }
  }
}