{
  "openapi": "3.1.0",
  "info": {
    "title": "Ad Radar Data API",
    "version": "1.0.0",
    "summary": "Winning Facebook and Instagram ads, spend estimates, hooks, brands and patterns as an API.",
    "description": "Build on the Ad Radar library: winning Meta ads (every ad has at least $50,000 estimated spend), with spend estimates, Ad Radar score and tier, hooks, transcripts, taxonomy and brands.\n\n**Auth.** Send your key as `Authorization: Bearer <key>`. Keys come with a Data API plan: get Builder at https://app.ad-radar.dev/checkout?plan=api-builder (or Scale at https://app.ad-radar.dev/checkout?plan=api-scale), then create and manage keys at https://app.ad-radar.dev/settings/api. There is no free tier. An Ad Radar app plan without a Data API plan keeps MCP and lookups by key (`GET /ads`, `GET /ads/{adKey}`) with the app's daily limits; the other endpoints answer 403 `plan_required` and nothing is counted.\n\n**Requests and quotas.** One request = one billable HTTP call to `/api/v1/*` or one MCP tool call. Validation errors (400), auth errors and our own errors (5xx, refunded) don't count, and neither do `GET /me` and `GET /openapi.json`. Every billable response carries `X-RateLimit-*` and `X-Quota-*` headers. Over a limit you get a 429 with the reason and an upgrade link, never a silently shortened list.\n\n| Plan | Price | Requests | Rate limit | Page size | Extra |\n|---|---|---|---|---|---|\n| Builder | $299 / 4 weeks | 10,000 per period | 60/min | 100 | includes the web app |\n| Scale | $799 / 4 weeks | 50,000 per period | 300/min | 100 | + /feed |\n| Reseller | from $2,000 / 4 weeks | custom | custom (default 600/min) | 100 | + /export, resale and white-label |\n\n**MCP.** The same key works with the Ad Radar MCP server (`https://app.ad-radar.dev/api/mcp`, Streamable HTTP): each tool call is one request.\n\n**Freshness.** New ads from tracked brands are scanned daily; engagement, spend estimates and scores are refreshed daily; tiers are recomputed daily.\n\n**Pagination.** List endpoints return `pagination.nextCursor`; pass it back as `cursor` (or `since` for /feed). Cursors are opaque and tied to the filters that produced them.\n\n**Spend estimate.** `spendEstimate` = round(`metrics.reactions` × 19.59): an estimate based on engagement, not reported spend. `spendLowerBound: true` means it is a minimum (other posts of the ad may exist).",
    "termsOfService": "https://ad-radar.dev/terms"
  },
  "servers": [
    {
      "url": "https://app.ad-radar.dev/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Ads",
      "description": "Search, winners and lookups. Every endpoint returns the same Ad object."
    },
    {
      "name": "Brands",
      "description": "Advertisers with counts, active ads, spend estimate and trends."
    },
    {
      "name": "Insights",
      "description": "Winning patterns across the library."
    },
    {
      "name": "Sync",
      "description": "Keep a local copy in sync: incremental feed (Scale) and full export (Reseller)."
    },
    {
      "name": "Account",
      "description": "Your plan, quota and usage."
    },
    {
      "name": "Reference",
      "description": "Taxonomy and this specification."
    }
  ],
  "paths": {
    "/ads/search": {
      "get": {
        "operationId": "searchAds",
        "tags": [
          "Ads"
        ],
        "summary": "Search ads",
        "description": "Searches the library with the same filters as the Ad Radar board. Cursor pagination. Every result is the full Ad object.",
        "parameters": [
          {
            "$ref": "#/components/parameters/q"
          },
          {
            "$ref": "#/components/parameters/brand"
          },
          {
            "$ref": "#/components/parameters/format"
          },
          {
            "name": "tier",
            "in": "query",
            "description": "winner = top 10% by score and running 21+ days; rising = growing fast.",
            "schema": {
              "type": "string",
              "enum": [
                "winner",
                "rising"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/tags"
          },
          {
            "$ref": "#/components/parameters/category"
          },
          {
            "$ref": "#/components/parameters/country"
          },
          {
            "name": "active",
            "in": "query",
            "description": "true = running, false = stopped, all = both. Default: all.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false",
                "all"
              ],
              "default": "all"
            }
          },
          {
            "$ref": "#/components/parameters/started_after"
          },
          {
            "$ref": "#/components/parameters/started_before"
          },
          {
            "$ref": "#/components/parameters/min_spend"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/order"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdList"
                },
                "example": {
                  "data": [
                    {
                      "adKey": "meta:1204518837711490",
                      "libraryId": "1204518837711490",
                      "brand": "Hearth & Field",
                      "pageId": "104218839201744",
                      "headline": "The cast-iron skillet that replaced my whole pan drawer",
                      "body": "Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.",
                      "cta": "Shop Now",
                      "transcript": "I used to own nine pans. Now I own one. Here's why...",
                      "translatedFrom": null,
                      "transcriptOriginal": null,
                      "original": null,
                      "startedAt": "2026-08-27",
                      "isActive": true,
                      "spendEstimate": 184205,
                      "spendLowerBound": false,
                      "winnerObservation": {
                        "firstObservedAt": "2026-09-30T07:00:00.000Z",
                        "lastBelowAt": null,
                        "interpretation": "already_winner_when_first_observed"
                      },
                      "delivery": {
                        "key": "running",
                        "en": "Running · checked Nov 17, 2026",
                        "date": "2026-11-17T07:00:00.000Z"
                      },
                      "tags": [
                        {
                          "dimension": "awareness",
                          "slug": "problem-aware",
                          "label": "Problem-Aware"
                        },
                        {
                          "dimension": "hook_pattern",
                          "slug": "before-after",
                          "label": "Before / After"
                        }
                      ],
                      "publisherPlatforms": [
                        "facebook",
                        "instagram"
                      ],
                      "destinationDomain": "hearthandfield.example",
                      "metrics": {
                        "score": 12.84,
                        "tier": "winner",
                        "isFire": true,
                        "lowData": false,
                        "reactions": 9403,
                        "daysRunning": 83,
                        "variants": 6,
                        "capturedAt": "2026-11-17T07:00:00.000Z"
                      },
                      "media": {
                        "kind": "video",
                        "poster": "https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg",
                        "video": "https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4",
                        "durationS": 41
                      },
                      "links": {
                        "radar": "https://app.ad-radar.dev/a/meta%3A1204518837711490",
                        "library": "https://www.facebook.com/ads/library/?id=1204518837711490",
                        "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                        "post": null,
                        "landing": "https://hearthandfield.example/skillet"
                      },
                      "snapshotAt": "2026-11-18T09:12:44.103Z"
                    }
                  ],
                  "pagination": {
                    "limit": 25,
                    "hasMore": true,
                    "nextCursor": "c1.v8Yb3k…"
                  },
                  "total": 412
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "404": {
            "description": "The brand in `brand` doesn't exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Brand not found: acme. Use an id or slug from GET /brands.",
                  "code": "brand_not_found",
                  "param": "brand"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/ads": {
      "get": {
        "operationId": "getAdsByKeys",
        "tags": [
          "Ads"
        ],
        "summary": "Get ads by key",
        "description": "Up to 100 ads in one call, by adKey, bare id or Meta Ad Library id.",
        "parameters": [
          {
            "name": "keys",
            "in": "query",
            "required": true,
            "description": "Comma separated keys, at most 100.",
            "schema": {
              "type": "string"
            },
            "example": "meta:1204518837711490,meta:1309917716620031"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdBatch"
                },
                "example": {
                  "ads": {
                    "meta:1204518837711490": {
                      "adKey": "meta:1204518837711490",
                      "libraryId": "1204518837711490",
                      "brand": "Hearth & Field",
                      "pageId": "104218839201744",
                      "headline": "The cast-iron skillet that replaced my whole pan drawer",
                      "body": "Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.",
                      "cta": "Shop Now",
                      "transcript": "I used to own nine pans. Now I own one. Here's why...",
                      "translatedFrom": null,
                      "transcriptOriginal": null,
                      "original": null,
                      "startedAt": "2026-08-27",
                      "isActive": true,
                      "spendEstimate": 184205,
                      "spendLowerBound": false,
                      "winnerObservation": {
                        "firstObservedAt": "2026-09-30T07:00:00.000Z",
                        "lastBelowAt": null,
                        "interpretation": "already_winner_when_first_observed"
                      },
                      "delivery": {
                        "key": "running",
                        "en": "Running · checked Nov 17, 2026",
                        "date": "2026-11-17T07:00:00.000Z"
                      },
                      "tags": [
                        {
                          "dimension": "awareness",
                          "slug": "problem-aware",
                          "label": "Problem-Aware"
                        },
                        {
                          "dimension": "hook_pattern",
                          "slug": "before-after",
                          "label": "Before / After"
                        }
                      ],
                      "publisherPlatforms": [
                        "facebook",
                        "instagram"
                      ],
                      "destinationDomain": "hearthandfield.example",
                      "metrics": {
                        "score": 12.84,
                        "tier": "winner",
                        "isFire": true,
                        "lowData": false,
                        "reactions": 9403,
                        "daysRunning": 83,
                        "variants": 6,
                        "capturedAt": "2026-11-17T07:00:00.000Z"
                      },
                      "media": {
                        "kind": "video",
                        "poster": "https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg",
                        "video": "https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4",
                        "durationS": 41
                      },
                      "links": {
                        "radar": "https://app.ad-radar.dev/a/meta%3A1204518837711490",
                        "library": "https://www.facebook.com/ads/library/?id=1204518837711490",
                        "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                        "post": null,
                        "landing": "https://hearthandfield.example/skillet"
                      },
                      "snapshotAt": "2026-11-18T09:12:44.103Z"
                    }
                  },
                  "missing": [
                    "meta:1309917716620031"
                  ]
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/ads/{key}": {
      "get": {
        "operationId": "getAd",
        "tags": [
          "Ads"
        ],
        "summary": "Get one ad",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "adKey (`meta:<id>`), bare id or Meta Ad Library id.",
            "schema": {
              "type": "string"
            },
            "example": "meta:1204518837711490"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ad"
                },
                "example": {
                  "adKey": "meta:1204518837711490",
                  "libraryId": "1204518837711490",
                  "brand": "Hearth & Field",
                  "pageId": "104218839201744",
                  "headline": "The cast-iron skillet that replaced my whole pan drawer",
                  "body": "Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.",
                  "cta": "Shop Now",
                  "transcript": "I used to own nine pans. Now I own one. Here's why...",
                  "translatedFrom": null,
                  "transcriptOriginal": null,
                  "original": null,
                  "startedAt": "2026-08-27",
                  "isActive": true,
                  "spendEstimate": 184205,
                  "spendLowerBound": false,
                  "winnerObservation": {
                    "firstObservedAt": "2026-09-30T07:00:00.000Z",
                    "lastBelowAt": null,
                    "interpretation": "already_winner_when_first_observed"
                  },
                  "delivery": {
                    "key": "running",
                    "en": "Running · checked Nov 17, 2026",
                    "date": "2026-11-17T07:00:00.000Z"
                  },
                  "tags": [
                    {
                      "dimension": "awareness",
                      "slug": "problem-aware",
                      "label": "Problem-Aware"
                    },
                    {
                      "dimension": "hook_pattern",
                      "slug": "before-after",
                      "label": "Before / After"
                    }
                  ],
                  "publisherPlatforms": [
                    "facebook",
                    "instagram"
                  ],
                  "destinationDomain": "hearthandfield.example",
                  "metrics": {
                    "score": 12.84,
                    "tier": "winner",
                    "isFire": true,
                    "lowData": false,
                    "reactions": 9403,
                    "daysRunning": 83,
                    "variants": 6,
                    "capturedAt": "2026-11-17T07:00:00.000Z"
                  },
                  "media": {
                    "kind": "video",
                    "poster": "https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg",
                    "video": "https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4",
                    "durationS": 41
                  },
                  "links": {
                    "radar": "https://app.ad-radar.dev/a/meta%3A1204518837711490",
                    "library": "https://www.facebook.com/ads/library/?id=1204518837711490",
                    "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                    "post": null,
                    "landing": "https://hearthandfield.example/skillet"
                  },
                  "snapshotAt": "2026-11-18T09:12:44.103Z"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/winners": {
      "get": {
        "operationId": "listWinners",
        "tags": [
          "Ads"
        ],
        "summary": "Current winners",
        "description": "Ads in the winner tier now (top 10% by score, running 21+ days), active by default. `since` returns only the ads that entered the winner tier after that moment (tiers are recomputed daily).",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Date (2026-11-01) or ISO 8601 timestamp.",
            "schema": {
              "type": "string"
            },
            "example": "2026-11-11"
          },
          {
            "$ref": "#/components/parameters/q"
          },
          {
            "$ref": "#/components/parameters/brand"
          },
          {
            "$ref": "#/components/parameters/format"
          },
          {
            "$ref": "#/components/parameters/tags"
          },
          {
            "$ref": "#/components/parameters/category"
          },
          {
            "name": "active",
            "in": "query",
            "description": "true = running, false = stopped, all = both. Default: true.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false",
                "all"
              ],
              "default": "true"
            }
          },
          {
            "$ref": "#/components/parameters/started_after"
          },
          {
            "$ref": "#/components/parameters/started_before"
          },
          {
            "$ref": "#/components/parameters/min_spend"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/order"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdList"
                },
                "example": {
                  "data": [
                    {
                      "adKey": "meta:1204518837711490",
                      "libraryId": "1204518837711490",
                      "brand": "Hearth & Field",
                      "pageId": "104218839201744",
                      "headline": "The cast-iron skillet that replaced my whole pan drawer",
                      "body": "Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.",
                      "cta": "Shop Now",
                      "transcript": "I used to own nine pans. Now I own one. Here's why...",
                      "translatedFrom": null,
                      "transcriptOriginal": null,
                      "original": null,
                      "startedAt": "2026-08-27",
                      "isActive": true,
                      "spendEstimate": 184205,
                      "spendLowerBound": false,
                      "winnerObservation": {
                        "firstObservedAt": "2026-09-30T07:00:00.000Z",
                        "lastBelowAt": null,
                        "interpretation": "already_winner_when_first_observed"
                      },
                      "delivery": {
                        "key": "running",
                        "en": "Running · checked Nov 17, 2026",
                        "date": "2026-11-17T07:00:00.000Z"
                      },
                      "tags": [
                        {
                          "dimension": "awareness",
                          "slug": "problem-aware",
                          "label": "Problem-Aware"
                        },
                        {
                          "dimension": "hook_pattern",
                          "slug": "before-after",
                          "label": "Before / After"
                        }
                      ],
                      "publisherPlatforms": [
                        "facebook",
                        "instagram"
                      ],
                      "destinationDomain": "hearthandfield.example",
                      "metrics": {
                        "score": 12.84,
                        "tier": "winner",
                        "isFire": true,
                        "lowData": false,
                        "reactions": 9403,
                        "daysRunning": 83,
                        "variants": 6,
                        "capturedAt": "2026-11-17T07:00:00.000Z"
                      },
                      "media": {
                        "kind": "video",
                        "poster": "https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg",
                        "video": "https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4",
                        "durationS": 41
                      },
                      "links": {
                        "radar": "https://app.ad-radar.dev/a/meta%3A1204518837711490",
                        "library": "https://www.facebook.com/ads/library/?id=1204518837711490",
                        "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                        "post": null,
                        "landing": "https://hearthandfield.example/skillet"
                      },
                      "snapshotAt": "2026-11-18T09:12:44.103Z"
                    }
                  ],
                  "pagination": {
                    "limit": 25,
                    "hasMore": true,
                    "nextCursor": "c1.v8Yb3k…"
                  },
                  "total": 96
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/brands": {
      "get": {
        "operationId": "listBrands",
        "tags": [
          "Brands"
        ],
        "summary": "List brands",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Name, slug, domain or Facebook page id.",
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "$ref": "#/components/parameters/category"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active_ads",
                "winners",
                "newest",
                "recent"
              ],
              "default": "active_ads"
            },
            "description": "active_ads, winners (active winners), newest (newest brands by first ad), recent (latest launch)."
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandList"
                },
                "example": {
                  "data": [
                    {
                      "id": 4182,
                      "slug": "hearth-and-field",
                      "name": "Hearth & Field",
                      "pageId": "104218839201744",
                      "domain": "hearthandfield.example",
                      "categories": [
                        "home",
                        "kitchen"
                      ],
                      "activeAds": 37,
                      "activeWinners": 4,
                      "ads": 52,
                      "spendEstimate": 2410350,
                      "lastSeenAt": "2026-11-17T07:00:00.000Z",
                      "lastLaunchAt": "2026-11-12",
                      "activeAdsTrend": [
                        31,
                        31,
                        32,
                        34,
                        33,
                        35,
                        37
                      ],
                      "links": {
                        "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                        "radar": "https://app.ad-radar.dev/brands/hearth-and-field"
                      }
                    }
                  ],
                  "pagination": {
                    "limit": 25,
                    "hasMore": true,
                    "nextCursor": "c1.Qm9y…"
                  },
                  "total": 811
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/brands/{id}": {
      "get": {
        "operationId": "getBrand",
        "tags": [
          "Brands"
        ],
        "summary": "Get one brand",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Brand id or slug.",
            "schema": {
              "type": "string"
            },
            "example": "hearth-and-field"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandDetail"
                },
                "example": {
                  "id": 4182,
                  "slug": "hearth-and-field",
                  "name": "Hearth & Field",
                  "pageId": "104218839201744",
                  "domain": "hearthandfield.example",
                  "categories": [
                    "home",
                    "kitchen"
                  ],
                  "ads": 52,
                  "spendEstimate": 2410350,
                  "lastSeenAt": "2026-11-17T07:00:00.000Z",
                  "links": {
                    "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                    "radar": "https://app.ad-radar.dev/brands/hearth-and-field"
                  },
                  "stats": {
                    "activeAds": 37,
                    "activeWinners": 4,
                    "totalAds": 52,
                    "medianDaysRunning": 46,
                    "newAds7d": 3,
                    "newAds30d": 11
                  },
                  "activeAdsTrend": [
                    {
                      "date": "2026-11-16",
                      "active": 36,
                      "added": 2,
                      "removed": 1
                    },
                    {
                      "date": "2026-11-17",
                      "active": 37,
                      "added": 1,
                      "removed": 0
                    }
                  ],
                  "spendTrend": [
                    {
                      "weekStart": "2026-11-03",
                      "spendEstimate": 2190400
                    },
                    {
                      "weekStart": "2026-11-10",
                      "spendEstimate": 2410350
                    }
                  ]
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/brands/{id}/hooks": {
      "get": {
        "operationId": "getBrandHooks",
        "tags": [
          "Brands"
        ],
        "summary": "Hooks, mechanisms and angles of a brand",
        "description": "The same data as the MCP tool advertiser_hooks.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Brand id or slug.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandHooks"
                },
                "example": {
                  "brand": {
                    "id": 4182,
                    "slug": "hearth-and-field",
                    "name": "Hearth & Field"
                  },
                  "hooks": [
                    {
                      "dimension": "hook_pattern",
                      "slug": "before-after",
                      "label": "Before / After",
                      "ads": 14
                    },
                    {
                      "dimension": "angle",
                      "slug": "durability",
                      "label": "Durability",
                      "ads": 9
                    }
                  ]
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/patterns": {
      "get": {
        "operationId": "getPatterns",
        "tags": [
          "Insights"
        ],
        "summary": "Winning patterns",
        "description": "For each taxonomy value, how many times more often it appears among winners than on average (lift), with adoption and example ads. Same data as the MCP tool winning_patterns.",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "video",
                "image"
              ],
              "default": "all"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Patterns"
                },
                "example": {
                  "format": "all",
                  "baseline": {
                    "eligible": 2104,
                    "winners": 210,
                    "winnerRate": 0.0998
                  },
                  "doThis": [
                    {
                      "dimension": "hook_pattern",
                      "value": "before-after",
                      "label": "Before / After",
                      "lift": 2.41,
                      "winnerRate": 0.24,
                      "ads": 58,
                      "advertisers": 31,
                      "exampleAdKeys": [
                        "meta:1204518837711490"
                      ]
                    }
                  ],
                  "lower": []
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/taxonomy": {
      "get": {
        "operationId": "getTaxonomy",
        "tags": [
          "Reference"
        ],
        "summary": "Taxonomy and categories",
        "description": "Dimensions and values usable in `tags`, and brand categories usable in `category`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Taxonomy"
                },
                "example": {
                  "dimensions": [
                    {
                      "slug": "awareness",
                      "label": "Awareness level",
                      "multiValue": false,
                      "description": "How aware of the problem the ad assumes the viewer is.",
                      "values": [
                        {
                          "slug": "problem-aware",
                          "label": "Problem-Aware"
                        },
                        {
                          "slug": "unaware",
                          "label": "Unaware"
                        }
                      ]
                    }
                  ],
                  "categories": [
                    {
                      "slug": "kitchen",
                      "brands": 64
                    }
                  ]
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/feed": {
      "get": {
        "operationId": "getFeed",
        "tags": [
          "Sync"
        ],
        "summary": "Incremental feed",
        "x-plan": "scale",
        "description": "Everything new or changed since a cursor (new ads, new measurements, tier changes, delivery changes), ordered by change time, to keep a local copy in sync. Without `since` it starts from the beginning (your first full sync). The response always has `nextCursor`: store it and pass it as `since` next time. Ads that leave the library aren't announced. Scale and Reseller plans.",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "nextCursor from the previous response, or an ISO 8601 date/time to start from.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page, up to 100. Higher values are capped (the response says so in `notice`).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Feed"
                },
                "example": {
                  "data": [
                    {
                      "changedAt": "2026-11-17T07:00:00.000Z",
                      "ad": {
                        "adKey": "meta:1204518837711490",
                        "libraryId": "1204518837711490",
                        "brand": "Hearth & Field",
                        "pageId": "104218839201744",
                        "headline": "The cast-iron skillet that replaced my whole pan drawer",
                        "body": "Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.",
                        "cta": "Shop Now",
                        "transcript": "I used to own nine pans. Now I own one. Here's why...",
                        "translatedFrom": null,
                        "transcriptOriginal": null,
                        "original": null,
                        "startedAt": "2026-08-27",
                        "isActive": true,
                        "spendEstimate": 184205,
                        "spendLowerBound": false,
                        "winnerObservation": {
                          "firstObservedAt": "2026-09-30T07:00:00.000Z",
                          "lastBelowAt": null,
                          "interpretation": "already_winner_when_first_observed"
                        },
                        "delivery": {
                          "key": "running",
                          "en": "Running · checked Nov 17, 2026",
                          "date": "2026-11-17T07:00:00.000Z"
                        },
                        "tags": [
                          {
                            "dimension": "awareness",
                            "slug": "problem-aware",
                            "label": "Problem-Aware"
                          },
                          {
                            "dimension": "hook_pattern",
                            "slug": "before-after",
                            "label": "Before / After"
                          }
                        ],
                        "publisherPlatforms": [
                          "facebook",
                          "instagram"
                        ],
                        "destinationDomain": "hearthandfield.example",
                        "metrics": {
                          "score": 12.84,
                          "tier": "winner",
                          "isFire": true,
                          "lowData": false,
                          "reactions": 9403,
                          "daysRunning": 83,
                          "variants": 6,
                          "capturedAt": "2026-11-17T07:00:00.000Z"
                        },
                        "media": {
                          "kind": "video",
                          "poster": "https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg",
                          "video": "https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4",
                          "durationS": 41
                        },
                        "links": {
                          "radar": "https://app.ad-radar.dev/a/meta%3A1204518837711490",
                          "library": "https://www.facebook.com/ads/library/?id=1204518837711490",
                          "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
                          "post": null,
                          "landing": "https://hearthandfield.example/skillet"
                        },
                        "snapshotAt": "2026-11-18T09:12:44.103Z"
                      }
                    }
                  ],
                  "pagination": {
                    "limit": 100,
                    "hasMore": false,
                    "nextCursor": "c1.ZmVlZ…"
                  }
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/export": {
      "get": {
        "operationId": "getExport",
        "tags": [
          "Sync"
        ],
        "summary": "Full export (NDJSON)",
        "x-plan": "reseller",
        "description": "The whole library as NDJSON, streamed: one Ad object per line, then a control line `{\"type\":\"end\"}`. One call counts as one request; at most 4 exports per day per workspace. If the stream stops early the last line is `{\"type\":\"error\",\"resumeCursor\":…}`: pass it as `after` to resume. Reseller plan.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "resumeCursor of an interrupted export.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ndjson"
              ],
              "default": "ndjson"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "NDJSON stream.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              },
              "X-Export-Total": {
                "description": "Ads in the export.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Ad"
                    },
                    {
                      "$ref": "#/components/schemas/ExportEnd"
                    }
                  ]
                },
                "example": "{\"adKey\": \"meta:1204518837711490\", \"libraryId\": \"1204518837711490\", \"brand\": \"Hearth & Field\", \"pageId\": \"104218839201744\", \"headline\": \"The cast-iron skillet that replaced my whole pan drawer\", \"body\": \"Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.\", \"cta\": \"Shop Now\", \"transcript\": \"I used to own nine pans. Now I own one. Here's why...\", \"translatedFrom\": null, \"transcriptOriginal\": null, \"original\": null, \"startedAt\": \"2026-08-27\", \"isActive\": true, \"spendEstimate\": 184205, \"spendLowerBound\": false, \"winnerObservation\": {\"firstObservedAt\": \"2026-09-30T07:00:00.000Z\", \"lastBelowAt\": null, \"interpretation\": \"already_winner_when_first_observed\"}, \"delivery\": {\"key\": \"running\", \"en\": \"Running · checked Nov 17, 2026\", \"date\": \"2026-11-17T07:00:00.000Z\"}, \"tags\": [{\"dimension\": \"awareness\", \"slug\": \"problem-aware\", \"label\": \"Problem-Aware\"}, {\"dimension\": \"hook_pattern\", \"slug\": \"before-after\", \"label\": \"Before / After\"}], \"publisherPlatforms\": [\"facebook\", \"instagram\"], \"destinationDomain\": \"hearthandfield.example\", \"metrics\": {\"score\": 12.84, \"tier\": \"winner\", \"isFire\": true, \"lowData\": false, \"reactions\": 9403, \"daysRunning\": 83, \"variants\": 6, \"capturedAt\": \"2026-11-17T07:00:00.000Z\"}, \"media\": {\"kind\": \"video\", \"poster\": \"https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg\", \"video\": \"https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4\", \"durationS\": 41}, \"links\": {\"radar\": \"https://app.ad-radar.dev/a/meta%3A1204518837711490\", \"library\": \"https://www.facebook.com/ads/library/?id=1204518837711490\", \"libraryPage\": \"https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744\", \"post\": null, \"landing\": \"https://hearthandfield.example/skillet\"}, \"snapshotAt\": \"2026-11-18T09:12:44.103Z\"}\n{\"type\": \"end\", \"ads\": 2288, \"total\": 2288, \"generatedAt\": \"2026-11-18T09:00:00.000Z\", \"resumeCursor\": null}"
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "429": {
            "description": "Request quota, rate limit, or the daily export limit (`code: export_limit`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/QuotaExceeded"
                    },
                    {
                      "$ref": "#/components/schemas/RateLimited"
                    },
                    {
                      "$ref": "#/components/schemas/Error"
                    }
                  ]
                },
                "example": {
                  "error": "Export limit reached: at most 4 full exports per day per workspace. Use /feed to stay in sync between exports, or try again after midnight UTC.",
                  "code": "export_limit",
                  "limit": 4
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "Account"
        ],
        "summary": "Plan, quota and usage",
        "x-billable": false,
        "description": "Your plan, quota, requests used and left, period end, rate limit and features. Doesn't count as a request, and answers even without a Data API plan (`plan: none`).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                },
                "example": {
                  "plan": "builder",
                  "planName": "Builder",
                  "unlimited": false,
                  "quota": {
                    "limit": 10000,
                    "used": 126,
                    "remaining": 9874,
                    "window": "period",
                    "periodStart": "2026-11-16T09:30:00.000Z",
                    "resetsAt": "2026-12-14T09:30:00.000Z"
                  },
                  "rateLimit": {
                    "perMinute": 60
                  },
                  "maxPageSize": 100,
                  "features": {
                    "rest": true,
                    "mcp": true,
                    "feed": false,
                    "export": false,
                    "resale": false,
                    "whiteLabel": false
                  },
                  "subscription": {
                    "status": "active",
                    "cancelAtPeriodEnd": false,
                    "renewsAt": "2026-12-14T09:30:00.000Z"
                  },
                  "links": {
                    "dashboard": "https://app.ad-radar.dev/settings/api",
                    "docs": "https://ad-radar.dev/docs/api",
                    "upgrade": "https://app.ad-radar.dev/checkout?plan=api-scale"
                  },
                  "tracking": true,
                  "workspace": {
                    "name": "Acme Growth"
                  },
                  "appAccess": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "tags": [
          "Reference"
        ],
        "summary": "This specification",
        "x-billable": false,
        "security": [],
        "description": "The OpenAPI 3.1 document of the Data API. Public, no key needed.",
        "responses": {
          "200": {
            "description": "OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key (`ar_live_…`) from https://app.ad-radar.dev/settings/api."
      }
    },
    "schemas": {
      "Ad": {
        "type": "object",
        "description": "One ad, the same object from every endpoint (search, winners, feed, export, lookups by key). Every ad in the library has at least $50,000 estimated spend.",
        "required": [
          "adKey",
          "brand",
          "headline",
          "body",
          "startedAt",
          "isActive",
          "spendEstimate",
          "spendLowerBound",
          "winnerObservation",
          "delivery",
          "tags",
          "publisherPlatforms",
          "destinationDomain",
          "metrics",
          "media",
          "links",
          "snapshotAt"
        ],
        "properties": {
          "adKey": {
            "type": "string",
            "description": "Permanent key of the ad: `<platform>:<id>`. Use it with GET /ads/{key}.",
            "examples": [
              "meta:1204518837711490"
            ]
          },
          "libraryId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Meta Ad Library id, when known."
          },
          "brand": {
            "type": [
              "string",
              "null"
            ],
            "description": "Advertiser (Facebook page) name."
          },
          "pageId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Facebook page id of the advertiser."
          },
          "headline": {
            "type": [
              "string",
              "null"
            ],
            "description": "Headline in English. When the ad runs in another language this is the English translation and `original` holds the original text."
          },
          "body": {
            "type": [
              "string",
              "null"
            ],
            "description": "Primary text in English (same rule as headline)."
          },
          "cta": {
            "type": [
              "string",
              "null"
            ],
            "description": "Call-to-action button text."
          },
          "transcript": {
            "type": [
              "string",
              "null"
            ],
            "description": "Spoken script of a video ad, in English."
          },
          "translatedFrom": {
            "type": [
              "string",
              "null"
            ],
            "description": "Language of the original script when `transcript` is a translation."
          },
          "transcriptOriginal": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "lang",
                  "text"
                ],
                "properties": {
                  "lang": {
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  }
                }
              }
            ],
            "description": "Original script when the ad is not in English."
          },
          "original": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "lang"
                ],
                "properties": {
                  "lang": {
                    "type": "string"
                  },
                  "headline": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "body": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            ],
            "description": "Original copy when the ad runs in a language other than English."
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Day the ad started running."
          },
          "isActive": {
            "type": "boolean",
            "description": "Running at the last check."
          },
          "spendEstimate": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Estimated spend in US dollars: round(metrics.reactions × 19.59). An estimate based on engagement, not reported spend; null when the ad has no measurement yet."
          },
          "spendLowerBound": {
            "type": "boolean",
            "description": "true = spendEstimate is a minimum (\"at least $X\")."
          },
          "winnerObservation": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WinnerObservation"
              }
            ]
          },
          "delivery": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Delivery"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tag"
            },
            "description": "Taxonomy values (see GET /taxonomy)."
          },
          "publisherPlatforms": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "examples": [
              [
                "facebook",
                "instagram"
              ]
            ]
          },
          "destinationDomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "Domain of the landing page."
          },
          "metrics": {
            "$ref": "#/components/schemas/AdMetrics"
          },
          "media": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AdMedia"
              }
            ]
          },
          "links": {
            "$ref": "#/components/schemas/AdLinks"
          },
          "snapshotAt": {
            "type": "string",
            "format": "date-time",
            "description": "When this object was built."
          }
        },
        "examples": [
          {
            "adKey": "meta:1204518837711490",
            "libraryId": "1204518837711490",
            "brand": "Hearth & Field",
            "pageId": "104218839201744",
            "headline": "The cast-iron skillet that replaced my whole pan drawer",
            "body": "Pre-seasoned, oven-safe to 500°F and made to outlive you. Free shipping this week.",
            "cta": "Shop Now",
            "transcript": "I used to own nine pans. Now I own one. Here's why...",
            "translatedFrom": null,
            "transcriptOriginal": null,
            "original": null,
            "startedAt": "2026-08-27",
            "isActive": true,
            "spendEstimate": 184205,
            "spendLowerBound": false,
            "winnerObservation": {
              "firstObservedAt": "2026-09-30T07:00:00.000Z",
              "lastBelowAt": null,
              "interpretation": "already_winner_when_first_observed"
            },
            "delivery": {
              "key": "running",
              "en": "Running · checked Nov 17, 2026",
              "date": "2026-11-17T07:00:00.000Z"
            },
            "tags": [
              {
                "dimension": "awareness",
                "slug": "problem-aware",
                "label": "Problem-Aware"
              },
              {
                "dimension": "hook_pattern",
                "slug": "before-after",
                "label": "Before / After"
              }
            ],
            "publisherPlatforms": [
              "facebook",
              "instagram"
            ],
            "destinationDomain": "hearthandfield.example",
            "metrics": {
              "score": 12.84,
              "tier": "winner",
              "isFire": true,
              "lowData": false,
              "reactions": 9403,
              "daysRunning": 83,
              "variants": 6,
              "capturedAt": "2026-11-17T07:00:00.000Z"
            },
            "media": {
              "kind": "video",
              "poster": "https://app.ad-radar.dev/api/media/radar-posters/3f1c…e9.jpg",
              "video": "https://app.ad-radar.dev/api/media/radar-videos/8a02…41.mp4",
              "durationS": 41
            },
            "links": {
              "radar": "https://app.ad-radar.dev/a/meta%3A1204518837711490",
              "library": "https://www.facebook.com/ads/library/?id=1204518837711490",
              "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
              "post": null,
              "landing": "https://hearthandfield.example/skillet"
            },
            "snapshotAt": "2026-11-18T09:12:44.103Z"
          }
        ]
      },
      "AdMetrics": {
        "type": "object",
        "required": [
          "score",
          "tier",
          "isFire",
          "lowData",
          "reactions",
          "daysRunning",
          "variants",
          "capturedAt"
        ],
        "properties": {
          "score": {
            "type": [
              "number",
              "null"
            ],
            "description": "Ad Radar score (higher = stronger momentum)."
          },
          "tier": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "winner",
              "rising",
              null
            ],
            "description": "winner = top 10% by score and running 21+ days; rising = growing fast; null = neither."
          },
          "isFire": {
            "type": "boolean",
            "description": "Score in the top 5% of the library."
          },
          "lowData": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Too little engagement measured yet to rank it (\"in testing\")."
          },
          "reactions": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Reactions (like, love, wow and similar, summed over every post of the ad; comments and shares excluded) at the last measurement. spendEstimate = round(reactions × SPEND_PER_REACTION)."
          },
          "daysRunning": {
            "type": [
              "integer",
              "null"
            ]
          },
          "variants": {
            "type": "integer",
            "description": "Creative variants of the same ad."
          },
          "capturedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Last engagement measurement."
          }
        }
      },
      "AdMedia": {
        "type": "object",
        "required": [
          "kind",
          "poster",
          "video",
          "durationS"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "video",
              "image",
              "carousel",
              "text"
            ]
          },
          "poster": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Public image URL (supports Range, CORS open)."
          },
          "video": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Public video URL (MP4)."
          },
          "durationS": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "AdLinks": {
        "type": "object",
        "required": [
          "radar",
          "library",
          "libraryPage",
          "post",
          "landing"
        ],
        "properties": {
          "radar": {
            "type": "string",
            "format": "uri",
            "description": "Permalink in the Ad Radar app."
          },
          "library": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The ad in the Meta Ad Library."
          },
          "libraryPage": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The advertiser in the Meta Ad Library."
          },
          "post": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The Facebook post of the ad."
          },
          "landing": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Landing page."
          }
        }
      },
      "WinnerObservation": {
        "type": "object",
        "required": [
          "firstObservedAt",
          "lastBelowAt",
          "interpretation"
        ],
        "properties": {
          "firstObservedAt": {
            "type": "string",
            "format": "date-time",
            "description": "First time we observed the ad above $50,000 estimated spend."
          },
          "lastBelowAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "interpretation": {
            "type": "string",
            "enum": [
              "already_winner_when_first_observed",
              "crossed_between_observations"
            ]
          }
        }
      },
      "Delivery": {
        "type": "object",
        "required": [
          "key",
          "en",
          "date"
        ],
        "properties": {
          "key": {
            "type": "string",
            "enum": [
              "running",
              "stopped",
              "not_seen",
              "unknown"
            ]
          },
          "en": {
            "type": "string",
            "description": "Label to show, e.g. \"Running · checked Nov 17, 2026\"."
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Tag": {
        "type": "object",
        "required": [
          "dimension",
          "slug",
          "label"
        ],
        "properties": {
          "dimension": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "required": [
          "limit",
          "hasMore",
          "nextCursor"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "description": "Results per page actually applied (capped by your plan)."
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass it as `cursor` (or `since` for /feed) to get the next page. Opaque: don't parse or build it."
          }
        }
      },
      "AdList": {
        "type": "object",
        "required": [
          "data",
          "pagination",
          "total"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ad"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "total": {
            "type": "integer",
            "description": "Ads matching the filters."
          },
          "notice": {
            "type": "string",
            "description": "Present when a request was adjusted, e.g. limit capped by the plan."
          }
        }
      },
      "AdBatch": {
        "type": "object",
        "required": [
          "ads",
          "missing"
        ],
        "properties": {
          "ads": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/Ad"
            },
            "description": "Ads by canonical adKey."
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Keys that don't exist or aren't available."
          },
          "asked": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Requested key -> canonical adKey, when you asked with a different form (e.g. a bare id)."
          }
        }
      },
      "Brand": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "pageId",
          "domain",
          "categories",
          "activeAds",
          "activeWinners",
          "ads",
          "spendEstimate",
          "lastSeenAt",
          "lastLaunchAt",
          "activeAdsTrend",
          "links"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "Brand id (also accepted: slug)."
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "activeAds": {
            "type": "integer"
          },
          "activeWinners": {
            "type": "integer",
            "description": "Active ads in the winner tier."
          },
          "ads": {
            "type": "integer",
            "description": "Ads of the brand in the library (active and stopped)."
          },
          "spendEstimate": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Sum of the estimated spend of the brand's ads in the library, US dollars."
          },
          "lastSeenAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastLaunchAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Start day of the brand's newest ad."
          },
          "activeAdsTrend": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Active ads per day, last 30 days, oldest first."
          },
          "links": {
            "type": "object",
            "properties": {
              "libraryPage": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "radar": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "examples": [
          {
            "id": 4182,
            "slug": "hearth-and-field",
            "name": "Hearth & Field",
            "pageId": "104218839201744",
            "domain": "hearthandfield.example",
            "categories": [
              "home",
              "kitchen"
            ],
            "activeAds": 37,
            "activeWinners": 4,
            "ads": 52,
            "spendEstimate": 2410350,
            "lastSeenAt": "2026-11-17T07:00:00.000Z",
            "lastLaunchAt": "2026-11-12",
            "activeAdsTrend": [
              31,
              31,
              32,
              34,
              33,
              35,
              37
            ],
            "links": {
              "libraryPage": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=104218839201744",
              "radar": "https://app.ad-radar.dev/brands/hearth-and-field"
            }
          }
        ]
      },
      "BrandList": {
        "type": "object",
        "required": [
          "data",
          "pagination",
          "total"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Brand"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "total": {
            "type": "integer"
          },
          "notice": {
            "type": "string"
          }
        }
      },
      "BrandDetail": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "stats",
          "activeAdsTrend",
          "spendTrend",
          "spendEstimate"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ads": {
            "type": "integer"
          },
          "spendEstimate": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lastSeenAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "stats": {
            "type": "object",
            "properties": {
              "activeAds": {
                "type": "integer"
              },
              "activeWinners": {
                "type": "integer"
              },
              "totalAds": {
                "type": "integer"
              },
              "medianDaysRunning": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "newAds7d": {
                "type": "integer"
              },
              "newAds30d": {
                "type": "integer"
              }
            }
          },
          "activeAdsTrend": {
            "type": "array",
            "description": "Daily, last 90 days.",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "active": {
                  "type": "integer"
                },
                "added": {
                  "type": "integer"
                },
                "removed": {
                  "type": "integer"
                }
              }
            }
          },
          "spendTrend": {
            "type": "array",
            "description": "Weekly (Monday, UTC), last 12 weeks: total estimated spend of the brand's ads as of the end of that week.",
            "items": {
              "type": "object",
              "properties": {
                "weekStart": {
                  "type": "string",
                  "format": "date"
                },
                "spendEstimate": {
                  "type": "integer"
                }
              }
            }
          },
          "links": {
            "type": "object",
            "properties": {
              "libraryPage": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "radar": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "BrandHooks": {
        "type": "object",
        "required": [
          "brand",
          "hooks"
        ],
        "properties": {
          "brand": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "hooks": {
            "type": "array",
            "description": "Most used values, counted over all the brand's ads (values used by at least 2 ads, top 12).",
            "items": {
              "type": "object",
              "required": [
                "dimension",
                "slug",
                "label",
                "ads"
              ],
              "properties": {
                "dimension": {
                  "type": "string",
                  "enum": [
                    "hook_pattern",
                    "hook_mechanism",
                    "angle"
                  ]
                },
                "slug": {
                  "type": "string",
                  "description": "Usable in /ads/search?tags=dimension:slug"
                },
                "label": {
                  "type": "string"
                },
                "ads": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Pattern": {
        "type": "object",
        "required": [
          "dimension",
          "value",
          "label",
          "lift",
          "winnerRate",
          "ads",
          "advertisers",
          "exampleAdKeys"
        ],
        "properties": {
          "dimension": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "description": "Taxonomy slug."
          },
          "label": {
            "type": "string"
          },
          "lift": {
            "type": "number",
            "description": "Winner rate of the value / average winner rate. 2.0 = twice as likely to be a winner."
          },
          "winnerRate": {
            "type": "number"
          },
          "ads": {
            "type": "integer"
          },
          "advertisers": {
            "type": "integer"
          },
          "exampleAdKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Patterns": {
        "type": "object",
        "required": [
          "format",
          "baseline",
          "doThis",
          "lower"
        ],
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "all",
              "video",
              "image"
            ]
          },
          "baseline": {
            "type": "object",
            "properties": {
              "eligible": {
                "type": "integer"
              },
              "winners": {
                "type": "integer"
              },
              "winnerRate": {
                "type": "number"
              }
            }
          },
          "doThis": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Pattern"
            },
            "description": "Values above average (lift >= 1.3)."
          },
          "lower": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Pattern"
            },
            "description": "Values below average (lift <= 0.75)."
          }
        }
      },
      "Taxonomy": {
        "type": "object",
        "required": [
          "dimensions",
          "categories"
        ],
        "properties": {
          "dimensions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "slug",
                "label",
                "values"
              ],
              "properties": {
                "slug": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "multiValue": {
                  "type": "boolean"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "values": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "slug": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "categories": {
            "type": "array",
            "description": "Brand categories (filter `category`), with how many brands use them.",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "brands": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "FeedItem": {
        "type": "object",
        "required": [
          "changedAt",
          "ad"
        ],
        "properties": {
          "changedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the ad last changed (new ad, new measurement, tier change, delivery change)."
          },
          "ad": {
            "$ref": "#/components/schemas/Ad"
          }
        }
      },
      "Feed": {
        "type": "object",
        "required": [
          "data",
          "pagination"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedItem"
            }
          },
          "pagination": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Pagination"
              }
            ],
            "description": "nextCursor is always present: store it and pass it as `since` on your next sync."
          },
          "notice": {
            "type": "string"
          }
        }
      },
      "Me": {
        "type": "object",
        "required": [
          "plan",
          "planName",
          "unlimited",
          "quota",
          "rateLimit",
          "maxPageSize",
          "features",
          "links"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "none",
              "builder",
              "scale",
              "reseller"
            ],
            "description": "`none` = no Data API plan: the Data API endpoints answer 403 `plan_required` until you buy Builder or Scale."
          },
          "planName": {
            "type": "string"
          },
          "unlimited": {
            "type": "boolean"
          },
          "quota": {
            "type": "object",
            "required": [
              "limit",
              "used",
              "remaining",
              "window",
              "periodStart",
              "resetsAt"
            ],
            "properties": {
              "limit": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "used": {
                "type": "integer"
              },
              "remaining": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "window": {
                "type": "string",
                "enum": [
                  "none",
                  "period"
                ],
                "description": "period = your 4-week billing period; none = no Data API plan (limit 0)."
              },
              "periodStart": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "resetsAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "rateLimit": {
            "type": "object",
            "properties": {
              "perMinute": {
                "type": "integer"
              }
            }
          },
          "maxPageSize": {
            "type": "integer"
          },
          "features": {
            "type": "object",
            "properties": {
              "rest": {
                "type": "boolean"
              },
              "mcp": {
                "type": "boolean"
              },
              "feed": {
                "type": "boolean"
              },
              "export": {
                "type": "boolean"
              },
              "resale": {
                "type": "boolean"
              },
              "whiteLabel": {
                "type": "boolean"
              }
            }
          },
          "subscription": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "cancelAtPeriodEnd": {
                    "type": "boolean"
                  },
                  "renewsAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  }
                }
              }
            ]
          },
          "workspace": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              }
            }
          },
          "appAccess": {
            "type": "boolean",
            "description": "The key's owner can also sign in to the Ad Radar web app."
          },
          "links": {
            "type": "object",
            "properties": {
              "dashboard": {
                "type": "string",
                "format": "uri"
              },
              "docs": {
                "type": "string",
                "format": "uri"
              },
              "upgrade": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              }
            }
          },
          "tracking": {
            "type": "boolean"
          }
        }
      },
      "ExportEnd": {
        "type": "object",
        "description": "Last line of an export (control line, has `type`). Ad lines never have a `type` field.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "end",
              "error"
            ]
          },
          "ads": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": "string"
          },
          "resumeCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "On `error`: pass it as `after` to resume the export."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message in English. Safe to show to your users."
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable code.",
            "examples": [
              "invalid_parameter"
            ]
          },
          "param": {
            "type": "string",
            "description": "The query parameter that failed validation, when there is one."
          }
        }
      },
      "QuotaExceeded": {
        "type": "object",
        "required": [
          "error",
          "code",
          "plan",
          "limit",
          "used",
          "remaining",
          "resetsAt",
          "upgradeUrl"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "const": "quota_exceeded"
          },
          "reason": {
            "const": "api_quota"
          },
          "plan": {
            "type": "string"
          },
          "limit": {
            "type": "integer"
          },
          "used": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer"
          },
          "resetsAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "End of the billing period, when the quota renews."
          },
          "retryAfter": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Seconds until the quota renews."
          },
          "upgradeUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "RateLimited": {
        "type": "object",
        "required": [
          "error",
          "code",
          "limit",
          "retryAfter"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "const": "rate_limited"
          },
          "plan": {
            "type": "string"
          },
          "limit": {
            "type": "integer"
          },
          "retryAfter": {
            "type": "integer"
          },
          "upgradeUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "PlanRequired": {
        "type": "object",
        "required": [
          "error",
          "code",
          "plan",
          "requiredPlan",
          "upgradeUrl"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "const": "plan_required"
          },
          "plan": {
            "type": "string",
            "description": "Your current Data API plan (`none` without one)."
          },
          "requiredPlan": {
            "type": "string",
            "enum": [
              "builder",
              "scale",
              "reseller"
            ]
          },
          "upgradeUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid parameter. Validation errors don't count as a request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "tier must be \"winner\" or \"rising\".",
              "code": "invalid_parameter",
              "param": "tier"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, invalid, revoked or expired API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "missing": {
                "value": {
                  "error": "Missing API token. Send Authorization: Bearer <token>.",
                  "code": "token_missing"
                }
              },
              "invalid": {
                "value": {
                  "error": "Invalid API token.",
                  "code": "token_invalid"
                }
              },
              "revoked": {
                "value": {
                  "error": "This API token was revoked. Create a new one in Settings → API.",
                  "code": "token_revoked"
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The key can't be used here: no Data API plan (`plan_required`, nothing is counted), wrong scope, or the account is no longer active.",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/PlanRequired"
                },
                {
                  "$ref": "#/components/schemas/Error"
                }
              ]
            },
            "examples": {
              "no_data_api_plan": {
                "summary": "No Data API plan",
                "value": {
                  "error": "This endpoint is part of the Ad Radar Data API, which needs a Data API plan: Builder ($299 every 4 weeks, 10,000 requests) or Scale ($799, 50,000 requests and the incremental feed). Your app plan keeps Claude (MCP) and lookups by key (GET /ads, GET /ads/{key}). Get the Data API: https://app.ad-radar.dev/checkout?plan=api-builder",
                  "code": "plan_required",
                  "plan": "none",
                  "requiredPlan": "builder",
                  "upgradeUrl": "https://app.ad-radar.dev/checkout?plan=api-builder"
                }
              },
              "inactive": {
                "summary": "Account no longer active",
                "value": {
                  "error": "Your Ad Radar membership is not active.",
                  "code": "subscription_inactive"
                }
              }
            }
          }
        }
      },
      "PlanRequired": {
        "description": "The endpoint needs a higher plan.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlanRequired"
            },
            "example": {
              "error": "The incremental feed (/feed) is included in the Scale plan and above. Your workspace is on Builder. Upgrade: https://app.ad-radar.dev/checkout?plan=api-scale",
              "code": "plan_required",
              "plan": "builder",
              "requiredPlan": "scale",
              "upgradeUrl": "https://app.ad-radar.dev/checkout?plan=api-scale"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not found. Counts as a request.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          },
          "X-Quota-Limit": {
            "$ref": "#/components/headers/X-Quota-Limit"
          },
          "X-Quota-Remaining": {
            "$ref": "#/components/headers/X-Quota-Remaining"
          },
          "X-Quota-Reset": {
            "$ref": "#/components/headers/X-Quota-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Ad not found",
              "code": "not_found"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limit (per minute) or request quota reached. Never a silently shortened list: the body says which limit and how to raise it.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          },
          "X-Quota-Limit": {
            "$ref": "#/components/headers/X-Quota-Limit"
          },
          "X-Quota-Remaining": {
            "$ref": "#/components/headers/X-Quota-Remaining"
          },
          "X-Quota-Reset": {
            "$ref": "#/components/headers/X-Quota-Reset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/QuotaExceeded"
                },
                {
                  "$ref": "#/components/schemas/RateLimited"
                }
              ]
            },
            "examples": {
              "period_quota": {
                "summary": "Builder: period quota used",
                "value": {
                  "error": "Request quota reached: your workspace has used 10,000 of 10,000 requests this billing period. It resets on Dec 14, 2026 (UTC). Upgrade to Scale for 50,000 requests per period: https://app.ad-radar.dev/checkout?plan=api-scale",
                  "code": "quota_exceeded",
                  "reason": "api_quota",
                  "plan": "builder",
                  "limit": 10000,
                  "used": 10000,
                  "remaining": 0,
                  "resetsAt": "2026-12-14T09:30:00.000Z",
                  "retryAfter": 2246400,
                  "upgradeUrl": "https://app.ad-radar.dev/checkout?plan=api-scale"
                }
              },
              "rate_limited": {
                "summary": "Too many requests this minute",
                "value": {
                  "error": "Rate limit reached: at most 60 requests per minute on the Builder plan. Try again in 12 seconds.",
                  "code": "rate_limited",
                  "plan": "builder",
                  "limit": 60,
                  "retryAfter": 12,
                  "upgradeUrl": "https://app.ad-radar.dev/checkout?plan=api-scale"
                }
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "Our side failed. The request is refunded.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                },
                "errorId": {
                  "type": "string"
                },
                "retry": {
                  "type": "boolean"
                }
              }
            },
            "example": {
              "error": "Something went wrong. Please try again.",
              "errorId": "a1b2c3d4"
            }
          }
        }
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "Results per page, up to 100. Higher values are capped (the response says so in `notice`).",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "description": "`pagination.nextCursor` from the previous page. Only valid with the same filters.",
        "schema": {
          "type": "string"
        }
      },
      "q": {
        "name": "q",
        "in": "query",
        "description": "Free text over headline, body, brand name and transcript.",
        "schema": {
          "type": "string",
          "maxLength": 300
        },
        "example": "skillet"
      },
      "brand": {
        "name": "brand",
        "in": "query",
        "description": "Only ads of this brand: id or slug from GET /brands.",
        "schema": {
          "type": "string"
        },
        "example": "hearth-and-field"
      },
      "format": {
        "name": "format",
        "in": "query",
        "description": "Creative type, one or more comma separated.",
        "schema": {
          "type": "string"
        },
        "example": "video"
      },
      "tags": {
        "name": "tags",
        "in": "query",
        "description": "Taxonomy filters as dimension:value pairs from GET /taxonomy, comma separated. Different dimensions are ANDed, values of the same dimension ORed.",
        "schema": {
          "type": "string"
        },
        "example": "awareness:problem-aware,hook_pattern:before-after"
      },
      "category": {
        "name": "category",
        "in": "query",
        "description": "Brand category slugs from GET /taxonomy, comma separated.",
        "schema": {
          "type": "string"
        },
        "example": "kitchen"
      },
      "country": {
        "name": "country",
        "in": "query",
        "description": "Not available yet: returns 400 `unsupported_filter`. The library tracks ads across every country of the Meta Ad Library; per-ad delivery countries aren't collected.",
        "schema": {
          "type": "string"
        },
        "deprecated": false
      },
      "started_after": {
        "name": "started_after",
        "in": "query",
        "description": "Ads that started on or after this day.",
        "schema": {
          "type": "string",
          "format": "date"
        },
        "example": "2026-09-01"
      },
      "started_before": {
        "name": "started_before",
        "in": "query",
        "description": "Ads that started on or before this day.",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "min_spend": {
        "name": "min_spend",
        "in": "query",
        "description": "Minimum estimated spend in US dollars.",
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "example": 100000
      },
      "sort": {
        "name": "sort",
        "in": "query",
        "description": "score (default), spend, rpd (engagement per day), days (days running), recent (newest in the library), started (start date).",
        "schema": {
          "type": "string",
          "enum": [
            "score",
            "spend",
            "rpd",
            "days",
            "recent",
            "started"
          ],
          "default": "score"
        }
      },
      "order": {
        "name": "order",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "desc",
            "asc"
          ],
          "default": "desc"
        }
      }
    },
    "headers": {
      "X-RateLimit-Limit": {
        "description": "Requests allowed per minute on your plan.",
        "schema": {
          "type": "integer"
        },
        "example": 60
      },
      "X-RateLimit-Remaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        },
        "example": 59
      },
      "X-RateLimit-Reset": {
        "description": "Seconds until the current minute window resets.",
        "schema": {
          "type": "integer"
        },
        "example": 42
      },
      "X-Quota-Limit": {
        "description": "Requests included in your billing period.",
        "schema": {
          "type": "integer"
        },
        "example": 10000
      },
      "X-Quota-Remaining": {
        "description": "Requests left in the quota window.",
        "schema": {
          "type": "integer"
        },
        "example": 9874
      },
      "X-Quota-Reset": {
        "description": "End of the billing period in ISO 8601 (UTC), when the quota renews.",
        "schema": {
          "type": "string"
        },
        "example": "2026-12-14T09:30:00.000Z"
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      }
    }
  }
}
