{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/crevio-co/json-schema/crevio-co-broadcast-request-schema.json",
  "title": "BroadcastRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/crevio-co-broadcasts-api-openapi.yml#/components/schemas/BroadcastRequest",
  "type": "object",
  "properties": {
    "from": {
      "type": [
        "string",
        "null"
      ],
      "description": "Sender email address (uses account default if omitted)"
    },
    "to": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of recipient email addresses"
    },
    "subject": {
      "type": "string",
      "description": "Email subject line. Takes the same variables as `body`."
    },
    "preview_text": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255,
      "description": "Inbox preview line. Takes the same variables as `body`."
    },
    "body": {
      "type": "string",
      "description": "Email body (HTML or plain text). Variables, filled per recipient from their customer record when each batch is sent: {{customer.first_name}}, {{customer.last_name}}, {{customer.email}}, {{business.name}}, {{customer.fields.<key>}}. `customer.fields.<key>` reads `<key>` from the customer's `metadata`. An address in `to` that belongs to no customer is sent without customer data, so its variables render blank or as their defaults. Put `{{unsubscribe_url}}` in an `href` to place the recipient's opt-out link. Any other `{{ }}` is rejected with `422`."
    },
    "customer_type": {
      "type": [
        "string",
        "null"
      ],
      "description": "Filter recipients by customer type"
    },
    "send_to_all": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Send to all customers"
    }
  }
}