Scrape the Meta ad library by Page or search URL
apify.meta-ads.library.searchScrape publicly running Facebook and Instagram ads for a page or Ad Library search
- Price
- $0.005/resultAl precio del proveedor
- Success rate
- —Aún no hay datos de tasa de éxitoAún no hay datos de tasa de éxito
- Latency p50
- ——
- Last verified
- 26 sept 2026Verified working
POSThttps://toolswitch.dev/v1/tools/apify.meta-ads.library.search?timeout=90&maxItems=1&maxTotalChargeUsd=0.05Preview- Uses platform quota
- Synchronous response
- Reads public data
Parámetros
the response is the dataset items array directly — no run envelope, no polling. Result count is what you pay for, so onlyTotal:true is the cheap probe before a full pull. Unofficial: this reads the Ad Library web UI, so field availability tracks whatever Meta currently renders
| Parámetro | Tipo | Obligatorio | Descripción | Ejemplo |
|---|---|---|---|---|
| Parámetros de consulta | ||||
timeout | entero | Opcional | treg's key requires 1-90 so the run and its rows arrive before any wait gives up (a larger pull needs your own key). seconds before the synchronous run is cut off. This route blocks until the actor finishes and Apify closes the connection at 300s regardless — use the async pair below for anything large | 90 |
maxItems | entero | Opcional | optional row cap; pay-per-event actors that take the row count from their own input ignore it, so maxTotalChargeUsd is the spend limit | 50 |
maxTotalChargeUsd | número | Opcional | the spend cap Apify enforces on every event this run bills, in dollars. treg's key requires it, above 0 and at most 1, and holds it for the call | 0.5 |
- Parámetros de consulta
timeoutenteroOpcionaltreg's key requires 1-90 so the run and its rows arrive before any wait gives up (a larger pull needs your own key). seconds before the synchronous run is cut off. This route blocks until the actor finishes and Apify closes the connection at 300s regardless — use the async pair below for anything large
Ejemplo:
90maxItemsenteroOpcionaloptional row cap; pay-per-event actors that take the row count from their own input ignore it, so maxTotalChargeUsd is the spend limit
Ejemplo:
50maxTotalChargeUsdnúmeroOpcionalthe spend cap Apify enforces on every event this run bills, in dollars. treg's key requires it, above 0 and at most 1, and holds it for the call
Ejemplo:
0.5
Ejemplos de código
Sustituye $TOOLSWITCH_KEY por la clave que creaste en la consola.
curl -X POST 'https://toolswitch.dev/v1/tools/apify.meta-ads.library.search?timeout=90&maxItems=1&maxTotalChargeUsd=0.05' \
-H "X-Toolswitch-Key: $TOOLSWITCH_KEY" \
-H "Content-Type: application/json" \
--data-raw '{"onlyTotal":true,"startUrls":[{"url":"https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=project%20management"}],"activeStatus":"active","resultsLimit":1,"isDetailsPerAd":false,"enrichWithEcommerceData":false}'import os
import json
import requests
response = requests.request(
"POST",
"https://toolswitch.dev/v1/tools/apify.meta-ads.library.search?timeout=90&maxItems=1&maxTotalChargeUsd=0.05",
headers={"X-Toolswitch-Key": os.environ["TOOLSWITCH_KEY"]},
json=json.loads("{\"onlyTotal\":true,\"startUrls\":[{\"url\":\"https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=project%20management\"}],\"activeStatus\":\"active\",\"resultsLimit\":1,\"isDetailsPerAd\":false,\"enrichWithEcommerceData\":false}"),
)
response.raise_for_status()
print(response.text)const response = await fetch("https://toolswitch.dev/v1/tools/apify.meta-ads.library.search?timeout=90&maxItems=1&maxTotalChargeUsd=0.05", {
method: "POST",
headers: {
"X-Toolswitch-Key": process.env.TOOLSWITCH_KEY ?? "",
"Content-Type": "application/json",
},
body: JSON.stringify(JSON.parse("{\"onlyTotal\":true,\"startUrls\":[{\"url\":\"https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=project%20management\"}],\"activeStatus\":\"active\",\"resultsLimit\":1,\"isDetailsPerAd\":false,\"enrichWithEcommerceData\":false}")),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.text());La API de la pasarela está en versión preliminar; su URL y autenticación pueden cambiar. Los parámetros del ejemplo son datos de muestra. Las llamadas se facturan a $0.005/result, incluida la tarifa de servicio.