Facebook Ads API
API health
- 24h health
- Normal
- Healthy / normal
- Available
- Limited
- Mostly down
Last 24 hours
Last 30 days
Find ads in the Facebook Ad Library by keyword or Ad Library URL. Get ad copy, call to action, landing page, run dates, placements and advertiser. Narrow by country and status. Spend, impressions, targeting and conversions are not included.
Send POST https://api.everyinfra.com/api/v1/social with platform set to facebook and action set to ads. Price $11.79 per 1,000 requests ($0.01179 per call). Failed calls and empty results are not charged. Synchronous. For slow jobs add "mode": "async" to the body, take the job_id and poll.
AI prompt
#Please help me write a data collection script with the EveryInfra Facebook Ads endpoint (facebook/ads).
How the endpoint works:
- Request: POST https://api.everyinfra.com/api/v1/social with the header Authorization: Bearer <API key>. Read the key from the EVERYINFRA_API_KEY environment variable and never hard-code it.
- In the request body, set platform to facebook and action to ads, and put the parameters inside params.
- Required parameters:
- keyword: Specifies the search query for distinct platform endpoints. For search, it searches public posts; for ads, it accepts ad keywords or direct Ad Library and Page URLs.
- Optional parameters:
- country: Specifies the country code for keyword queries in the ads action, such as US (defaults to US). Values are converted to uppercase when constructing request URLs.
- status: Filters ad page status with allowed values: all (default), active (currently running), or inactive (stopped). This represents ad delivery status rather than ad review status.
- limit: The most rows to return in this call, an integer from 1 to 200. The default applies when you leave it out, and a call can return fewer rows. Larger values return 422 before any charge. (default: 20)
- Returns a list of records. Main fields of each record: id, url, text, title, cta_text, link_url, is_active, started_at, ended_at, platforms, variant_count, advertiser_id; 16 fields in total, full list at https://api.everyinfra.com/api/v1/social/catalog?platform=facebook.
- Example request body:
{
"platform": "facebook",
"action": "ads",
"params": {
"keyword": "coffee"
}
}
- Price: $11.79 per 1,000 requests; failed and empty results are not charged.
- For dozens or hundreds of targets, add "mode": "async" to the body: you get a job_id at once and poll GET https://api.everyinfra.com/api/v1/jobs/{job_id} for the result.
- On 422, fix the request using the suggested parameter names and allowed values in the error; on 429 or 503, wait for Retry-After and try again.
Before writing code, ask me which targets I need, how many, which fields, and what output format I want; then confirm the plan and the rough cost with me.Request parameters
#| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | header | string | Yes | - | Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository. |
platform | body | string | Yes | facebook | Platform identifier, fixed value. |
action | body | string | Yes | ads | Capability identifier, fixed value. |
keyword | body.params | string | Yes | - | Specifies the search query for distinct platform endpoints. For search, it searches public posts; for ads, it accepts ad keywords or direct Ad Library and Page URLs; for marketplace, it accepts item search terms or complete Marketplace search URLs. Each action queries a different dataset rather than returning the same results under different field names. |
country | body.params | string | No | - | Specifies the country code for keyword queries in the ads action, such as US (defaults to US). Values are converted to uppercase when constructing request URLs. If keyword is provided as a complete URL, the parameters embedded in that URL take precedence and this country setting is not applied. |
status | body.params | string | No | - | Filters ad page status with allowed values: all (default), active (currently running), or inactive (stopped). This represents ad delivery status rather than ad review status. When keyword is an Ad Library URL, its embedded active_status may differ from this parameter; keep the two consistent. |
limit | body.params | integer (1–200) | No | 20 | The most rows to return in this call, an integer from 1 to 200. The default applies when you leave it out, and a call can return fewer rows. Larger values return 422 before any charge. |
Code samples
#curl -X POST 'https://api.everyinfra.com/api/v1/social' \
-H "Authorization: Bearer $EVERYINFRA_API_KEY" \
-H 'Content-Type: application/json' \
--data-raw '{
"platform": "facebook",
"action": "ads",
"params": {
"keyword": "coffee"
}
}'OpenAPI definition (JSON)Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.
Response example
#{ "id": "req_…", "platform": "facebook", "action": "ads", "results": [ { "id": "•••", "url": "https://www.facebook.com/ads/library/?id=2619351891814847", "text": "My aunt called me a creep for putting a camera in Nana’s living room.\n\nNana called me practical.\n\nThen the camera caught something worse than a fall.\n\nI need to be clear about one thing before anyone decides what kind of grandson I am.\n\nNana asked for the camera.\n\nNot me.\n\nNot my…", "title": "Natural Relief in Weeks", "cta_text": "Learn more", "link_url": "https://shop.pipitea.com/hbt/kd/sp-nm", "is_active": true, "started_at": "2026-07-18T07:00:00+00:00", "ended_at": "2026-09-26T07:00:00+00:00", "platforms": [ "FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK" ], "variant_count": 1, "advertiser_id": "•••", "advertiser_name": "American Health Support Community", "advertiser_url": "https://www.facebook.com/61588018263996/", "advertiser_likes": 3743, "image_url": "https://scontent-cgk2-1.xx.fbcdn.net/v/t39.35426-6/739782028_1533198008291919_1079542453788497101_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=104&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=Uk5VaZErAicQ7kNvwGVCoQR&_nc_oc=AdrmGRHEyarAKB4ZPK3UDbOqbmUnmyTjOu66kIImwuRMhy4Sih2v0Ql7lLBL18vE5Fc&_nc_zt=14&_…", "platform": "facebook" }, { "id": "•••", "url": "https://www.facebook.com/ads/library/?id=1103440874425577", "text": "{{product.brand}}", "title": "{{product.name}}", "cta_text": "Learn more", "link_url": "https://fb.com/canvas_doc/1739639586863342", "is_active": false, "started_at": "2025-01-07T08:00:00+00:00", "ended_at": "2025-10-11T07:00:00+00:00", "platforms": [ "FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK" ], "variant_count": 1, "advertiser_id": "•••", "advertiser_name": "Kooks Secrets ", "advertiser_url": "https://www.facebook.com/Kookssecrets/", "advertiser_likes": 327993, "image_url": "https://scontent-cgk2-2.xx.fbcdn.net/v/t39.35426-6/472844243_1124200409414471_7229817135061190034_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=101&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=T5O8s9bDjU0Q7kNvwFxTL6x&_nc_oc=AdrpTq2DTLB8CkPZIM3_x98AEYJShX84dHiTij6LjERYIOCgDng9ayx9qOEMvr-YVRs&_nc_zt=14&_…", "platform": "facebook" } ], "count": 20, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
Response fields
#Business data is in results. The table lists the fields a record can contain; values the platform does not show are never made up.
| Field | Meaning |
|---|---|
id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
url | Link to the record on the platform. |
text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
title | Title. null when the platform has no titles (for example text-only posts). |
cta_text | Keeps the platform's own meaning |
link_url | Keeps the platform's own meaning |
is_active | Keeps the platform's own meaning |
started_at | Keeps the platform's own meaning |
ended_at | Keeps the platform's own meaning |
platforms | Keeps the platform's own meaning |
variant_count | Keeps the platform's own meaning |
advertiser_id | Keeps the platform's own meaning |
advertiser_name | Keeps the platform's own meaning |
advertiser_url | Keeps the platform's own meaning |
advertiser_likes | Keeps the platform's own meaning |
image_url | Image link. Capabilities with several images may return an image_urls array. |
platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
Errors and billing
#- 401
- Missing or invalid key.
- 402
- Insufficient balance. Top up first.
- 422
- Invalid parameter name or value. Fix it using the suggestions in the error. No charge.
- 429
- Per-minute request limit reached. Wait for Retry-After, then try again.
- 503
- Could not complete. The held charge is returned to your balance. If the outcome is unknown, verify it before you retry.
- 200 empty
- No data. No charge.
Official references
#Used only to check objects and terms. They do not imply authorization or endorsement of EveryInfra by the platform.
- Meta Official: Ads and Page Search Objects in the Ad Library ↗
Historical Meta announcements introduce searching ads by keyword or Page and highlight transparency data differences between general active ads and political or issue ads, along with official API requirements; this does not imply that all ads include spend, impressions, or complete history, as this endpoint does not offer those stable fields.
Checked 2026-09-04