{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://creatorsagency.co/assets/creator-measurement/creator-campaign-data-standard.schema.json",
  "title": "Creators Agency Creator Campaign Data Standard",
  "description": "A practical creator campaign record recommended by Creators Agency. It is not an official IAB standard. Values in examples are illustrative.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "activations", "results", "paid_flights"],
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "base_currency": {
      "$ref": "#/$defs/currency"
    },
    "timezone": {
      "type": "string",
      "minLength": 1,
      "examples": ["America/Chicago"]
    },
    "field_rules_last_reviewed": {
      "$ref": "#/$defs/date"
    },
    "activations": {
      "type": "array",
      "items": { "$ref": "#/$defs/activation" }
    },
    "results": {
      "type": "array",
      "items": { "$ref": "#/$defs/result" }
    },
    "paid_flights": {
      "type": "array",
      "items": { "$ref": "#/$defs/paid_flight" }
    }
  },
  "$defs": {
    "id": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "date_time": {
      "type": "string",
      "format": "date-time"
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "examples": ["USD"]
    },
    "non_negative_number": {
      "type": "number",
      "minimum": 0
    },
    "metric_value": {
      "oneOf": [
        { "$ref": "#/$defs/non_negative_number" },
        { "enum": ["NA", "UNAVAILABLE", "PENDING", "ERROR"] }
      ]
    },
    "activation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "campaign_id",
        "activation_id",
        "creator_id",
        "platform",
        "format",
        "status",
        "currency",
        "timezone",
        "is_example"
      ],
      "properties": {
        "campaign_id": { "$ref": "#/$defs/id" },
        "activation_id": { "$ref": "#/$defs/id" },
        "brand": { "type": "string" },
        "product": { "type": "string" },
        "creator_id": { "$ref": "#/$defs/id" },
        "creator_name": { "type": "string" },
        "platform": {
          "type": "string",
          "enum": ["youtube", "instagram", "tiktok", "podcast", "newsletter", "linkedin", "twitch", "other"]
        },
        "format": { "type": "string", "minLength": 1 },
        "angle": { "type": "string" },
        "primary_cta": { "type": "string" },
        "deliverable_notes": { "type": "string" },
        "contracted_live_date": { "$ref": "#/$defs/date" },
        "actual_live_at": { "$ref": "#/$defs/date_time" },
        "status": {
          "type": "string",
          "enum": ["planned", "making", "submitted", "approved", "live", "done", "canceled"]
        },
        "content_url": { "type": "string", "format": "uri" },
        "content_removed_at": { "$ref": "#/$defs/date_time" },
        "creator_content_fee": { "$ref": "#/$defs/non_negative_number" },
        "paid_usage_fee": { "$ref": "#/$defs/non_negative_number" },
        "other_creator_fees": { "$ref": "#/$defs/non_negative_number" },
        "currency": { "$ref": "#/$defs/currency" },
        "exclusivity_start": { "$ref": "#/$defs/date" },
        "exclusivity_end": { "$ref": "#/$defs/date" },
        "usage_start": { "$ref": "#/$defs/date" },
        "usage_end": { "$ref": "#/$defs/date" },
        "usage_platforms": { "type": "string" },
        "media_spend_cap": { "$ref": "#/$defs/non_negative_number" },
        "renewal_trigger": { "type": "string" },
        "timezone": { "type": "string", "minLength": 1 },
        "source_system": { "type": "string" },
        "source_checked_at": { "$ref": "#/$defs/date_time" },
        "is_example": { "type": "boolean" },
        "notes": { "type": "string" }
      }
    },
    "result": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "report_id",
        "activation_id",
        "report_as_of",
        "result_stage",
        "attribution_rule",
        "source_system",
        "reported_by",
        "is_example"
      ],
      "properties": {
        "report_id": { "$ref": "#/$defs/id" },
        "activation_id": { "$ref": "#/$defs/id" },
        "report_as_of": { "$ref": "#/$defs/date_time" },
        "result_stage": {
          "type": "string",
          "enum": ["early", "main", "final"]
        },
        "attribution_rule": { "type": "string", "minLength": 1 },
        "source_system": { "type": "string", "minLength": 1 },
        "source_link_or_file": { "type": "string" },
        "reported_by": { "type": "string", "minLength": 1 },
        "organic_views": { "$ref": "#/$defs/metric_value" },
        "organic_impressions": { "$ref": "#/$defs/metric_value" },
        "organic_reach": { "$ref": "#/$defs/metric_value" },
        "watch_time_seconds": { "$ref": "#/$defs/metric_value" },
        "avg_view_duration_seconds": { "$ref": "#/$defs/metric_value" },
        "likes": { "$ref": "#/$defs/metric_value" },
        "comments": { "$ref": "#/$defs/metric_value" },
        "shares": { "$ref": "#/$defs/metric_value" },
        "saves": { "$ref": "#/$defs/metric_value" },
        "tracked_clicks": { "$ref": "#/$defs/metric_value" },
        "landing_sessions": { "$ref": "#/$defs/metric_value" },
        "funnel_1_name": { "type": "string" },
        "funnel_1_count": { "$ref": "#/$defs/metric_value" },
        "funnel_2_name": { "type": "string" },
        "funnel_2_count": { "$ref": "#/$defs/metric_value" },
        "primary_kpi_name": { "type": "string" },
        "primary_kpi_count": { "$ref": "#/$defs/metric_value" },
        "quality_metric_name": { "type": "string" },
        "quality_metric_value": { "$ref": "#/$defs/metric_value" },
        "attributed_revenue": { "$ref": "#/$defs/metric_value" },
        "incremental_revenue": { "$ref": "#/$defs/metric_value" },
        "causal_method": { "type": "string" },
        "is_example": { "type": "boolean" },
        "notes": { "type": "string" }
      },
      "allOf": [
        {
          "if": {
            "required": ["incremental_revenue"],
            "properties": { "incremental_revenue": { "type": "number" } }
          },
          "then": {
            "required": ["causal_method"],
            "properties": { "causal_method": { "minLength": 1 } }
          }
        }
      ]
    },
    "paid_flight": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "paid_flight_id",
        "activation_id",
        "ad_platform",
        "flight_start",
        "flight_end",
        "currency",
        "is_example"
      ],
      "properties": {
        "paid_flight_id": { "$ref": "#/$defs/id" },
        "activation_id": { "$ref": "#/$defs/id" },
        "ad_platform": { "type": "string", "minLength": 1 },
        "ad_account_id": { "type": "string" },
        "flight_start": { "$ref": "#/$defs/date" },
        "flight_end": { "$ref": "#/$defs/date" },
        "authorized_spend_cap": { "$ref": "#/$defs/non_negative_number" },
        "actual_media_spend": { "$ref": "#/$defs/metric_value" },
        "currency": { "$ref": "#/$defs/currency" },
        "paid_impressions": { "$ref": "#/$defs/metric_value" },
        "paid_clicks": { "$ref": "#/$defs/metric_value" },
        "paid_conversions": { "$ref": "#/$defs/metric_value" },
        "ad_utm_content": { "type": "string" },
        "is_example": { "type": "boolean" },
        "notes": { "type": "string" }
      }
    }
  }
}
