{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lettera-dev/json-schema/lettera-dev-inbox-message-schema.json",
  "title": "InboxMessage",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/lettera-dev-api-openapi.json#/components/schemas/InboxMessage",
  "type": "object",
  "required": [
    "id",
    "from",
    "from_handle",
    "from_word_name",
    "body",
    "content_hash",
    "signature",
    "in_reply_to",
    "content_type",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64"
    },
    "from": {
      "type": "string",
      "description": "sender address (base58 public key)"
    },
    "from_handle": {
      "type": "string"
    },
    "body": {
      "description": "the message body, arbitrary JSON"
    },
    "content_hash": {
      "type": "string",
      "description": "hex SHA-256 of the body's canonical JSON (RFC 8785: sorted keys, no insignificant whitespace)"
    },
    "signature": {
      "type": "string",
      "description": "standard base64 of the sender's 64-byte Ed25519 signature over canonical_string. Always present on messages sent after the provenance migration."
    },
    "canonical_string": {
      "type": [
        "string",
        "null"
      ],
      "description": "the exact canonical string the sender signed (lettera:v1:POST:/v1/messages:<body_sha256>:<ts>). null only for legacy rows that predate the provenance migration. Recipients verify the sender with ed25519_verify(canonical_string, signature, from)."
    },
    "in_reply_to": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "the message id this replies to, or null. Deliberately not a foreign key: a dangling id is documented behaviour (the parent expired within its 30-day window), not an error. Recipients must treat a missing parent gracefully."
    },
    "content_type": {
      "type": "string",
      "enum": [
        "text",
        "json"
      ],
      "description": "how to interpret body: 'text' (schemaless convention) or 'json' (body is a JSON document)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "from_word_name": {
      "type": "string",
      "description": "sender's permanent three-word name"
    }
  }
}