{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shipmail-to/json-schema/shipmail-to-newsletter-schema.json",
  "title": "Newsletter",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shipmail-to-openapi.json#/components/schemas/Newsletter",
  "type": "object",
  "required": [
    "object",
    "id",
    "audience_id",
    "sender_identity_id",
    "newsletter_domain_id",
    "name",
    "status",
    "archive_visibility",
    "publish_target",
    "view_in_browser",
    "feed_entry_url",
    "styling_mode",
    "track_engagement",
    "add_utm_tags",
    "opened_count",
    "clicked_count",
    "feed_click_count",
    "preflight_status",
    "published_at",
    "archive_url",
    "created_at",
    "updated_at",
    "send_limit",
    "held_count",
    "subject_b",
    "subject_test_winner"
  ],
  "properties": {
    "object": {
      "type": "string",
      "const": "newsletter"
    },
    "id": {
      "type": "string"
    },
    "audience_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "sender_identity_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "newsletter_domain_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "name": {
      "type": "string"
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "preview_text": {
      "type": [
        "string",
        "null"
      ]
    },
    "from_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "from_address": {
      "type": "string"
    },
    "reply_to_address": {
      "type": [
        "string",
        "null"
      ]
    },
    "blocks": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/NewsletterBlock"
      },
      "description": "Structured blocks this draft was authored from. body_html and body_text are rendered from these blocks on every draft save. Null for newsletters sent before blocks existed."
    },
    "body_html": {
      "type": [
        "string",
        "null"
      ],
      "description": "Rendered email HTML, derived from blocks for drafts. Read-only."
    },
    "body_text": {
      "type": [
        "string",
        "null"
      ],
      "description": "Plain-text body, derived from blocks unless a manual override was set. When a block has a visibility, this is the website text, and the override is used only in the email. Read-only."
    },
    "status": {
      "type": "string",
      "description": "`in_review`: Shipmail's content check holds the newsletter until a person at Shipmail looks at it. It returns to `scheduled` and goes out, or to `draft` with an email to the owners when it cannot be sent. Cancel still works.",
      "enum": [
        "draft",
        "imported",
        "pending_approval",
        "approved",
        "scheduled",
        "in_review",
        "sending",
        "paused",
        "sent",
        "published",
        "cancelled",
        "failed"
      ]
    },
    "archive_visibility": {
      "type": "string",
      "enum": [
        "private",
        "public"
      ],
      "description": "public: the issue is listed on the audience's newsletter website and in its Atom feed. A website issue is always listed and an email issue never is. The View in browser link is view_in_browser."
    },
    "publish_target": {
      "type": "string",
      "enum": [
        "email_and_website",
        "email",
        "website"
      ],
      "description": "Where the newsletter goes. email_and_website (default) sends it, and lists it on the audience's newsletter website and Atom feed when archive_visibility is public. email is never listed on the website, sitemap or feed. website is published on the audience's newsletter website and feed at the scheduled time without any email, uses no sends, and ends in the published status; the audience needs its website or its feed on."
    },
    "view_in_browser": {
      "type": "boolean",
      "description": "Whether the email carries a View in browser link to the issue's own page (/n/<token>). Independent of the website and the feed. A website-only issue sends no email, so it never has the link."
    },
    "feed_entry_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "Optional http(s) Atom entry destination. Feed readers link the newsletter title here instead of to its Shipmail web archive, including when the archive is private."
    },
    "styling_mode": {
      "type": "string",
      "enum": [
        "styled",
        "plain"
      ],
      "default": "styled",
      "description": "styled applies Shipmail's email theme. plain sends your HTML without injected styles, width, or centering, so the reader's email client styles it."
    },
    "track_engagement": {
      "type": "boolean",
      "default": false,
      "description": "Whether this newsletter tracks opens and clicks."
    },
    "add_utm_tags": {
      "type": "boolean",
      "default": false,
      "description": "Whether this newsletter adds UTM tags to its links. Adds utm_source=shipmail, utm_medium (email or feed) and utm_campaign (a slug of the subject) to the newsletter's http and https links. Links that already carry a utm_ parameter, links with a merge tag in the host, and Shipmail's own unsubscribe and archive links are left alone. The web archive is never tagged."
    },
    "opened_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unique recipients with at least one counted open. Opens that Apple Mail Privacy Protection preloads are not counted. Null when track_engagement is false."
    },
    "clicked_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unique recipients who clicked at least one tracked link, excluding clicks attributed to link scanners. Null when track_engagement is false."
    },
    "feed_click_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Clicks on this newsletter's entry in the audience's Atom feed, its title link included. Feed clicks are anonymous, so every click counts, not unique readers; feed readers and link scanners are excluded. Null when track_engagement is false."
    },
    "send_limit": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The limit the newsletter was scheduled with: only this many of the most engaged subscribers went first. Null sends to everyone."
    },
    "held_count": {
      "type": "integer",
      "description": "Subscribers held past send_limit. Send them the newsletter with POST /newsletters/{id}/send-more."
    },
    "subject_b": {
      "type": [
        "string",
        "null"
      ],
      "description": "A second subject tested against subject. Requires track_engagement."
    },
    "subject_test_percent": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The share of subscribers each subject goes to first, from 1 to 25. Null when there is no subject test."
    },
    "subject_test_hours": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Hours after both test slices finish before the subject with more human clicks goes to the rest, from 1 to 72."
    },
    "subject_test_winner": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "a",
        "b",
        null
      ],
      "description": "a is subject, b is subject_b. Null until the test decides. A tie keeps a."
    },
    "subject_test_decided_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "preflight_status": {
      "type": "string",
      "enum": [
        "not_run",
        "passed",
        "warning",
        "failed"
      ]
    },
    "preflight_results": {
      "type": "object",
      "additionalProperties": true
    },
    "send_window_hours": {
      "type": "integer"
    },
    "send_rate_per_hour": {
      "type": "integer"
    },
    "recipient_count": {
      "type": "integer"
    },
    "sent_count": {
      "type": "integer"
    },
    "delivered_count": {
      "type": "integer"
    },
    "bounced_count": {
      "type": "integer"
    },
    "complained_count": {
      "type": "integer"
    },
    "failed_count": {
      "type": "integer"
    },
    "skipped_count": {
      "type": "integer"
    },
    "scheduled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "approved_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "published_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Stable first-publication timestamp."
    },
    "archive_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "Canonical Shipmail public archive URL."
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "cancelled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "last_test_sent_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_test_recipient": {
      "type": [
        "string",
        "null"
      ]
    },
    "content_changed_since_test_send": {
      "type": "boolean"
    }
  },
  "$defs": {
    "NewsletterBlock": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "text"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "heading"
            },
            "text": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10000,
              "description": "Heading text."
            },
            "level": {
              "type": "integer",
              "enum": [
                1,
                2,
                3
              ],
              "default": 2
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "body"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "paragraph"
            },
            "body": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10000,
              "description": "Bare text or sanitized inline HTML. Allowed tags: a, b, br, code, em, i, p, s, span, strong, and u. Use p or br for line breaks and HTML entities for literal tag-like text."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "items"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "list"
            },
            "ordered": {
              "type": "boolean",
              "default": false
            },
            "items": {
              "type": "array",
              "minItems": 1,
              "maxItems": 50,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000,
                "description": "Bare text or sanitized inline HTML. Allowed tags: a, b, br, code, em, i, p, s, span, strong, and u."
              }
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "body"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "callout"
            },
            "title": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 10000,
              "description": "Optional callout title."
            },
            "body": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10000,
              "description": "Bare text or sanitized inline HTML. Allowed tags: a, b, br, code, em, i, p, s, span, strong, and u. Use p or br for line breaks."
            },
            "variant": {
              "type": "string",
              "enum": [
                "accent",
                "info",
                "warning",
                "success"
              ],
              "default": "accent"
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "label",
            "url"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "button"
            },
            "label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120,
              "description": "Button label."
            },
            "url": {
              "type": "string",
              "maxLength": 2048,
              "description": "Absolute http, https, or mailto URL."
            },
            "align": {
              "type": "string",
              "enum": [
                "left",
                "center",
                "right"
              ],
              "default": "left",
              "description": "Horizontal alignment of the button."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "url",
            "alt"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "image"
            },
            "url": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048,
              "description": "Hosted HTTPS image URL."
            },
            "alt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300,
              "description": "Image alt text."
            },
            "align": {
              "type": "string",
              "enum": [
                "left",
                "center",
                "right"
              ],
              "default": "left",
              "description": "Horizontal alignment of the image and its caption."
            },
            "link_url": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 2048,
              "description": "Optional absolute http, https, or mailto image link."
            },
            "caption": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 10000,
              "description": "Optional image caption."
            },
            "caption_url": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 2048,
              "description": "Optional absolute http, https, or mailto caption link."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "video_url",
            "thumbnail_url",
            "label"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "video"
            },
            "video_url": {
              "type": "string",
              "maxLength": 2048,
              "description": "Absolute hosted video URL. Emails render this as a linked thumbnail."
            },
            "thumbnail_url": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048,
              "description": "Hosted HTTPS image thumbnail URL."
            },
            "label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 160,
              "description": "Video link label."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "left",
            "right"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "columns"
            },
            "ratio": {
              "type": "string",
              "enum": [
                "50-50",
                "33-67",
                "67-33"
              ],
              "default": "50-50"
            },
            "left": {
              "type": "object",
              "additionalProperties": false,
              "description": "Left column content. Include at least one heading, body, image, or CTA field.",
              "allOf": [
                {
                  "anyOf": [
                    {
                      "required": [
                        "title"
                      ],
                      "properties": {
                        "title": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    {
                      "required": [
                        "body"
                      ],
                      "properties": {
                        "body": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    {
                      "required": [
                        "image_url"
                      ],
                      "properties": {
                        "image_url": {
                          "type": "string",
                          "format": "uri",
                          "minLength": 1
                        }
                      }
                    },
                    {
                      "required": [
                        "cta_label",
                        "cta_url"
                      ],
                      "properties": {
                        "cta_label": {
                          "type": "string",
                          "minLength": 1
                        },
                        "cta_url": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  ]
                },
                {
                  "if": {
                    "required": [
                      "cta_label"
                    ],
                    "properties": {
                      "cta_label": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "cta_url"
                    ],
                    "properties": {
                      "cta_url": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "cta_url"
                    ],
                    "properties": {
                      "cta_url": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "cta_label"
                    ],
                    "properties": {
                      "cta_label": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  }
                }
              ],
              "properties": {
                "title": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 10000,
                  "description": "Optional column heading."
                },
                "body": {
                  "type": "string",
                  "maxLength": 10000,
                  "description": "Optional bare text or sanitized inline HTML. Allowed tags: a, b, br, code, em, i, p, s, span, strong, and u. Use p or br for line breaks."
                },
                "image_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uri",
                  "maxLength": 2048,
                  "description": "Optional hosted HTTPS image URL."
                },
                "image_alt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 10000,
                  "description": "Alt text for image_url."
                },
                "image_fit": {
                  "type": "string",
                  "enum": [
                    "natural",
                    "contain",
                    "cover"
                  ],
                  "default": "natural",
                  "description": "Optional image sizing. Natural preserves the source ratio; contain shows the whole image in a 4:3 frame; cover crops to fill a 4:3 frame."
                },
                "cta_label": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 10000,
                  "description": "Optional call-to-action label."
                },
                "cta_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 2048,
                  "description": "Optional http, https, or mailto call-to-action URL."
                }
              }
            },
            "right": {
              "type": "object",
              "additionalProperties": false,
              "description": "Right column content. Include at least one heading, body, image, or CTA field.",
              "allOf": [
                {
                  "anyOf": [
                    {
                      "required": [
                        "title"
                      ],
                      "properties": {
                        "title": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    {
                      "required": [
                        "body"
                      ],
                      "properties": {
                        "body": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    {
                      "required": [
                        "image_url"
                      ],
                      "properties": {
                        "image_url": {
                          "type": "string",
                          "format": "uri",
                          "minLength": 1
                        }
                      }
                    },
                    {
                      "required": [
                        "cta_label",
                        "cta_url"
                      ],
                      "properties": {
                        "cta_label": {
                          "type": "string",
                          "minLength": 1
                        },
                        "cta_url": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    }
                  ]
                },
                {
                  "if": {
                    "required": [
                      "cta_label"
                    ],
                    "properties": {
                      "cta_label": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "cta_url"
                    ],
                    "properties": {
                      "cta_url": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "cta_url"
                    ],
                    "properties": {
                      "cta_url": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "then": {
                    "required": [
                      "cta_label"
                    ],
                    "properties": {
                      "cta_label": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  }
                }
              ],
              "properties": {
                "title": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 10000,
                  "description": "Optional column heading."
                },
                "body": {
                  "type": "string",
                  "maxLength": 10000,
                  "description": "Optional bare text or sanitized inline HTML. Allowed tags: a, b, br, code, em, i, p, s, span, strong, and u. Use p or br for line breaks."
                },
                "image_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uri",
                  "maxLength": 2048,
                  "description": "Optional hosted HTTPS image URL."
                },
                "image_alt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 10000,
                  "description": "Alt text for image_url."
                },
                "image_fit": {
                  "type": "string",
                  "enum": [
                    "natural",
                    "contain",
                    "cover"
                  ],
                  "default": "natural",
                  "description": "Optional image sizing. Natural preserves the source ratio; contain shows the whole image in a 4:3 frame; cover crops to fill a 4:3 frame."
                },
                "cta_label": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 10000,
                  "description": "Optional call-to-action label."
                },
                "cta_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 2048,
                  "description": "Optional http, https, or mailto call-to-action URL."
                }
              }
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "items"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "link_list"
            },
            "title": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 10000,
              "description": "Optional link list title."
            },
            "items": {
              "type": "array",
              "minItems": 1,
              "maxItems": 20,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "label",
                  "url"
                ],
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 180,
                    "description": "Link label."
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "Absolute http, https, or mailto URL."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000,
                    "description": "Optional description shown under the link."
                  }
                }
              }
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "body"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "quote"
            },
            "body": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10000,
              "description": "Bare text or sanitized inline HTML. Allowed tags: a, b, br, code, em, i, p, s, span, strong, and u. Use p or br for line breaks."
            },
            "cite": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 10000,
              "description": "Optional quote citation."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "divider"
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "spacer"
            },
            "height": {
              "type": "integer",
              "minimum": 8,
              "maximum": 80,
              "default": 24
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "code"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "code"
            },
            "code": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10000,
              "description": "Code text."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "event_id"
          ],
          "description": "An event's card: title, date and time in the event's time zone, location, and places left when capped, with Going and Not going buttons. Each email recipient gets their own answer links; the website, archive and test sends link to the event's public page, or show no buttons when the public page is off. Only an event of the newsletter's own organization and audience renders; any other event_id renders nothing. Events are created in the dashboard.",
          "properties": {
            "type": {
              "type": "string",
              "const": "event"
            },
            "event_id": {
              "type": "string",
              "pattern": "^nwsevt_[0-9a-z]{24}$",
              "description": "A newsletter event (nwsevt_)."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "html"
          ],
          "properties": {
            "type": {
              "type": "string",
              "const": "custom_html"
            },
            "html": {
              "type": "string",
              "minLength": 1,
              "maxLength": 250000,
              "description": "Custom email-safe HTML fragment."
            },
            "visibility": {
              "$ref": "#/$defs/NewsletterBlockVisibility"
            }
          }
        }
      ],
      "description": "Structured newsletter block. paragraph.body, quote.body, callout.body, list items, and column bodies accept bare text or restricted inline HTML. Shipmail sanitizes these values when it stores the blocks and renders email-safe HTML and text. Any block may carry a visibility that limits it to email or the website, or to readers in (or not in) one saved segment of the issue's audience."
    },
    "NewsletterBlockVisibility": {
      "type": "object",
      "additionalProperties": false,
      "description": "Where the block shows and to which readers. Omit it to show the block everywhere. A visibility that limits nothing is dropped when the blocks are stored. The website, archive and feed show a block as a reader in no segment sees it. Segment membership is fixed when the send is scheduled. Welcome emails accept channel only. A web block cannot use segment_rule in, because website visitors are in no segment; web with not_in is stored as web alone.",
      "properties": {
        "channel": {
          "type": "string",
          "enum": [
            "all",
            "email",
            "web"
          ],
          "default": "all",
          "description": "all shows the block in the email and on the website; email hides it on the website; web hides it in the email."
        },
        "segment_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "maxLength": 64,
          "default": null,
          "description": "A newsletter segment (nwsseg_) of the issue's audience. Null shows the block to every reader."
        },
        "segment_rule": {
          "type": "string",
          "enum": [
            "in",
            "not_in"
          ],
          "default": "in",
          "description": "in shows the block only to readers in the segment; not_in shows it to everyone else. Ignored without segment_id."
        }
      }
    }
  }
}