{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/blackbaud/main/json-schema/blackbaud-new-marketing-segment-schema.json",
  "title": "NewMarketingSegment",
  "description": "CreateMarketingSegment",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blackbaud-altru-marketing-api-openapi.yml#/components/schemas/NewMarketingSegment",
  "required": [
    "query_view_catalog",
    "name"
  ],
  "type": "object",
  "properties": {
    "query_view_catalog": {
      "type": "string",
      "description": "The record source. This simple list can be queried at https://api.sky.blackbaud.com/alt-adnmg/simplelists/a8477659-6ee9-4b49-861e-41711df69c9b."
    },
    "name": {
      "maxLength": 100,
      "minLength": 0,
      "type": "string",
      "description": "The name."
    },
    "description": {
      "maxLength": 255,
      "minLength": 0,
      "type": "string",
      "description": "The description."
    },
    "site_id": {
      "type": "string",
      "description": "The site."
    },
    "site_required": {
      "type": "boolean",
      "description": "Indicates whether site required?. Read-only in the SOAP API."
    },
    "segment_category": {
      "type": "string",
      "description": "The category. This code table can be queried at https://api.sky.blackbaud.com/alt-adnmg/codetables/mktsegmentcategorycode/entries"
    },
    "code": {
      "maxLength": 10,
      "minLength": 0,
      "type": "string",
      "description": "The code."
    },
    "code_value": {
      "type": "string",
      "description": "The code value ID. This simple list can be queried at https://api.sky.blackbaud.com/alt-adnmg/simplelists/78b8b763-9ba2-4bff-ba83-563edff889d8?parameters=part_definition_id,{segment_part_definition_id}&parameters=only_special_character_formats,{0}&parameters=valid_values_only,{1}."
    },
    "smart_queries_exist": {
      "type": "boolean",
      "description": "Indicates whether smart queries exist. Read-only in the SOAP API."
    },
    "selections": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NewMarketingSegmentSelections"
      },
      "description": "Selections."
    },
    "groups": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NewMarketingSegmentGroups"
      },
      "description": "Groups."
    },
    "segment_type_code": {
      "type": "integer",
      "description": "The segment type code.",
      "format": "int32"
    },
    "segment_part_definition_id": {
      "type": "string",
      "description": "The segment part definition ID. Read-only in the SOAP API."
    }
  },
  "additionalProperties": false,
  "x-display-name": "Constituent Segment Add Form",
  "x-display-id": "Constituent Segment Add Form",
  "$defs": {
    "NewMarketingSegmentGroups": {
      "type": "object",
      "properties": {
        "segment_group_id": {
          "type": "string",
          "description": "segmentgroupid"
        },
        "sequence": {
          "type": "integer",
          "description": "sequence"
        }
      },
      "description": "NewMarketingSegmentGroups",
      "x-display-name": "groups",
      "x-display-id": "groups"
    },
    "NewMarketingSegmentSelections": {
      "type": "object",
      "properties": {
        "selection_id": {
          "type": "string",
          "description": "selectionid"
        }
      },
      "description": "NewMarketingSegmentSelections",
      "x-display-name": "selections",
      "x-display-id": "selections"
    }
  }
}