{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bangermail-com/json-schema/bangermail-com-broadcast-schema.json",
  "title": "Broadcast",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bangermail-com-openapi.json#/components/schemas/Broadcast",
  "type": "object",
  "required": [
    "id",
    "name",
    "version",
    "broadcast_id",
    "product_id",
    "sender_address",
    "sending_blocker",
    "design",
    "managed_content",
    "subject",
    "sender_mailbox",
    "reply_mailbox",
    "design_version",
    "audience"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "product_id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "mailbox_id": {
      "type": "string",
      "format": "uuid"
    },
    "template_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "managed_content_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "managed_source_revision_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "managed_publication_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "managed_locales_snapshot": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "expires_after_seconds": {
      "type": [
        "integer",
        "null"
      ]
    },
    "status": {
      "type": "string"
    },
    "version": {
      "type": "integer"
    },
    "subject_variants": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "selected_subject_variant": {
      "type": "integer"
    },
    "content_overrides": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "audience_query": {
      "$ref": "#/$defs/CampaignAudience"
    },
    "audience_frozen_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "audience_recipient_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "audience_snapshot_sha256": {
      "type": [
        "string",
        "null"
      ]
    },
    "audience_snapshot_campaign_version": {
      "type": [
        "integer",
        "null"
      ]
    },
    "scheduled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "archived_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "stats": {
      "type": "object",
      "additionalProperties": true
    },
    "broadcast_id": {
      "type": "string",
      "format": "uuid"
    },
    "sender_address": {
      "type": [
        "string",
        "null"
      ]
    },
    "sending_blocker": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "code",
            "message"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "design": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "product_id": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string"
            },
            "subject": {
              "type": "string"
            },
            "body_text": {
              "type": "string"
            },
            "content": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "slots": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/TemplateSlot"
              }
            },
            "status": {
              "type": "string",
              "enum": [
                "active",
                "archived"
              ]
            },
            "origin": {
              "type": "string",
              "enum": [
                "person",
                "agent",
                "starter",
                "import"
              ]
            },
            "created_by_actor_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "campaign_id": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "message_kind": {
              "type": "string"
            },
            "starter_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "starter_version": {
              "type": [
                "integer",
                "null"
              ]
            },
            "version": {
              "type": "integer"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            },
            "updated_at": {
              "type": "string",
              "format": "date-time"
            },
            "body_html_url": {
              "type": "string",
              "format": "uri"
            },
            "body_html": {
              "type": [
                "string",
                "null"
              ]
            },
            "body_html_b2_key": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "managed_content": {
      "anyOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/ManagedContentState"
            },
            {
              "type": "object",
              "required": [
                "source_revision",
                "published_source_revision",
                "translations"
              ],
              "properties": {
                "source_revision": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/ManagedSourceRevision"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "published_source_revision": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/ManagedSourceRevision"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "translations": {
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/ManagedTranslation"
                  }
                }
              }
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "sender_mailbox": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "id",
            "address",
            "display_name",
            "status"
          ],
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "address": {
              "type": "string"
            },
            "display_name": {
              "type": "string"
            },
            "status": {
              "type": "string"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "reply_mailbox": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "id",
            "address",
            "display_name",
            "status"
          ],
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "address": {
              "type": "string"
            },
            "display_name": {
              "type": "string"
            },
            "status": {
              "type": "string"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "design_version": {
      "type": [
        "integer",
        "null"
      ]
    },
    "audience": {
      "$ref": "#/$defs/CampaignAudience"
    }
  },
  "$defs": {
    "CampaignAudience": {
      "type": "object",
      "properties": {
        "all_subscribed": {
          "type": "boolean"
        },
        "contact_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 10000
        },
        "list_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 1000
        },
        "segment_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 1000
        }
      },
      "description": "Select all subscribed contacts or at least one nonempty contact_ids, list_ids, or segment_ids list."
    },
    "ManagedContentField": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string",
                "text",
                "url",
                "image_url",
                "html",
                "date",
                "datetime",
                "number",
                "boolean",
                "money"
              ]
            },
            "required": {
              "type": "boolean"
            },
            "description": {
              "type": "string",
              "maxLength": 2000
            },
            "default": {
              "description": "Must match the field type."
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "properties"
          ],
          "properties": {
            "type": {
              "const": "object"
            },
            "required": {
              "type": "boolean"
            },
            "description": {
              "type": "string",
              "maxLength": 2000
            },
            "default": {
              "type": "object"
            },
            "properties": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/ManagedContentField"
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "items"
          ],
          "properties": {
            "type": {
              "const": "list"
            },
            "required": {
              "type": "boolean"
            },
            "description": {
              "type": "string",
              "maxLength": 2000
            },
            "default": {
              "type": "array"
            },
            "items": {
              "$ref": "#/$defs/ManagedContentField"
            }
          }
        }
      ],
      "description": "Recursive typed variable. Money values use {amount_cents: integer, currency: ISO 4217 code}; date values are ISO calendar dates and datetime values are ISO timestamps with offsets."
    },
    "ManagedContentState": {
      "type": "object",
      "required": [
        "id",
        "name",
        "version",
        "review_required"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "review_required": {
          "type": "boolean"
        },
        "draft_revision_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "submitted_revision_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "approved_revision_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "published_revision_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "published_publication_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "source_revision": {
          "type": "object",
          "additionalProperties": true
        },
        "translations": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "translation_jobs": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "ManagedSourceRevision": {
      "type": "object",
      "required": [
        "id",
        "content_id",
        "revision",
        "source_locale",
        "configured_locales",
        "fallback_locale",
        "localization_policy",
        "source",
        "source_messages",
        "layout_id",
        "layout_revision_id",
        "samples",
        "restored_from_revision_id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "content_id": {
          "type": "string",
          "format": "uuid"
        },
        "revision": {
          "type": "integer"
        },
        "source_locale": {
          "type": "string"
        },
        "configured_locales": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "fallback_locale": {
          "type": [
            "string",
            "null"
          ]
        },
        "localization_policy": {
          "type": "object",
          "additionalProperties": false,
          "description": "A Journey email goes out only in the person's own language: it waits for their translation, about a minute for receipts, codes and security notices and up to a day for other email, and is not sent if the translation is not ready by then.",
          "properties": {
            "manual_review": {
              "type": "boolean",
              "default": false
            }
          }
        },
        "source": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "subject",
            "body_html",
            "variables"
          ],
          "properties": {
            "subject": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100000
            },
            "preheader": {
              "type": "string",
              "maxLength": 100000
            },
            "body_text": {
              "type": "string",
              "maxLength": 100000,
              "description": "Accepted for source compatibility; rendered plain text derives from final HTML."
            },
            "body_html": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100000
            },
            "layout": {
              "type": "string",
              "maxLength": 100000,
              "description": "Must contain one {{ content }} slot."
            },
            "variants": {
              "type": "object",
              "minProperties": 2,
              "maxProperties": 4,
              "description": "Optional source versions. Every version is translated automatically in the same revision.",
              "additionalProperties": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subject",
                  "body_html"
                ],
                "properties": {
                  "subject": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100000
                  },
                  "preheader": {
                    "type": "string",
                    "maxLength": 100000
                  },
                  "body_html": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100000
                  },
                  "body_text": {
                    "type": "string",
                    "maxLength": 100000
                  },
                  "layout": {
                    "type": "string",
                    "maxLength": 100000
                  }
                }
              }
            },
            "variables": {
              "type": "object",
              "maxProperties": 100,
              "additionalProperties": {
                "$ref": "#/$defs/ManagedContentField"
              }
            }
          }
        },
        "source_messages": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "layout_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "layout_revision_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "samples": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "restored_from_revision_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        }
      }
    },
    "ManagedTranslation": {
      "type": "object",
      "required": [
        "source_revision_id",
        "locale",
        "strings",
        "provenance",
        "status"
      ],
      "properties": {
        "source_revision_id": {
          "type": "string",
          "format": "uuid"
        },
        "locale": {
          "type": "string"
        },
        "strings": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "provenance": {
          "type": "string",
          "enum": [
            "supplied",
            "generated",
            "reviewed"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "ready",
            "needs_review"
          ]
        }
      }
    },
    "TemplateSlot": {
      "type": "object",
      "required": [
        "key"
      ],
      "properties": {
        "key": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_$.-]{1,200}$"
        },
        "label": {
          "type": "string",
          "maxLength": 120
        },
        "type": {
          "type": "string",
          "enum": [
            "text",
            "paragraph",
            "url",
            "image"
          ]
        },
        "help": {
          "type": "string",
          "maxLength": 300
        }
      }
    }
  }
}