Call it
curl https://api.peume.com/v1/call/search-facebook-ads \
-H "Authorization: Bearer $PEUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"urls": [],
"scrapePageAds.period": "",
"scrapePageAds.activeStatus": "all",
"scrapePageAds.sortBy": "impressions_desc",
"scrapePageAds.countryCode": "ALL"
}
}'const res = await fetch("https://api.peume.com/v1/call/search-facebook-ads", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PEUME_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": {
"urls": [],
"scrapePageAds.period": "",
"scrapePageAds.activeStatus": "all",
"scrapePageAds.sortBy": "impressions_desc",
"scrapePageAds.countryCode": "ALL"
}
}),
});
const { output, cost_usd } = await res.json();import os, requests
res = requests.post(
"https://api.peume.com/v1/call/search-facebook-ads",
headers={"Authorization": f"Bearer {os.environ['PEUME_API_KEY']}"},
json={
"input": {
"urls": [],
"scrapePageAds.period": "",
"scrapePageAds.activeStatus": "all",
"scrapePageAds.sortBy": "impressions_desc",
"scrapePageAds.countryCode": "ALL"
}
},
)
print(res.json()["output"])Answer: {"id": "run_…", "status": "completed", "cost_usd": …, "output": {…}}. Long jobs answer 202 with a run id to read later. From an AI agent, connect the MCP server and ask for this by name: search-facebook-ads.
Parameters
urlsRequiredarrayList of facebook ads search URLs or Page URLs to scrape ads from
scrapeAdDetailsbooleanEnable this option to scrape ads details such as EU Reach info
limitPerSourceintegerLimit number of ads scraped per input URL. Leave it blank to scrape all available ads ℹ️ Actual number might exceed the given limit by upto 30
countintegerLeave this field empty if you want to limit number of ads scraped
scrapePageAds.periodstringSearch ads in given date range
· last24h · last7d · last14d · last30d
Example:
scrapePageAds.activeStatusstringall · active · inactive
Example: all
scrapePageAds.sortBystringSort by impressions or date. Default: Impressions
impressions_desc · most_recent
Example: impressions_desc
scrapePageAds.countryCodestring2-letter ISO country code (ISO 3166-1 alpha-2). This should be the official uppercase country code, such as `IN` for India, `US` for United States, etc. Use `ALL` for targeting all countries
Example: ALL
runTagstringAdd this value to 'runTag' column in the output
proxyobjectYou can use this option to customise the proxy country
