{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "/schemas/3.1.0-rc.4/creative/list-creatives-response.json",
  "title": "List Creatives Response",
  "description": "Response from creative library query with filtered results, metadata, and optional enriched data",
  "type": "object",
  "allOf": [
    {
      "$ref": "/schemas/3.1.0-rc.4/core/version-envelope.json"
    },
    {
      "$ref": "/schemas/3.1.0-rc.4/core/protocol-envelope.json"
    }
  ],
  "properties": {
    "query_summary": {
      "type": "object",
      "description": "Summary of the query that was executed",
      "properties": {
        "total_matching": {
          "type": "integer",
          "description": "Total number of creatives matching filters (across all pages)",
          "minimum": 0
        },
        "returned": {
          "type": "integer",
          "description": "Number of creatives returned in this response",
          "minimum": 0
        },
        "filters_applied": {
          "type": "array",
          "description": "List of filters that were applied to the query",
          "items": {
            "type": "string"
          }
        },
        "sort_applied": {
          "type": "object",
          "description": "Sort order that was applied",
          "properties": {
            "field": {
              "type": "string"
            },
            "direction": {
              "$ref": "/schemas/3.1.0-rc.4/enums/sort-direction.json"
            }
          }
        }
      },
      "required": [
        "total_matching",
        "returned"
      ],
      "additionalProperties": true
    },
    "pagination": {
      "$ref": "/schemas/3.1.0-rc.4/core/pagination-response.json"
    },
    "creatives": {
      "type": "array",
      "description": "Array of creative assets matching the query",
      "items": {
        "type": "object",
        "properties": {
          "creative_id": {
            "type": "string",
            "description": "Unique identifier for the creative",
            "x-entity": "creative"
          },
          "account": {
            "$ref": "/schemas/3.1.0-rc.4/core/account.json",
            "description": "Account that owns this creative"
          },
          "name": {
            "type": "string",
            "description": "Human-readable creative name"
          },
          "format_id": {
            "$ref": "/schemas/3.1.0-rc.4/core/format-id.json",
            "description": "Format identifier specifying which format this creative conforms to"
          },
          "status": {
            "$ref": "/schemas/3.1.0-rc.4/enums/creative-status.json",
            "description": "Current approval status of the creative"
          },
          "created_date": {
            "type": "string",
            "format": "date-time",
            "description": "When the creative was created"
          },
          "updated_date": {
            "type": "string",
            "format": "date-time",
            "description": "When the creative was last modified"
          },
          "assets": {
            "type": "object",
            "description": "Assets for this creative, keyed by asset_id. Each slot value is either a single asset object or an array of asset objects (for slots with `min`/`max > 1`). Each asset value carries an `asset_type` discriminator that selects the matching asset schema.",
            "patternProperties": {
              "^[a-z0-9_]+$": {
                "oneOf": [
                  {
                    "$ref": "/schemas/3.1.0-rc.4/core/assets/asset-union.json"
                  },
                  {
                    "type": "array",
                    "items": {
                      "$ref": "/schemas/3.1.0-rc.4/core/assets/asset-union.json"
                    },
                    "minItems": 1
                  }
                ]
              }
            },
            "additionalProperties": true
          },
          "tags": {
            "type": "array",
            "description": "User-defined tags for organization and searchability",
            "items": {
              "type": "string"
            }
          },
          "concept_id": {
            "type": "string",
            "description": "Creative concept this creative belongs to. Concepts group related creatives across sizes and formats."
          },
          "concept_name": {
            "type": "string",
            "description": "Human-readable concept name"
          },
          "variables": {
            "type": "array",
            "description": "Dynamic content variables (DCO slots) for this creative. Included when include_variables=true.",
            "items": {
              "$ref": "/schemas/3.1.0-rc.4/core/creative-variable.json"
            }
          },
          "assignments": {
            "type": "object",
            "description": "Current package assignments (included when include_assignments=true)",
            "properties": {
              "assignment_count": {
                "type": "integer",
                "description": "Total number of active package assignments",
                "minimum": 0
              },
              "assigned_packages": {
                "type": "array",
                "description": "List of packages this creative is assigned to",
                "items": {
                  "type": "object",
                  "properties": {
                    "package_id": {
                      "type": "string",
                      "description": "Package identifier",
                      "x-entity": "package"
                    },
                    "assigned_date": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When this assignment was created"
                    }
                  },
                  "required": [
                    "package_id",
                    "assigned_date"
                  ],
                  "additionalProperties": true
                }
              }
            },
            "required": [
              "assignment_count"
            ],
            "additionalProperties": true
          },
          "snapshot": {
            "type": "object",
            "description": "Lightweight delivery snapshot (included when include_snapshot=true). For detailed performance analytics, use get_creative_delivery.",
            "properties": {
              "as_of": {
                "type": "string",
                "format": "date-time",
                "description": "When this snapshot was captured by the platform"
              },
              "staleness_seconds": {
                "type": "integer",
                "description": "Maximum age of this data in seconds. For example, 3600 means the data may be up to 1 hour old.",
                "minimum": 0
              },
              "impressions": {
                "type": "integer",
                "description": "Lifetime impressions across all assignments. Not scoped to any date range.",
                "minimum": 0
              },
              "last_served": {
                "type": "string",
                "format": "date-time",
                "description": "Last time this creative served an impression. Absent when the creative has never served."
              }
            },
            "required": [
              "as_of",
              "staleness_seconds",
              "impressions"
            ],
            "additionalProperties": true
          },
          "snapshot_unavailable_reason": {
            "$ref": "/schemas/3.1.0-rc.4/enums/snapshot-unavailable-reason.json",
            "description": "Machine-readable reason the snapshot is omitted. Present only when include_snapshot was true and snapshot data is unavailable for this creative."
          },
          "items": {
            "type": "array",
            "description": "Items for multi-asset formats like carousels and native ads (included when include_items=true)",
            "items": {
              "$ref": "/schemas/3.1.0-rc.4/core/creative-item.json"
            }
          },
          "pricing_options": {
            "type": "array",
            "description": "Pricing options for using this creative (serving, delivery). Used by ad servers and library agents. Transformation agents expose format-level pricing on list_creative_formats instead. Present when include_pricing=true and account provided. The buyer passes the applied pricing_option_id in report_usage.",
            "items": {
              "$ref": "/schemas/3.1.0-rc.4/core/vendor-pricing-option.json"
            },
            "minItems": 1
          },
          "purge": {
            "type": "object",
            "description": "Tombstone block — present only when this record is a soft-purged creative surfaced via `include_purged: true`. The record's `status` field reflects the last status before purge (frozen — buyers MUST treat the creative as gone; assignments, snapshot, and serving operations no longer apply). Tombstones surface for the seller's webhook activity retention window (30 days from `purge.at`). Hard purges (`purge_kind: hard` on the webhook) do not surface on this read — the [`creative.purged`](https://adcontextprotocol.org/schemas/v3/creative/creative-purged-webhook.json) webhook is the only signal.",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "soft"
                ],
                "description": "Always `soft` on tombstones — hard purges do not surface on this read."
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "description": "ISO 8601 timestamp when the creative was destroyed. Matches the `purged_at` field on the corresponding `creative.purged` webhook fire."
              },
              "reason_code": {
                "$ref": "/schemas/3.1.0-rc.4/enums/creative-event-reason-code.json",
                "description": "Categorical reason for the purge. Matches the value the seller emitted on the corresponding `creative.purged` webhook fire."
              }
            },
            "required": [
              "kind",
              "at",
              "reason_code"
            ],
            "additionalProperties": false
          },
          "webhook_activity": {
            "type": "array",
            "description": "Recent webhook fires scoped to this creative — `creative.status_changed` and `creative.purged` deliveries. Present only when the request set `include_webhook_activity: true`. Each item is a `webhook-activity-record`; the `notification_type` field discriminates between status changes and purges. The `ext.creative_id` slot MAY be populated on records nested inside larger reads where the parent does not already key the array; on `list_creatives` the parent creative_id is unambiguous and `ext.creative_id` MAY be omitted. Retention: 30 days from `completed_at` (MUST). See `snapshot-and-log.mdx § Webhook activity log pattern` for the full normative contract.",
            "items": {
              "$ref": "/schemas/3.1.0-rc.4/core/webhook-activity-record.json"
            },
            "maxItems": 200
          }
        },
        "required": [
          "creative_id",
          "name",
          "format_id",
          "status",
          "created_date",
          "updated_date"
        ],
        "additionalProperties": true
      }
    },
    "format_summary": {
      "type": "object",
      "description": "Breakdown of creatives by format. Keys are agent-defined format identifiers, optionally including dimensions (e.g., 'display_static_300x250', 'video_30s_vast'). Key construction is platform-specific — there is no required format.",
      "patternProperties": {
        "^[a-zA-Z0-9_-]+$": {
          "type": "integer",
          "description": "Number of creatives with this format",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "status_summary": {
      "type": "object",
      "description": "Breakdown of creatives by status",
      "properties": {
        "processing": {
          "type": "integer",
          "description": "Number of creatives being processed",
          "minimum": 0
        },
        "approved": {
          "type": "integer",
          "description": "Number of approved creatives",
          "minimum": 0
        },
        "pending_review": {
          "type": "integer",
          "description": "Number of creatives pending review",
          "minimum": 0
        },
        "rejected": {
          "type": "integer",
          "description": "Number of rejected creatives",
          "minimum": 0
        },
        "archived": {
          "type": "integer",
          "description": "Number of archived creatives",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "errors": {
      "type": "array",
      "description": "Task-specific errors (e.g., invalid filters, account not found)",
      "items": {
        "$ref": "/schemas/3.1.0-rc.4/core/error.json"
      }
    },
    "sandbox": {
      "type": "boolean",
      "description": "When true, this response contains simulated data from sandbox mode."
    },
    "context": {
      "$ref": "/schemas/3.1.0-rc.4/core/context.json"
    },
    "ext": {
      "$ref": "/schemas/3.1.0-rc.4/core/ext.json"
    }
  },
  "required": [
    "query_summary",
    "pagination",
    "creatives"
  ],
  "additionalProperties": true,
  "examples": [
    {
      "description": "Library query with creatives and variables",
      "data": {
        "status": "completed",
        "query_summary": {
          "total_matching": 2,
          "returned": 2,
          "filters_applied": [
            "concept_ids=concept_holiday_2026",
            "statuses=approved"
          ]
        },
        "pagination": {
          "has_more": false,
          "total_count": 2
        },
        "creatives": [
          {
            "creative_id": "ft_88201",
            "name": "Holiday Sale - Medium Rectangle",
            "format_id": {
              "agent_url": "https://creative.example.com",
              "id": "display_static",
              "width": 300,
              "height": 250
            },
            "status": "approved",
            "created_date": "2026-01-10T14:00:00Z",
            "updated_date": "2026-02-20T09:30:00Z",
            "assets": {
              "banner_image": {
                "asset_type": "image",
                "url": "https://cdn.example.com/holiday_300x250.png",
                "width": 300,
                "height": 250
              },
              "clickthrough_url": {
                "asset_type": "url",
                "url": "https://acmecorp.example.com/holiday-sale"
              }
            },
            "tags": [
              "holiday_2026",
              "display"
            ],
            "concept_id": "concept_holiday_2026",
            "concept_name": "Holiday 2026 Campaign",
            "variables": [
              {
                "variable_id": "headline_text",
                "name": "Headline",
                "variable_type": "text",
                "default_value": "Holiday Sale - 50% Off",
                "required": true
              },
              {
                "variable_id": "hero_image",
                "name": "Hero Image",
                "variable_type": "image",
                "required": false
              }
            ]
          },
          {
            "creative_id": "ft_88202",
            "name": "Holiday Sale - Leaderboard",
            "format_id": {
              "agent_url": "https://creative.example.com",
              "id": "display_static",
              "width": 728,
              "height": 90
            },
            "status": "approved",
            "created_date": "2026-01-10T14:30:00Z",
            "updated_date": "2026-02-20T09:35:00Z",
            "assets": {
              "banner_image": {
                "asset_type": "image",
                "url": "https://cdn.example.com/holiday_728x90.png",
                "width": 728,
                "height": 90
              },
              "clickthrough_url": {
                "asset_type": "url",
                "url": "https://acmecorp.example.com/holiday-sale"
              }
            },
            "tags": [
              "holiday_2026",
              "display"
            ],
            "concept_id": "concept_holiday_2026",
            "concept_name": "Holiday 2026 Campaign",
            "variables": []
          }
        ],
        "format_summary": {
          "display_static_300x250": 1,
          "display_static_728x90": 1
        },
        "status_summary": {
          "approved": 2,
          "pending_review": 0,
          "rejected": 0,
          "archived": 0
        }
      }
    },
    {
      "description": "Library query with webhook_activity and a purged tombstone",
      "data": {
        "status": "completed",
        "query_summary": {
          "total_matching": 2,
          "returned": 2,
          "filters_applied": [
            "include_purged=true",
            "include_webhook_activity=true"
          ]
        },
        "pagination": {
          "has_more": false,
          "total_count": 2
        },
        "creatives": [
          {
            "creative_id": "ft_88201",
            "name": "Holiday Sale - Medium Rectangle",
            "format_id": {
              "agent_url": "https://creative.example.com",
              "id": "display_static",
              "width": 300,
              "height": 250
            },
            "status": "rejected",
            "created_date": "2026-01-10T14:00:00Z",
            "updated_date": "2026-05-18T14:18:42Z",
            "webhook_activity": [
              {
                "idempotency_key": "whk_01HW9D2T3VXQ5M7K9N1P3R5S7U",
                "subscriber_id": "buyer-primary",
                "fired_at": "2026-05-18T14:20:00Z",
                "completed_at": "2026-05-18T14:20:00Z",
                "notification_type": "creative.status_changed",
                "attempt": 1,
                "status": "success",
                "url": "https://buyer.example/webhooks/adcp/creative",
                "http_status_code": 200,
                "response_time_ms": 142,
                "payload_size_bytes": 612,
                "error_message": null
              }
            ]
          },
          {
            "creative_id": "ft_87100",
            "name": "Holiday Sale - Leaderboard (purged)",
            "format_id": {
              "agent_url": "https://creative.example.com",
              "id": "display_static",
              "width": 728,
              "height": 90
            },
            "status": "approved",
            "created_date": "2025-11-01T10:00:00Z",
            "updated_date": "2026-05-18T02:59:48Z",
            "purge": {
              "kind": "soft",
              "at": "2026-05-18T02:59:48Z",
              "reason_code": "retention_expired"
            },
            "webhook_activity": [
              {
                "idempotency_key": "whk_01HW9H4X5ZTQ8R0O2P4S6U8V0X",
                "subscriber_id": "buyer-primary",
                "fired_at": "2026-05-18T03:00:00Z",
                "completed_at": "2026-05-18T03:00:00Z",
                "notification_type": "creative.purged",
                "attempt": 1,
                "status": "success",
                "url": "https://buyer.example/webhooks/adcp/creative",
                "http_status_code": 200,
                "response_time_ms": 178,
                "payload_size_bytes": 484,
                "error_message": null
              }
            ]
          }
        ],
        "format_summary": {
          "display_static_300x250": 1,
          "display_static_728x90": 1
        },
        "status_summary": {
          "approved": 1,
          "pending_review": 0,
          "rejected": 1,
          "archived": 0
        }
      }
    }
  ]
}
