Belgeler
Ctrl+K Arama Alt+[Alt+] Kılavuzlar
API anahtarını al

API · Reklam kütüphanesi

Meta reklam kütüphanesi

GET /api/v1/adlibrary searches Meta (Facebook / Instagram) ads with your API key. /api/adlibrary is a supported alias. Auth and metering match the API kılavuzu. MCP equivalent: search_facebook_ads (and find_winning_products, creative_inspiration_pack) — see MCP · araçlar kılavuzu.

AL /api/v1/adlibrary

curl -sS -G -H "X-API-Key: $WH_API_KEY" "{origin}/api/v1/adlibrary" \
  --data-urlencode "keyword=skincare" \
  --data-urlencode "searchkeyword=adtext" \
  --data-urlencode "countries=US" \
  --data-urlencode "sorting=reach" \
  --data-urlencode "page=0" \
  --data-urlencode "min=" --data-urlencode "max=" \
  --data-urlencode "from=" --data-urlencode "to=" \
  --data-urlencode "mediafilter=" --data-urlencode "scroll=" \
  --data-urlencode "scaling=" --data-urlencode "niches=" \
  --data-urlencode "fromlastseen=" --data-urlencode "tolastseen=" \
  --data-urlencode "activestatus="
{
  "data": [
    {
      "id": "1284756102394857",
      "page_name": "Glow Beauty Co.",
      "ad_creative_body": "This serum changed my skin in 14 days…",
      "ad_snapshot_url": "https://www.facebook.com/ads/library/?id=1284756102394857",
      "media_type": "video",
      "started": "2024-05-12",
      "reach": 184000,
      "ad_rank": 3
    }
  ],
  "total": 240,
  "scroll": "eyJwYWdlIjoxfQ=="
}

The in-app Meta ads views call /api/fb-ads with the same query shape — copy a working request from your browser's network tab and swap the path to /api/v1/adlibrary.

Entry guard (required query keys)

The endpoint only returns its main JSON payload when all of the following keys are present in the query string (empty string is allowed):

arama kelimesi, anahtar kelime, min, ülkeler, ...'den, ...'ye, sıralama, mediafilter, sayfa, max, scroll, ölçeklendirme, nişler, songörüldüğünden beri, görülmüş, activestatus

If any are missing, the response is not the usual list payload (avoid this in clients).

Additionally, the inner gate requires trial set in the query ya da a logged-in / API-key–resolved session. With a valid X-API-Anahtarı, you meet the session requirement automatically. Otherwise the response is:

{"error":"logged_out"}

All query parameters

Everything below is read from the query string (same shape as /api/fb-ads in the app).

isset gate (must be present; empty string is OK)

Same list as Entry guard above:
arama kelimesi, anahtar kelime, min, max, ülkeler, ...'den, ...'ye, sıralama, mediafilter, sayfa, scroll, ölçeklendirme, nişler, songörüldüğünden beri, görülmüş, activestatus.

Strongly recommended on every request

The handler reads web sitesi, diller, pagetypefilter, sıralama yönü, appsve themes without going through that isset list. Mirror the dashboard and send at least website=All, languages=All, pagetypefilter= (empty = all page types), sortdirection=desc, apps=All, themes=All so behavior matches the UI and optional keys are always defined.

Snake_case aliases (MCP-parity names)

/api/v1/adlibrary (and the /api/adlibrary alias) also accepts the same snake_case argument names as the MCP search_facebook_ads tool, normalized server-side to the internal keys below (FacebookAdsFilterSpec::publicQueryAliases()). When both names are sent, the internal name wins. Highlights:

Alias Internal key
ülke / ülkeler, exclude_countries ülkeler, excludeCountries
niche / nişler nişler
technology / teknolojiler web sitesi
dil / diller, exclude_languages diller, excludeLanguages
theme / themes, apps, exclude_apps themes, apps, excludeApps
media_type, page_type, ad_score, low_impressions, rank_growth_filter mediafilter, pagetypefilter, reklam puan filtresi, lowimpressions, rankgrowthfilter
ad_created_from / ad_created_to ...'den / ...'ye
last_seen_from / last_seen_to songörüldüğünden beri / görülmüş
product_created_from / product_created_to ürün_kaynağı / ürün_adresi
page_created_from / page_created_to pagefrom / pageto
min_duplicates / max_duplicates min / max
minimum reklam harcaması / maksimum reklam harcaması, ad_spend_timeframe minadspend / maxadspend, adspendtimeframe
min_reach / max_reach, reach_timeframe minreach / maxreach, reachtimeframe
min_monthly_visits / max_monthly_visits mintraffic / maxtraffic
min_days_running / max_days_running zihin günleri / maksimum gün sayısı
min_active_ads / max_active_ads minactiveads / maxactiveads
min_active_ads_growth / max_active_ads_growth, active_ads_growth_period minactiveadsgrowth / maxactiveadsgrowth, activeadsgrowthperiod
min_reach_growth / max_reach_growth, reach_growth_period minreachgrowth / maxreachgrowth, reachgrowthperiod
min_ad_rank / max_ad_rank minadrank / maxadrank
min_page_likes / max_page_likes, en düşük fiyat / maksimum fiyat, min_copy_length / max_copy_length, min_video_length / max_video_length, min_products_on_store / max_products_on_store minpagelikes / maxpagelikes, en düşük fiyat / maksimum fiyat, mincopylength / maxcopylength, minvideolength / maxvideolength, minproductsonstore / maxproductsonstore
sort_by / sort_order sıralama / sıralama yönü
active_status activestatus

On the API route the entry-guard keys are defaulted server-side (Dashboard::fbAdsPublicBaseQuery()), so a request like ?keyword=skincare&last_seen_from=2026-01-01&last_seen_to=2026-02-01 is valid without sending every isset-gate key. When anahtar kelime is set and arama kelimesi is empty, searchkeyword=All is applied automatically.

Auth / session / trial

Parametre Role
(none) With X-API-Anahtarı, the request runs as your account (same effect as being logged in).
trial If set (e.g. trial=true), anonymous winning-finder rules apply; combined with filters on page ≠ 0 can return {"message":"need_account"}.

Pagination, cursor, de-duplication

Parametre Notlar
sayfa 0-based page index.
scroll Deep-pagination cursor from search; empty on first request, then copy the scroll value from the previous JSON response.
nextscrapetime Unix seconds; used when sorting=datefound (first page often uses an anchor timestamp from the UI).
search_token Optional [a-zA-Z0-9_-]+; ties ads_per_brand caps to a tab/search in session.

Keyword search

Parametre Allowed / typical values
anahtar kelime Free text; URL-encoded; lowercased server-side.
arama kelimesi '', Tümü, hedef URL, sayfa adı, reklam metni, ürün adı (must be in this set when anahtar kelime is non-empty).

Active ads, scaling, media, page type, adscore, impressions

Parametre Values (match the in-app Meta ads filters)
activestatus String true ya da false (active-only vs include inactive).
ölçeklendirme '' (none), nodownscaling, upscaling, downscaling.
mediafilter '' / omit effect = all formats; else videolar, resimler, carousel, dco (maps to display_format in ES).
pagetypefilter '' = all; ürünler, koleksiyonlar, funnels, nofunnels.
reklam puan filtresi '' = none; kazanan (Established), ölçeklendirme (Has Potential), test (Unestablished). Requires the matching in-app tier.
lowimpressions '' = show all; hide = exclude very low impression rows (same behavior as the dashboard filter).
rankgrowthfilter '' = none; comma-separated subset of rising, stable, declining (rank momentum vs historic rank_history; same semantics as the dashboard Sıralama artışı filter).
minadrank, maxadrank Positive integers — within-brand ad rank (lower = stronger for that brand; #3 / N in the UI). Empty = no bound. Matches the dashboard Reklam sıralaması filter.

Sorting

Parametre Values
sıralama yönü asc ya da açıklama (empty defaults to açıklama).
sıralama '' (None → random order when not shuffling), trending, adsetamount, son görülme tarihi, bulunma tarihi, mostrecent (ad start date / başladı), adspend, longestrunning, reach, monthlyvisits, pageactiveads, koşu günleri, toprank (when enabled for your deployment). koşu günleri may not apply a dedicated sort branch (behaves like None unless the product changes).

Spend, reach (with window), traffic, days running, price, copy, video length, active ads on page

Parametre Notlar
minadspend, maxadspend Integers / numeric strings. maxadspend=999999 is treated as “no upper cap” for the adspend-in-use check. Meaningful adspend filtering may require a higher in-app tier.
adspendtimeframe hepsi, 7, 30, 90 — window for adspend filter (invalid values → hepsi).
minreach, maxreach Integers. May require a higher in-app tier.
reachtimeframe Same allowed set as adspendtimeframe.
mintraffic, maxtraffic Store monthly-visits range (absolute). May require a higher in-app tier.
minstorerevenue, maxstorerevenue Est. monthly store revenue range in ABD DOLARI (overlaps store_traffic.monthly_revenue_{min,max} on wlads). Same tier gate as traffic filters.
storebasedin Comma-separated ISO2 shop origin countries → store_traffic.shop_origin_country on wlads (same values as Explore Shops Merkezi / stores metadata.country).
storevisitorcountrymain Comma-separated ISO2 — country tied for top visitor share (store_traffic.visitor_country_main).
storevisitorcountryamong Comma-separated ISO2 — country appears in traffic mix (store_traffic.top_countries).
storevisitorcountryexclude Comma-separated ISO2 — exclude ads whose store has traffic from that country.
trustpilotrating Trustpilot stars dash range on store_traffic.trustpilot.ratings (örneğin 4-5, 2.5-3.5). Same tier gate as traffic filters.
trustpilotreviews Trustpilot review-count dash range on store_traffic.trustpilot.total_reviews (örneğin 1000-10000, 100000-100000000).
storecreated_from, storecreated_to Store creation window (A-G-Y) on store_traffic.first_product_created_at. Same tier gate as traffic filters. UI chip param: datestorecreated (Lightpick display range).
mingrowth, maxgrowth, growthperiod Monthly visit growth range, as a signed % change in store traffic (UI values: 25 = 25%). growthperiod selects the window: 1 (default) or 3 months → ranges on store_traffic.monthly_visits_growth_{1,3}m (indexed at 1/100 of the UI %, e.g. 169516.95). Empty min/max = no bound; negatives select declining stores. Same in-app tier gate as mintraffic.
minactiveadsgrowth, maxactiveadsgrowth, activeadsgrowthperiod Page active ads % growth (kontrol paneli) Active ads growth, Page tab). UI min/max are human percent (örneğin 25 = 25%; negatives allowed). activeadsgrowthperiod tokens: 1w, 14d, 1m, 3m (varsayılan) 1m; legacy 7d1w, 2m14d, 30d1m, 90d3m). Server maps tokens to indexed baselines total_active_ads_on_page_growth_{1w,14d,1m,3m} and filters on ((\texttt{total_active_ads_on_page} - \texttt{baseline}) / \texttt{baseline} \times 100) (baseline is the prior-period active-ad count, not a precomputed pct field). Dashboard labels: 1 week1w (7d), 2 weeks14d (14d), 1 month1m (30d).
minreachgrowth, maxreachgrowth, reachgrowthperiod Ad cumulative EU reach % growth (kontrol paneli) Ad EU Reach Growth, EU/UK tab). Same UI % and period semantics as ads growth. Ranges total_eu_views_growth_pct_{period} only (not reach_growth_pct_*, which is page-level reach). Same in-app tier gate as minreach / maxreach.
zihin günleri, maksimum gün sayısı Days-running range filter; may require a higher in-app tier.
en düşük fiyat, maksimum fiyat
mincopylength, maxcopylength
minvideolength, maxvideolength
minactiveads, maxactiveads “Active ads on page” style cap (trial flow may inject minactiveads server-side).
minpagelikes, maxpagelikes Facebook page likes range on indexed page_like_count (ads without the field are excluded when a min is set).
minigfollowers, maxigfollowers Instagram followers range on wlads tracking.igfollowers (denormalized at ingest; no pages-index join). Currently disabled in app (Ads::WLADS_IG_FOLLOWERS_FILTER_ENABLED); enable after field backfill + dashboard UI.

Data dependency — monthly visit growth. mingrowth/maxgrowth range on store_traffic.monthly_visits_growth_{1,3}m on the wlads index. The 1-month field is widely populated; 3-month may return no matches until the indexer backfills that scalar.

Data dependency — wlads % growth filters. minactiveadsgrowth gerektirir total_active_ads_on_page plus total_active_ads_on_page_growth_{1w,14d,1m,3m} on wlads (baselines must be prior counts, not deltas). minreachgrowth uses total_eu_views_growth_pct_{period} when backfilled. Sparse baselines reduce match counts; use broader ranges when testing.

Dates (strings, typically A-G-Y)

Parametre Anlamı
...'den, ...'ye Ad creation (başladı).
songörüldüğünden beri, görülmüş Last seen (güncelleme tarihi).
ürün_kaynağı, ürün_adresi Product creation window.
pagefrom, pageto Page creation window.

Open-ended date ranges are normalized server-side (e.g. only ...'den set → ...'ye may be set to match ...'den).

Catalog: countries, stores, niches, languages, apps, themes, excludes

Parametre Format
ülkeler Tümü or comma-separated ISO 3166-1 alpha-2 codes (e.g. US,GB).
web sitesi Tümü or comma-separated store codes (e.g. SH = Shopify — see dashboard website filter).
nişler Tümü or comma-separated segments (preset codes, /Path/... paths from the niche catalog, or numeric ids — normalized server-side). If the list contains shopping, the server appends ürün.
diller Tümü or comma-separated language codes (as in dashboard #language).
apps Tümü or comma-separated numeric app ids (same values as the in-app apps filter).
themes Tümü or comma-separated theme strings (discover via GET /api/themes).
excludeCountries, excludeWebsites, excludeLanguages, excludeNiches, excludeApps Same comma-separated patterns as the include side; niches normalized like nişler.

Deep links, shuffle, caps

Parametre Notlar
URL'den sayfa kimliği Facebook page_id — narrows to one page’s ads.
ürün kodu Shopify product id.
shuffle Any non-empty truthy → shuffle mode (random sort; optional last-seen default window).
ads_per_brand 1, 2, 3, 5, 10 only — max ads per brand when shuffling / per-brand cap logic runs.

Validation / errors

Invalid min ya da max (outside 0…90000000) can yield {"error":"value_not_in_range_1"} ya da _2, or a non-JSON false body in edge cases.


Discovering valid nişler ve themes (no API key on these routes)

Integrations should learn allowed values from discovery JSON, not from guessing:

Uç nokta Amaç
GET /api/niche-counts Returns { "niches": [ { "code": "…", "count": N }, … ], "total_with_niche": … } built from the same Meta ads index the product uses. Use the code strings (comma-separated in nişler / excludeNiches) as the ground-truth set that actually appears in ads data. Optional: refresh=1 bypasses disk cache for one request.
GET /api/themes Returns a JSON object with a themes list (top values + counts, cached ~1h). Optional query: q — if length ≥ 2, substring search for typeahead. Optional: sınır (default 200, max 500). Use returned theme names/keys exactly as themes= comma-separated values on /api/adlibrary.

Preset niche shortcuts (UI “chips”): The app also exposes human-facing two-letter codes (örneğin CG, BY, SP) in the niche filter. Those are valid segments in niches= the same way the browser sends them.

Path / numeric niche segments: Values are resolved using the server’s niche catalog (paths like /Apparel/... and numeric ids map to canonical names in search). If a segment is unknown, it may be passed through as-is — prefer /api/niche-counts over inventing strings.

Note: /api/niche-counts ve /api/themes şunlardır discovery helpers and do not consume Meta ad library API credits the same way /api/adlibrary does. Your deployment may still require login or other policy in front of these routes.

Feature gates (upgrade JSON)

For accounts without the required product tier, certain filters or sort modes return 200 with a small JSON body (upgrade prompt is in-band, not always HTTP 403):

Yanıt Condition (simplified)
{"upgrade":"standard_adspend"} Ad spend filter used, or sorting=adspend
{"upgrade":"standard_reach"} Reach filter or sorting=reach
{"upgrade":"standard_traffic"} Traffic filter
{"upgrade":"standard_daysrunning"} Days-running filter or sorting=daysrunning
{"upgrade":"standard_adscore"} reklam puan filtresi set

Other notable responses

  • {"message":"need_account"} — Anonymous trial requests beyond allowed usage (trial flow guardrails).
  • Success payload: JSON object including veriler (ads), optional message (human-readable filter hints), total + total_relation (computed on every page for API-key / MCP requests; the dashboard UI fetches totals separately via count_only=1), scroll (deep-pagination cursor), and free-tier credit fields when applicable. total can still be null for query shapes that post-filter in PHP (e.g. rankgrowthfilter). Each ad may include ad_rank (integer position within its brand/page) and rank_history (time series used for momentum / Rank growth filtering in the dashboard). Programmatic and MCP payloads include these fields when present in search results.