{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/abmeter-ai/json-schema/abmeter-ai-audiences-input-schema.json",
  "title": "AudiencesInput",
  "description": "Audience configuration for creating/updating experiments. Keys are audience slugs, values are either an integer percentage (for control groups with no variant) or an object with \"percentage\" and \"variant\" keys (for treatment groups). Percentages should sum to 100.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/abmeter-ai-openapi.yml#/components/schemas/AudiencesInput",
  "type": "object",
  "additionalProperties": {
    "oneOf": [
      {
        "type": "integer",
        "minimum": 1,
        "maximum": 100,
        "description": "Percentage for control audience (no variant override)"
      },
      {
        "type": "object",
        "properties": {
          "percentage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Percentage of traffic for this audience"
          },
          "variant": {
            "$ref": "#/$defs/Slug",
            "description": "Variant slug to apply for this audience"
          }
        },
        "required": [
          "percentage",
          "variant"
        ]
      }
    ]
  },
  "$defs": {
    "Slug": {
      "type": "string",
      "description": "Standardized identifier for entities used across the API. Recommended format: each entity type has its own prefix pattern followed by a short alphanumeric identifier (e.g., parameter-ab4c, space-main, audience-control)."
    }
  }
}