Use case

Research competitor Facebook ads from the Meta Ad Library

Pull ads from the Meta Ad Library as JSON with creative, copy, start date and advertiser, to see what competitors run and what they keep running.

Prepaid, no subscriptionREST or MCPOne key for models, data and agents
FacebookMeta Ad Librarylovelyjsonitems[0]"advertiser": "Northpeak Coffee""copy": "Fresh roasted, shippe…"start_date": "2026-09-14""creative": "video""search": "coffee""country": "US"

You want to know what your competitors advertise, which angles they test, and which ads they keep paying for. The Meta Ad Library has the answer, but it is a page you scroll by hand, one search at a time. Lovely Router reads it for you. Send an Ad Library search URL or a page URL, get one JSON object per ad, pay per ad from a prepaid balance. Call it from a script, a weekly report or an AI agent with one API key.

Hand it to your AI agent

Copy this prompt into Claude Code, Cursor, Codex or any coding agent. It tells the agent where the docs are and how to use your API key.

Research competitor Facebook ads from the Meta Ad Library. Use the Lovely Router data tools: each returns JSON and is billed per result.

- Docs (read first): https://lovelyrouter.com/docs/tools/find.md and https://lovelyrouter.com/docs/tools/run.md
- Plan first: POST https://lovelyrouter.com/v1/tools/suggest with `{"task": "<my task in plain words>"}` (free). It returns the tools to run in order, each with an example `input`, the `input_required` fields, an estimated cost and a ready-made `run` request. Replace the example values with my task's; if a field is unclear, read the tool with GET https://lovelyrouter.com/v1/tools/<id>. To browse instead, POST https://lovelyrouter.com/v1/tools/discover searches the catalog.
- Show me the plan and its estimated cost (`total_est_cost_usd`) before running anything large.
- Run: POST https://lovelyrouter.com/v1/tools/<id>/run with `{"input": {...}, "max_results": N}`. A 200 has the finished run with `items`; a 202 means it is still running, so poll the `poll` path until `status` is `succeeded`, `failed`, `timed_out` or `stopped`.
- Only delivered results are billed. Keep max_results small on the first run, check the output, then scale up.
- If you support MCP, connect https://lovelyrouter.com/mcp instead (Streamable HTTP, same key; https://lovelyrouter.com/docs/tools/mcp.md) and use suggest_tools, get_tool and run_tool.
- Auth: read my API key from the LOVELY_API_KEY environment variable and send it as `Authorization: Bearer $LOVELY_API_KEY`. Never print or commit the key. If it is not set, ask me to create one at https://lovelyrouter.com/app/keys.
- Billing is prepaid: every call is charged to my balance, so test with a small request before running anything large.
- Every docs page is plain Markdown; the full index is https://lovelyrouter.com/llms.txt.

My task: <the inputs (links, keywords or accounts) and how many results you need>
01

How it works

010203
  1. Build the search URL

    Open the Ad Library, set the country and your keyword or competitor, and copy the address from the browser. A page URL works as well.

  2. Run the tool with a cap

    Send the URL in urls to POST /v1/tools/facebook-ads/run with a count and max_results. The run holds its maximum cost from your balance and returns the ads as JSON.

  3. Store and compare

    Save each run with a date. Ads that appear are new tests; ads whose start date stays old are the ones still running.

02

Get competitor ads with one request

Search the Facebook Ads Library takes Ad Library search URLs or page URLs in urls. count caps the total ads, and limitPerSource caps the ads per URL:

curl https://lovelyrouter.com/v1/tools/facebook-ads/run \
  -H "Authorization: Bearer $LOVELY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "input": {
      "urls": [
        {
          "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=coffee"
        }
      ],
      "count": 10
    },
    "max_results": 10
  }'

The run returns the ads the library shows for that URL. A run still going after 60 seconds returns 202; Run a tool shows how to poll.

03

What each ad holds

Field groupWhat you get
CreativeThe ad's creative
CopyThe ad text
TimingThe date the ad started
AdvertiserWho runs the ad

Text comes back in whatever language the advertiser used. Ask a model to translate it, tag each ad by angle (price, social proof, urgency) or group near-duplicates in the same job.

04

Recipes

Map a competitor's messaging

Pass a competitor's page URL, collect their ads, and ask a model to label each one by offer and angle. Repeat monthly to see the shift.

Find ads that keep running

Compare start dates across two runs. An ad that is months old and still listed is probably working for them.

Scan a keyword across a market

Search the library for your category in one country, then read the copy of the first 200 ads to learn the common claims.

Brief a creative team

Pull 50 ads for a keyword, hand the copy and creative types to a writer, and ask for three angles nobody is using.

Compare countries

Run the same keyword with different country values in the search URL and see which offers change by market.

Prefer plain words? Connect the MCP server and tell Claude Code or Cursor: "Pull the 100 latest ads for 'running shoes' in the US from the Ad Library, group them by advertiser, and list the three most repeated phrases per advertiser. Set max_results to 100."

06

What you pay

You pay per ad: starting a run holds its maximum cost, the per-call fee plus the per-ad fee times max_results, and the run settles to what it returned. The rest of the hold goes back to your balance. A run that fails or times out pays only for the ads it delivered, and a run refused at the start costs nothing.

Reading 100 ads a week is billed as 100 ads a week. There is no subscription and no monthly minimum: top up from $5, and one balance pays for tools and models. The card above shows today's price; pricing lists every tool.

07

Frequently asked questions

?
Can I search the Ad Library by keyword?+

Yes. Put your keyword in the q part of an Ad Library search URL, pick the country in the URL, and pass it in urls.

How do I cap the number of ads?+

Set count in the input for the total, limitPerSource for each URL, and max_results on the request as the run cap. The result holds at most that many ads.

Can I pull the ads of one company?+

Pass the company's Facebook page URL in urls. The tool accepts search URLs or page URLs.

Do I need a Facebook account?+

No. You send URLs and an API key.

Do I need a subscription?+

No. You add credit to a prepaid balance and each run draws it down. Failed runs pay only for the ads they delivered, and nothing renews automatically.

Tracking more than Facebook? See ad intelligence, social listening and the tool catalog.

One prepaid key for models, data and agents

No subscription. Top up, use what you need, see every charge in your logs.