The short answer
You can build an ad spy tool with AI in an afternoon: Claude Code, Cursor, Lovable or Bolt will generate the search page, ad cards, video player, brand pages and saved boards in hours. What they cannot generate is the data: daily history, spend estimates, transcripts and tags. Point the build at the Ad Radar Data API and its OpenAPI spec, and the copy-paste prompt below produces a working Next.js swipe-file app on 2,761 winning Meta ads with the key kept server side.
In this article8 sections
What AI builds in hours, and what it can't
If you want to build an ad spy tool with AI, the good news is real: Claude Code, Cursor, Lovable and Bolt are now very good at the visible part. Describe a searchable board of video ads with filters, a detail page and saved collections, and you will have something that looks like Foreplay or Ad Radar by dinner.
The bad news is that the visible part was never the product. An ad spy tool is a data business with a UI on top. Here is how the work actually splits:
| Part | Can an AI coding tool build it in an afternoon? | Why |
|---|---|---|
| Search page, filters, ad cards, video player | Yes | Standard UI, well represented in training data |
| Ad detail page, brand pages, saved boards | Yes | CRUD and layout |
| Auth, billing, deploy | Mostly | Well-documented libraries |
| Daily collection of every active ad | No | Needs a running pipeline, not code that compiles |
| History (days running, variants over time) | No | Exists only from the day you start recording; cannot be generated |
| Spend estimates for commercial ads | No | Meta doesn't publish them; you need a model and data to calibrate it |
| Video transcripts | No | Needs media you downloaded before Meta's URLs expired, then speech-to-text at scale |
| Tags (hook, angle, awareness, format) | No | Needs a fixed taxonomy and every ad run through it |
| Ranking "what's winning" | No | Needs all of the above |
The top three rows are the part you can vibe-code. Everything below them is a pipeline that has to run every day, for months, before the first screen is worth looking at. Our ad spy tool architecture guide breaks that pipeline down component by component.
Why "just have the AI scrape the Ad Library" fails
The first instinct is to type "write a scraper for the Facebook Ad Library" into the agent. It will happily produce a Playwright script, and it may even work on the day you test it. Then:
- The page changes. Scrapers read an interface built for people. When the markup or the internal requests change, the scraper returns nothing, and you find out from an empty board.
- Anti-bot checks kick in once you run it daily across hundreds of brands, and now you are managing proxies instead of building a product.
- Media expires. Video and image URLs on Meta's CDN are signed and short-lived. If you didn't download the file during the scrape, the thumbnail is dead within days.
- There is no spend. Meta's own Ad Library API returns spend only for political and issue ads, and returns commercial ads only if they delivered in the EU.
- There is no history. Outside the EU, an ad leaves the public library when it stops running. Your tool knows nothing about anything that ran before your first scrape.
None of that is a coding problem an agent can solve in one session. It is an operations problem, and the details are in our scraping guide. The fast path is to skip it: build only the app, and read the data from an API that already did the hard part.
The stack: Next.js on the Ad Radar Data API
The Ad Radar Facebook ads API serves Meta ads (Facebook and Instagram) with $50k+ estimated spend, built from the public Meta Ad Library and refreshed every day. Every ad comes scored, tiered (winner or rising), transcribed and tagged on ten dimensions, with public poster and MP4 URLs served by Ad Radar, so the media never expires on you.
2,761
Meta ads with $50k+ estimated spend
782
brands
10
tag dimensions per ad
OpenAPI 3.1
spec for your AI tool to read
Three properties make it a good fit for AI-built apps:
- An OpenAPI 3.1 spec at
https://app.ad-radar.dev/api/v1/openapi.json. Give it to the agent and it writes against the real contract: exact field names, parameters and error shapes, instead of guessing. - One object shape everywhere. An ad from
/ads/search,/winnersor/ads/{key}is the same object, so the agent writes oneAdCardcomponent and reuses it. - Plain REST with a Bearer key, JSON responses, cursor pagination with up to 100 results per page, and error bodies with a human-readable
errorthat is safe to show to users.
The endpoints a swipe-file app needs:
| Endpoint | Screen |
|---|---|
GET / | Home: search by text (copy and transcript), brand, format, tier, tags, start dates, min estimated spend; sort by score, spend, days |
GET / | Ad detail: copy, transcript, tags, signals, media, links |
GET / | Saved board: up to 100 ads by key in one request |
GET /, GET / | Brand pages: active ads trend, launches, estimated spend trend |
GET / | The brand's hook, mechanism and angle mix |
GET / | "New this week" feed |
GET / | What wins more often than the baseline |
GET / | Filter dropdowns |
The prompt
Paste this into Claude Code or Cursor's agent in an empty folder. It is written to produce a working app in one pass and to avoid the two classic vibe-coding mistakes: a key in the browser, and invented API fields.
Build a Next.js (App Router, TypeScript, Tailwind) web app called "Swipe": a
searchable swipe file of winning Meta ads, powered by the Ad Radar Data API.
DATA CONTRACT
- Read the OpenAPI 3.1 spec first: https://app.ad-radar.dev/api/v1/openapi.json
Generate types from it with `npx openapi-typescript <spec-url> -o lib/adradar-types.ts`
and use ONLY fields and parameters that exist in the spec. Do not invent fields.
- Base URL https://app.ad-radar.dev/api/v1, header `Authorization: Bearer ${AD_RADAR_KEY}`.
- Lists return { data, pagination: { limit, hasMore, nextCursor }, total }.
Paginate with `cursor` = pagination.nextCursor. Max limit 100.
SECURITY
- Call the API only from server code (server components, route handlers,
server actions) through one helper in lib/adradar.ts that imports "server-only".
- Read the key from process.env.AD_RADAR_KEY. Never use a NEXT_PUBLIC_ prefix.
Add .env.local to .gitignore and create .env.example with AD_RADAR_KEY=.
- Cache GET responses with fetch(..., { next: { revalidate: 3600 } }); the data
refreshes daily.
- Map 429 responses (code quota_exceeded or rate_limited) to a friendly banner;
show the API's `error` message for other errors.
PAGES
1. "/" Search. A search box (q searches headline, body, brand and transcript),
filters: format (video/image), tier (winner/rising), min estimated spend,
started_after, and tag filters built from GET /taxonomy (dimension:value,
comma separated in the `tags` param). Sort: score, spend, days, recent.
Results as a responsive grid of AdCards with "Load more" using the cursor.
Keep all filters in the URL query string so searches are shareable.
2. AdCard: media.poster image (play media.video on click, muted, inline),
brand, headline, first sentence of transcript (or body) as "Hook",
"Est. spend $X" (always the word estimated), metrics.daysRunning days,
metrics.variants variants, tier badge, up to 3 tag labels, a Save button.
3. "/ad/[key]" Detail from GET /ads/{key} (encode the key, it contains ":").
Full copy, full transcript in a readable column, all tags grouped by
dimension, signals table, links to links.library and links.landing,
and a "Copy brief" button that copies a markdown brief: brand, hook,
script split into hook / body / CTA, tags, est. spend, days running.
4. "/brands/[slug]" from GET /brands/{id} (slug is accepted as id): stats,
a 90-day sparkline of activeAdsTrend[].active, the 12-week spendTrend,
the hook mix from GET /brands/{id}/hooks as a bar list, and the brand's
ads from /ads/search?brand=<slug>&sort=score.
5. "/new" New winners this week: GET /winners?since=<7 days ago, YYYY-MM-DD>.
6. "/saved" Boards. Store ONLY adKeys plus user notes and board names
(SQLite via Drizzle, file data/swipe.db). Render a board by calling
GET /ads?keys=<up to 100 comma-separated keys>, and list `missing` keys.
Do not copy ad content into the database.
QUALITY
- Clean, dense, light UI. Cards in a 4-column grid on desktop, 1 on mobile.
- Loading skeletons, empty states with a suggestion ("try fewer filters").
- No placeholder data and no mock API: every screen reads the real API.
- Add a README with setup steps (npm i, copy .env.example, npm run dev).
When done, run the build, fix all type errors, and tell me which files to read first.
A few choices in that prompt are deliberate:
- "Use only fields that exist in the spec" plus generated types is what stops the agent from inventing
ad.spendorad.hookfields that don't exist. With types in place, a wrong field is a compile error the agent fixes itself. server-onlyand noNEXT_PUBLIC_keep the key out of the browser bundle. Next.js inlinesNEXT_PUBLIC_variables into the JavaScript it ships, so anything with that prefix is public.- Store keys, not ads. Saved boards hold
adKeyand your notes, and fetch fresh data withGET /ads?keys=, which takes up to 100 keys per request. The board always shows the current estimated spend, days running and delivery status, and you are not building a copy of the dataset. - Revalidate hourly. The corpus refreshes daily, so caching responses for an hour costs you nothing in freshness and cuts requests sharply.
Using it in each tool
Claude Code
Save the prompt as PROMPT.md in an empty folder and run claude "Follow PROMPT.md". Claude Code reads the spec URL, scaffolds the app, runs the build and fixes type errors in the same session. One extra that helps: connect the Ad Radar MCP server with the same key, so the agent can look at real records while it designs the cards.
claude mcp add --transport http ad-radar https://app.ad-radar.dev/api/mcp \
--header "Authorization: Bearer $AD_RADAR_KEY"
Then ask it to "call search_ads for three winning video ads and design the AdCard around what you see." It will lay out the card for real headlines, real transcript lengths and real tag counts instead of lorem ipsum.
Cursor
Open an empty folder, switch the chat to Agent mode, and paste the prompt. If the agent doesn't fetch the spec on its own, download it first (curl -o openapi.json https://app.ad-radar.dev/api/v1/openapi.json) and reference the file in the chat. Keep .env.local out of the indexed context.
Lovable and Bolt
Both build full apps from a prompt in the browser, and both default to their own stacks, so drop the Next.js and SQLite lines and keep everything else. The security section matters even more here. Lovable's guide to calling any API says that for an authenticated API it writes a server function (or an edge function in older React and Vite apps) and asks you to add the key as a secret, rather than pasting it into the chat. Do that, and never accept a version that reads the key from a VITE_ variable: Vite bundles those into browser code. The same rule applies in Bolt: the API call belongs in server code, the key in a server-side environment variable.
Round two: prompts that add the features users pay for
Once the first build runs, these follow-up prompts add depth one at a time:
- Transcript search with highlights. "On search results, highlight the matched words of
qin the hook line and show the sentence of the transcript where they appear." - A patterns page. "Add /patterns from GET /patterns?format=video: a table of doThis values with lift, winnerRate, ads and advertisers, each linking to /?tags=dimension:value."
- Brand compare. "Let me pick up to three brands and show their activeAdsTrend sparklines, stats and hook mix side by side."
- An AI brief button. "On the ad page, add 'Adapt to my product': a server action that sends the transcript, tags and my product description to Claude and returns a 30-second script that keeps the winner's structure." Our AI agent for Facebook ads guide shows the prompt rules that keep those drafts grounded.
- Alerts. "A daily job that calls /winners?since=yesterday with my saved filters and posts new matches to a Slack webhook." The n8n version does the same without code.
Each of these is an hour of AI-assisted work because the hard fields (transcript, tags, lift, trends) already exist in the API response.
What it costs to run
One HTTP call is one request; one page of up to 100 ads is one call. With hourly revalidation, a team of ten browsing all day uses far fewer requests than page views, because repeated searches and ad pages come from the cache. A busy internal swipe file typically sits well inside the Builder quota.
| Plan | Price, every 4 weeks | Requests | What you can build |
|---|---|---|---|
| Builder | $299 | 10,000 | An internal swipe file, or a product that shows the data to your users (no raw redistribution); includes the web app |
| Scale | $799 | 50,000 | Builder plus /feed, to keep your own mirror in sync incrementally, and a higher rate limit |
| Reseller | From $2,000 | Custom | Full NDJSON /export, resale and white-label |
Over quota the API returns a 429 with an upgrade link, never an overage charge, and X-Quota-Remaining on every response lets the app warn you early. Full terms are on the pricing section, and every parameter is in the API docs.
Set that against the alternative. The scraper version of this app needs a scraping budget, workers, storage for every video, a transcription bill, an LLM tagging pass, and above all months of daily snapshots before "days running" or "winner" mean anything. No prompt shortens the months.
Ship the app, not the pipeline
AI made the interface cheap. It did not make the data cheap, and the data is what your users come back for. The fastest way to build an ad spy tool with AI is to let Claude Code, Cursor, Lovable or Bolt write the app, and to feed it a corpus that is already ranked, transcribed and tagged. Start on Builder, paste the prompt above, and by tonight you have a swipe file of 2,761 winning Meta ads your team can search by what the ads actually say.
Figures marked as estimated spend come from Ad Radar's model of engagement on public Meta Ad Library ads. They are estimates, labeled as such, and are best used to rank ads against each other. How the board is built.