{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/upspring-ai/json-schema/upspring-ai-ads-list-response-schema.json",
  "title": "AdsListResponse",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/upspring-ai-openapi.json#/components/schemas/AdsListResponse",
  "type": "object",
  "properties": {
    "data": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AdListItem"
          }
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DistributionRow"
          }
        }
      ],
      "description": "An array of ad items (default, and when `q` is set — search mode), OR an array of distribution rows when `group_by` is set — the two are mutually exclusive per request."
    },
    "meta": {
      "type": "object",
      "properties": {
        "note": {
          "type": "string"
        },
        "order": {
          "type": "string",
          "enum": [
            "relevance",
            "random",
            "recent",
            "best"
          ],
          "description": "The EFFECTIVE ordering of this page. Search mode (`q` set) is always `relevance` — an explicitly-supplied `order_by` is ignored there (and called out in `note`). Absent in group_by (distribution) mode."
        },
        "next_cursor": {
          "type": [
            "string",
            "null"
          ],
          "description": "Absent entirely in group_by (distribution) mode — that mode is unpaginated."
        }
      },
      "required": [
        "note"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data",
    "meta"
  ],
  "additionalProperties": false,
  "$defs": {
    "AdListItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "advertiser": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        "media_type": {
          "type": [
            "string",
            "null"
          ]
        },
        "is_active": {
          "type": "boolean"
        },
        "started_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "dimensions": {
          "type": "object",
          "properties": {
            "hook_archetype": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            },
            "funnel": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            },
            "persona": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            },
            "archetype": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            },
            "mechanism": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            },
            "positioning": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            },
            "offer_type": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "one_line": {
          "type": [
            "string",
            "null"
          ]
        },
        "hook_text": {
          "type": [
            "string",
            "null"
          ]
        },
        "strength": {
          "type": "object",
          "properties": {
            "impressions": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 5
            },
            "engagement": {
              "type": "string",
              "enum": [
                "none",
                "observed",
                "high"
              ]
            }
          },
          "required": [
            "impressions",
            "engagement"
          ],
          "additionalProperties": false
        },
        "ad_library_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "media": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "video_url": {
              "type": [
                "string",
                "null"
              ]
            },
            "image_url": {
              "type": [
                "string",
                "null"
              ]
            },
            "thumbnail_url": {
              "type": [
                "string",
                "null"
              ]
            },
            "width": {
              "type": [
                "number",
                "null"
              ]
            },
            "height": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "video_url",
            "image_url",
            "thumbnail_url",
            "width",
            "height"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "id",
        "advertiser",
        "media_type",
        "is_active",
        "started_at",
        "dimensions",
        "one_line",
        "hook_text",
        "strength",
        "ad_library_url"
      ],
      "additionalProperties": false
    },
    "DistributionRow": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "share": {
          "type": "number"
        }
      },
      "required": [
        "id",
        "label",
        "description",
        "share"
      ],
      "additionalProperties": false
    }
  }
}