{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/creative/sync-creatives-request.json",
  "title": "Sync Creatives Request",
  "description": "Request parameters for syncing creative assets with upsert semantics - supports bulk operations, scoped updates, and assignment management",
  "x-tool-summary": "List or synchronize creative assets, scoped updates, and media-buy assignments.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/version-envelope.json"
    },
    {
      "if": {
        "properties": {
          "delete_missing": {
            "const": true
          }
        },
        "required": [
          "delete_missing"
        ]
      },
      "then": {
        "required": [
          "creatives"
        ]
      }
    },
    {
      "not": {
        "required": [
          "assignments",
          "assignment_operations"
        ]
      }
    },
    {
      "if": {
        "required": [
          "assignment_operations"
        ]
      },
      "then": {
        "properties": {
          "validation_mode": {
            "type": "string",
            "const": "strict"
          }
        }
      }
    }
  ],
  "x-mutates-state": true,
  "properties": {
    "account": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/account-ref.json",
      "description": "Account that owns these creatives."
    },
    "creatives": {
      "type": "array",
      "description": "Array of creative assets to sync (create or update)",
      "items": {
        "allOf": [
          {
            "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/creative-asset.json"
          },
          {
            "type": "object",
            "properties": {
              "localization": {
                "description": "Sync-only materialized-localization mutation. The top-level assets are the source variant; optional locale_fallbacks declare buyer-approved language-family substitutions, and default_locale_variant_id selects the final serving fallback. An object transactionally replaces the source assets and complete locale set, omission preserves existing localization only when the top-level source assets are unchanged, and null removes localization. This field never requests translation or generation. Receivers MUST advertise get_adcp_capabilities creative.localization before accepting it.",
                "anyOf": [
                  {
                    "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/creative-localization.json"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": true
          }
        ],
        "x-adcp-validation": {
          "verifier_constraints": {
            "localization_capability_gate": {
              "required_capability": "creative.localization",
              "target_count_ceiling": "creative.localization.max_target_variants_or_50",
              "locale_format_account_support": "validate_request_before_mutation",
              "on_violation": "reject_before_mutation"
            },
            "existing_localized_source_upsert": {
              "localization_omitted": "top_level_assets_must_equal_prior_source_assets",
              "source_assets_changed": "require_non_null_localization_or_null_removal",
              "on_violation": "reject_before_mutation"
            },
            "localization_replacement": {
              "scope": "top_level_assets_and_complete_localization",
              "on_failure": "prior_state_unchanged",
              "orphan_locale_variants": "must_not_be_visible"
            }
          },
          "spec": "docs/creative/task-reference/sync_creatives.mdx#native-localization"
        }
      },
      "minItems": 1,
      "maxItems": 100
    },
    "creative_ids": {
      "type": "array",
      "description": "Optional filter to limit sync scope to specific creative IDs. When provided, only these creatives will be created/updated. Other creatives in the library are unaffected. Useful for partial updates and error recovery.",
      "items": {
        "type": "string",
        "x-entity": "creative"
      },
      "minItems": 1,
      "maxItems": 100
    },
    "assignments": {
      "type": "array",
      "deprecated": true,
      "description": "Deprecated additive assignment shorthand. Each entry upserts one creative-to-package assignment. Use assignment_operations for explicit assign, unassign, and replace semantics. Standalone creative agents that do not manage media buys ignore this field.",
      "items": {
        "type": "object",
        "properties": {
          "creative_id": {
            "type": "string",
            "description": "ID of the creative to assign",
            "x-entity": "creative"
          },
          "package_id": {
            "type": "string",
            "description": "ID of the package to assign the creative to",
            "x-entity": "package"
          },
          "weight": {
            "type": "number",
            "description": "Relative delivery weight (0-100). When multiple creatives are assigned to the same package, weights determine impression distribution proportionally. When omitted, the creative receives equal rotation with other unweighted creatives. A weight of 0 means the creative is assigned but paused (receives no delivery).",
            "minimum": 0,
            "maximum": 100
          },
          "placement_ids": {
            "type": "array",
            "description": "Restrict this creative to specific placements within the package. When omitted, the creative is eligible for all placements.",
            "items": {
              "type": "string"
            },
            "minItems": 1
          }
        },
        "required": [
          "creative_id",
          "package_id"
        ],
        "additionalProperties": false,
        "x-adcp-validation": {
          "verifier_constraints": {
            "product_format_locale_policy": {
              "scope": "every_effective_product_and_placement_format_option_where_assignment_may_serve",
              "range_matching": "rfc4647_basic_filtering",
              "eligible_variant_set": "filter_before_buyer_lookup_fallback_or_default",
              "minimum_eligible_variants_per_scope": 1,
              "serve_default": "default_locale_variant_id_must_be_eligible",
              "policy_lifecycle": "snapshot_effective_policy_at_assignment_acceptance",
              "on_violation": "CREATIVE_LOCALE_NOT_ACCEPTED"
            }
          },
          "spec": "docs/creative/task-reference/sync_creatives.mdx#native-localization"
        }
      },
      "minItems": 1
    },
    "assignment_operations": {
      "type": "array",
      "description": "Explicit, ordered assignment mutations. These operations may be sent without creatives to traffic existing creative IDs independently from MediaBuy commercial control. The entire request is atomic under idempotency_key and therefore requires strict validation; lenient partial processing is not permitted.",
      "minItems": 1,
      "maxItems": 500,
      "items": {
        "type": "object",
        "discriminator": {
          "propertyName": "operation"
        },
        "oneOf": [
          {
            "title": "Assign or update",
            "properties": {
              "operation": {
                "const": "assign"
              },
              "creative_id": {
                "type": "string",
                "minLength": 1,
                "x-entity": "creative"
              },
              "package_id": {
                "type": "string",
                "minLength": 1,
                "x-entity": "package"
              },
              "weight": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "placement_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "minItems": 1,
                "uniqueItems": true
              }
            },
            "required": [
              "operation",
              "creative_id",
              "package_id"
            ],
            "additionalProperties": false,
            "x-adcp-validation": {
              "verifier_constraints": {
                "product_format_locale_policy": {
                  "scope": "every_effective_product_and_placement_format_option_where_assignment_may_serve",
                  "range_matching": "rfc4647_basic_filtering",
                  "eligible_variant_set": "filter_before_buyer_lookup_fallback_or_default",
                  "minimum_eligible_variants_per_scope": 1,
                  "serve_default": "default_locale_variant_id_must_be_eligible",
                  "policy_lifecycle": "snapshot_effective_policy_at_assignment_acceptance",
                  "on_violation": "CREATIVE_LOCALE_NOT_ACCEPTED"
                }
              },
              "spec": "docs/creative/task-reference/sync_creatives.mdx#native-localization"
            }
          },
          {
            "title": "Unassign",
            "properties": {
              "operation": {
                "const": "unassign"
              },
              "creative_id": {
                "type": "string",
                "minLength": 1,
                "x-entity": "creative"
              },
              "package_id": {
                "type": "string",
                "minLength": 1,
                "x-entity": "package"
              }
            },
            "required": [
              "operation",
              "creative_id",
              "package_id"
            ],
            "additionalProperties": false
          },
          {
            "title": "Replace assignment",
            "properties": {
              "operation": {
                "const": "replace"
              },
              "creative_id": {
                "type": "string",
                "minLength": 1,
                "description": "Replacement creative ID.",
                "x-entity": "creative"
              },
              "replaces_creative_id": {
                "type": "string",
                "minLength": 1,
                "description": "Currently assigned creative ID to remove atomically.",
                "x-entity": "creative"
              },
              "package_id": {
                "type": "string",
                "minLength": 1,
                "x-entity": "package"
              },
              "weight": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "placement_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "minItems": 1,
                "uniqueItems": true
              }
            },
            "required": [
              "operation",
              "creative_id",
              "replaces_creative_id",
              "package_id"
            ],
            "additionalProperties": false,
            "x-adcp-validation": {
              "verifier_constraints": {
                "product_format_locale_policy": {
                  "scope": "every_effective_product_and_placement_format_option_where_assignment_may_serve",
                  "range_matching": "rfc4647_basic_filtering",
                  "eligible_variant_set": "filter_before_buyer_lookup_fallback_or_default",
                  "minimum_eligible_variants_per_scope": 1,
                  "serve_default": "default_locale_variant_id_must_be_eligible",
                  "policy_lifecycle": "snapshot_effective_policy_at_assignment_acceptance",
                  "on_violation": "CREATIVE_LOCALE_NOT_ACCEPTED"
                }
              },
              "spec": "docs/creative/task-reference/sync_creatives.mdx#native-localization"
            }
          }
        ]
      }
    },
    "idempotency_key": {
      "type": "string",
      "description": "Client-generated idempotency key for safe retries. If a sync fails without a response, resending with the same idempotency_key guarantees at-most-once execution. MUST be unique per (seller, request) pair to prevent cross-seller correlation. Use a fresh UUID v4 for each request.",
      "minLength": 16,
      "maxLength": 255,
      "pattern": "^[A-Za-z0-9_.:-]{16,255}$"
    },
    "delete_missing": {
      "type": "boolean",
      "default": false,
      "description": "When true, creatives not included in this sync will be archived. Use with caution for full library replacement. Invalid when creative_ids is provided — delete_missing applies to the entire library scope, not a filtered subset."
    },
    "dry_run": {
      "type": "boolean",
      "default": false,
      "description": "When true, rehearse this sync_creatives operation without applying it. Validates the actual trafficking request in the seller's current context, including library upsert semantics, creative IDs, assignments, account-scoped gates, and seller policies, then returns what would be created/updated/deleted. This is distinct from validate_input, which only validates manifest structure against canonical/product format targets."
    },
    "validation_mode": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/enums/validation-mode.json",
      "default": "strict",
      "description": "Validation strictness. 'strict' fails entire sync on any validation error. 'lenient' processes valid creatives and reports errors."
    },
    "push_notification_config": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/push-notification-config.json",
      "description": "Optional webhook configuration for async sync notifications. The agent will send a webhook when sync completes if the operation takes longer than immediate response time (typically for large bulk operations or manual approval/HITL)."
    },
    "context": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/context.json"
    },
    "ext": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/ext.json"
    }
  },
  "required": [
    "idempotency_key",
    "account"
  ],
  "anyOf": [
    {
      "required": [
        "creatives"
      ]
    },
    {
      "required": [
        "assignments"
      ]
    },
    {
      "required": [
        "assignment_operations"
      ]
    }
  ],
  "additionalProperties": true,
  "examples": [
    {
      "description": "Full sync with hosted video creative",
      "data": {
        "idempotency_key": "550e8400-e29b-41d4-a716-446655440000",
        "account": {
          "account_id": "acct_acmecorp"
        },
        "creatives": [
          {
            "creative_id": "hero_video_30s",
            "name": "Brand Hero Video 30s",
            "format_kind": "video_hosted",
            "assets": {
              "video": {
                "asset_type": "video",
                "url": "https://cdn.example.com/hero-video.mp4",
                "width": 1920,
                "height": 1080,
                "duration_ms": 30000
              }
            },
            "tags": [
              "q1_2026",
              "video"
            ]
          }
        ],
        "assignments": [
          {
            "creative_id": "hero_video_30s",
            "package_id": "pkg_ctv_001"
          },
          {
            "creative_id": "hero_video_30s",
            "package_id": "pkg_ctv_002"
          }
        ]
      }
    },
    {
      "description": "Generative creative with approval",
      "data": {
        "idempotency_key": "5f8b1f3a-1234-4a5b-9cde-1234567890ab",
        "account": {
          "account_id": "acct_acmecorp"
        },
        "creatives": [
          {
            "creative_id": "holiday_hero",
            "name": "Holiday Campaign Hero",
            "format_kind": "image",
            "assets": {
              "product_catalog": {
                "asset_type": "catalog",
                "type": "product",
                "catalog_id": "winter-products"
              },
              "generation_prompt": {
                "asset_type": "text",
                "content": "Create a warm, festive holiday campaign featuring winter products"
              }
            },
            "tags": [
              "holiday",
              "q4_2026"
            ]
          }
        ]
      }
    },
    {
      "description": "Scoped update using creative_ids filter",
      "data": {
        "idempotency_key": "6a9c2f4b-5678-49ab-8def-fedcba987654",
        "account": {
          "account_id": "acct_acmecorp"
        },
        "creative_ids": [
          "hero_video_30s",
          "banner_300x250"
        ],
        "creatives": [
          {
            "creative_id": "hero_video_30s",
            "name": "Brand Hero Video 30s - Updated",
            "format_kind": "video_hosted",
            "assets": {
              "video": {
                "asset_type": "video",
                "url": "https://cdn.example.com/updated-hero.mp4",
                "width": 1920,
                "height": 1080,
                "duration_ms": 30000
              }
            }
          },
          {
            "creative_id": "banner_300x250",
            "name": "Display Banner 300x250 - Updated",
            "format_kind": "image",
            "assets": {
              "image": {
                "asset_type": "image",
                "url": "https://cdn.example.com/updated-banner.png",
                "width": 300,
                "height": 250
              }
            }
          }
        ]
      }
    }
  ]
}
