GET /v1/meta_ads/company_ads
Meta Ad Library ads API: every ad a Facebook Page runs, by page id
Reads the ads one advertiser (a Facebook Page) runs or ran from the Meta Ad Library as Page[Post], up to 30 a page: the copy is caption, the start is taken_at, and the CTA, link, platforms and countries sit under extra. Send the page_id, which the advertiser search API finds by name.
- Price
- $0.0025 per page
- Billing
- $0.0025/page
- Batch
- Yes, through /v1/batch
- Failed calls
- Not charged
Example request
curl 'https://api.virev.ai/v1/meta_ads/company_ads?page_id=15087023444&max_pages=1' \
-H "Authorization: Bearer $VIREV_API_KEY"import os
import requests
response = requests.request(
"GET",
"https://api.virev.ai/v1/meta_ads/company_ads",
params={
"page_id": "15087023444",
"max_pages": "1",
},
headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
timeout=60,
)
response.raise_for_status()
print(response.json())Parameters
| Name | In | Type | Description |
|---|---|---|---|
page_id required | query | string | The advertiser's numeric Facebook Page id, id of a /v1/meta_ads/search_companies answer. |
country | query | string | A two-letter country code, or ALL; omitted is US. |
status | query | ALL | ACTIVE | INACTIVE | Which ads: ALL (the default), ACTIVE or INACTIVE. |
media_type | query | ALL | IMAGE | VIDEO | MEME | IMAGE_AND_MEME | NONE | Only ads of this media type; omitted is ALL. |
sort_by | query | relevancy_monthly_grouped | The Ad Library's order; only relevancy_monthly_grouped, its default, is observed. |
since | query | string | Not accepted on this operation: its items carry no timestamp, so since returns 400 before billing. |
max_pages | query | integer | Maximum pages to fetch. -1 walks until exhaustion or since with no page cap, and must be written. Omitted, since alone bounds the walk; with neither, the job stops after 10 pages. Any positive integer is accepted. 1 returns one page synchronously with HTTP 200; any other value creates a durable job with HTTP 202. |
cursor | query | string | Opaque next_cursor from an earlier answer of this operation, also with get_raw=true. A native Meta Ads cursor from a raw page answers 400. Result download cursors belong to the results route. |
cached | query | auto | cache_only | live | auto (default) serves a read saved within the last 24 hours for these exact arguments, otherwise fetches. cache_only never contacts Meta Ads (404 not_cached when nothing is saved, whatever its age). live always fetches. Anything else is a 400. cache_only reads one saved page per request: omit max_pages or pass 1, and continue with next_cursor. |
get_raw | query | boolean | true returns the upstream JSON exactly as Meta Ads answered it instead of the normalized Page[Post]. |
Idempotency-Key | header | string | Reuse this key with the same inputs to recover a lost job submission. A different input with the same key returns 409. |
Example response
The example response of the API reference, with lists cut to their first 3 items and long text shortened.
{
"data": {
"items": [
{
"id": "161966936869658",
"shortcode": null,
"taken_at": "2023-08-15T07:00:00+00:00",
"kind": "carousel",
"product_type": "DPA",
"caption": "Entra a Nike.com y encuentra actualizaciones semanales de producto con envío gratis.",
"hashtags": [],
"mentions": [],
"accessibility_caption": null,
"likes": null,
"comments": null,
"views": null,
"counts_hidden": null,
"comments_disabled": null,
"is_pinned": null,
"is_paid_partnership": false,
"owner": {
"id": "15087023444",
"username": "nike",
"full_name": "Nike",
"is_verified": null,
"is_private": false,
"avatar_url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/158865320_451391649310335_3058302462343549918_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=5iBoCN_lZt4Q7kNvwGs2eKu&_nc_oc=AdqvDJ6TzV3YPGUrgn_QBXdmt-S5SjeNiJW-jcMj…",
"latest_story_at": null,
"extra": {
"category": "Sportswear",
"likes": 39494361,
"is_deleted": false,
"url": "https://www.facebook.com/nike"
}
},
"coauthors": [],
"sponsors": [],
"tagged": [],
"location": null,
"audio": null,
"thumbnail_url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367963819_652036496870561_3033983014718682847_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=xMavf1VqVhYQ7kNvwG0Sj1f&_nc_oc=AdriB8yRkGGkP4uCeG_9Q9Py-AY8iv8jXocpoJCKknzc2a-FIAZxMmSHIEpdTDw…",
"video_duration": null,
"media": [
{
"kind": "image",
"url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367963819_652036496870561_3033983014718682847_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=xMavf1VqVhYQ7kNvwG0Sj1f&_nc_oc=AdriB8yRkGGkP4uCeG_9Q9Py-AY8iv8jXocpoJCKknzc2a-FIAZxMmSHIEpdTDw…",
"width": null,
"height": null,
"duration": null
},
{
"kind": "image",
"url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367742785_847403300215960_2275630920962394846_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=exMqM5kN9M4Q7kNvwFKXf8z&_nc_oc=AdqwKs19geQQt-r0-S6Udb9ogG1MHWcOED_CuKjfZAfeKS8MUWdR63YhCJrFVcT…",
"width": null,
"height": null,
"duration": null
},
{
"kind": "image",
"url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367982880_6403678943084737_2372495901824734164_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=k7FKAmkj9usQ7kNvwFvl-nS&_nc_oc=AdoLFVPKIZbRQlZ0VrPMI_ORv-oTTSOnmg4hCaHLckReIh7mNsUdNEIJly2_lb…",
"width": null,
"height": null,
"duration": null
}
],
"media_urls": [
"https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367963819_652036496870561_3033983014718682847_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=xMavf1VqVhYQ7kNvwG0Sj1f&_nc_oc=AdriB8yRkGGkP4uCeG_9Q9Py-AY8iv8jXocpoJCKknzc2a-FIAZxMmSHIEpdTDw…",
"https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367742785_847403300215960_2275630920962394846_n.jpg?_nc_cat=103&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=exMqM5kN9M4Q7kNvwFKXf8z&_nc_oc=AdqwKs19geQQt-r0-S6Udb9ogG1MHWcOED_CuKjfZAfeKS8MUWdR63YhCJrFVcT…",
"https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367982880_6403678943084737_2372495901824734164_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=k7FKAmkj9usQ7kNvwFvl-nS&_nc_oc=AdoLFVPKIZbRQlZ0VrPMI_ORv-oTTSOnmg4hCaHLckReIh7mNsUdNEIJly2_lb…"
],
"extra": {
"url": "https://www.facebook.com/ads/library/?id=161966936869658",
"is_active": false,
"end_date": "2026-03-30T07:00:00+00:00",
"title": "{{product.name}}",
"link_caption": "nike.com/mx",
"link_url": "https://ad.doubleclick.net/ddm/trackclk/N8893.2410306FACEBOOKADS/B30448992.373431644;dc_trk_aid=564542764;dc_trk_cid=196659869;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;ltd=;dc_tdv=1",
"link_domain": "ad.doubleclick.net",
"cta_type": "SHOP_NOW",
"cta_text": "Shop now",
"collation_id": null,
"collation_count": null,
"publisher_platforms": [
"facebook",
"instagram",
"audience_network"
],
"countries": [],
"categories": [
"UNKNOWN"
],
"currency": null
}
},
{
"id": "1568367420362553",
"shortcode": null,
"taken_at": "2023-08-15T07:00:00+00:00",
"kind": "carousel",
"product_type": "DPA",
"caption": "Entra a Nike.com y encuentra actualizaciones semanales de producto con envío gratis.",
"hashtags": [],
"mentions": [],
"accessibility_caption": null,
"likes": null,
"comments": null,
"views": null,
"counts_hidden": null,
"comments_disabled": null,
"is_pinned": null,
"is_paid_partnership": false,
"owner": {
"id": "15087023444",
"username": "nike",
"full_name": "Nike",
"is_verified": null,
"is_private": false,
"avatar_url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/158865320_451391649310335_3058302462343549918_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=5iBoCN_lZt4Q7kNvwGs2eKu&_nc_oc=AdqvDJ6TzV3YPGUrgn_QBXdmt-S5SjeNiJW-jcMj…",
"latest_story_at": null,
"extra": {
"category": "Sportswear",
"likes": 39494361,
"is_deleted": false,
"url": "https://www.facebook.com/nike"
}
},
"coauthors": [],
"sponsors": [],
"tagged": [],
"location": null,
"audio": null,
"thumbnail_url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/366718874_993579578550513_268301341999985937_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=bQ28IZ-aeKoQ7kNvwH2K6aW&_nc_oc=Adq7dShBnlNSKc0-b3_IJroLl6MhiVZl5w_X3STBI0VI32-CR3VDYgyneryfYDK7…",
"video_duration": null,
"media": [
{
"kind": "image",
"url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/366718874_993579578550513_268301341999985937_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=bQ28IZ-aeKoQ7kNvwH2K6aW&_nc_oc=Adq7dShBnlNSKc0-b3_IJroLl6MhiVZl5w_X3STBI0VI32-CR3VDYgyneryfYDK7…",
"width": null,
"height": null,
"duration": null
},
{
"kind": "image",
"url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367713450_111500178710988_8942041339678852021_n.jpg?_nc_cat=106&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=UPabnVg8LbEQ7kNvwH28bBY&_nc_oc=AdrNdUYRnhqxZdAYUh4if8pVk2U5FhBVWI5lGW8jNwcjYPI0hpbE9GeMWKT-CHL…",
"width": null,
"height": null,
"duration": null
},
{
"kind": "image",
"url": "https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/366720169_275300341882728_5940567011916220043_n.jpg?_nc_cat=108&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=p33nT506yVEQ7kNvwEWBhGo&_nc_oc=AdouojOREOqHY-zQuimjZ0Xxku-C0-vLvzgImxHNELXVMSjUfdGQyDe1vjFzDXN…",
"width": null,
"height": null,
"duration": null
}
],
"media_urls": [
"https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/366718874_993579578550513_268301341999985937_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=bQ28IZ-aeKoQ7kNvwH2K6aW&_nc_oc=Adq7dShBnlNSKc0-b3_IJroLl6MhiVZl5w_X3STBI0VI32-CR3VDYgyneryfYDK7…",
"https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/367713450_111500178710988_8942041339678852021_n.jpg?_nc_cat=106&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=UPabnVg8LbEQ7kNvwH28bBY&_nc_oc=AdrNdUYRnhqxZdAYUh4if8pVk2U5FhBVWI5lGW8jNwcjYPI0hpbE9GeMWKT-CHL…",
"https://scontent-poa1-1.xx.fbcdn.net/v/t39.35426-6/366720169_275300341882728_5940567011916220043_n.jpg?_nc_cat=108&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=p33nT506yVEQ7kNvwEWBhGo&_nc_oc=AdouojOREOqHY-zQuimjZ0Xxku-C0-vLvzgImxHNELXVMSjUfdGQyDe1vjFzDXN…"
],
"extra": {
"url": "https://www.facebook.com/ads/library/?id=1568367420362553",
"is_active": false,
"end_date": "2026-03-30T07:00:00+00:00",
"title": "{{product.name}}",
"link_caption": "nike.com/mx",
"link_url": "https://ad.doubleclick.net/ddm/trackclk/N8893.2410306FACEBOOKADS/B30448992.373431644;dc_trk_aid=564542764;dc_trk_cid=196659869;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;ltd=;dc_tdv=1",
"link_domain": "ad.doubleclick.net",
"cta_type": "SHOP_NOW",
"cta_text": "Shop now",
"collation_id": null,
"collation_count": null,
"publisher_platforms": [
"facebook",
"instagram",
"audience_network"
],
"countries": [],
"categories": [
"UNKNOWN"
],
"currency": null
}
}
],
"pages": [
{
"cursor": null,
"fetched_at": "2026-10-27T22:38:37.872549+00:00",
"count": 10
}
],
"next_cursor": "eyJjdXJzb3IiOiJBUUhUWFJfVGpJMllGQVIxNHFxTXlEdlVINnpKX01oWkFhMmx0Z0k5eUZpNmVkQTEzc0QyLTNIa3dKNjlBTGlTVGdmcyIsIm9wIjoiY29tcGFueV9hZHMifQ",
"has_more": true,
"stop_reason": "pages",
"coverage": {
"since": null,
"oldest_at": null,
"since_reached": false
}
},
"meta": {
"source": "live",
"fetched_at": "2026-10-27T22:38:37.872549+00:00",
"cost": "$0.0025",
"balance": "$49.9950",
"request_id": "req_96ae9fb8754f7663f05887e4cf68e4d7"
}
}How it works
The ads one advertiser (a Facebook Page) runs or ran, up to 30 a page in the Ad Library's order. Find a page_id with /v1/meta_ads/search_companies. Returns Page[Post] under data, read from the Ad Library as a signed-out guest.
The default request creates a durable job (202). Use max_pages=1 for one synchronous Page response (200). Poll status_url, then read results_url with its opaque cursor. Acquisition stops at the first of max_pages or exhaustion. Jobs continue after disconnects. Result responses are bounded to 3 MiB; this does not limit the crawl. Supply Idempotency-Key to recover a lost submission response; reuse it with the same inputs. The Ad Library sets every page’s size (up to 30 ads) and answers in its own ranked order, so there is no page_size and no since. An answer carries next_cursor and has_more when the Ad Library holds more ads.
An ad answers as a Post: the copy is caption, the start is taken_at, likes, comments and views are null because the Ad Library shows no engagement, and Ad Library facts (the library URL, is_active, end_date, the CTA, the link, publisher_platforms, countries) sit under extra. An advertiser answers as an Account, with Page likes under extra.likes. Unknown, unsupported, and repeated query parameters return 400 before acquisition or billing.
Billing: $0.0025 per call; a job bills $0.0025 for each page it reads, once it completes. A failed read is not charged.
Errors
| Status | When |
|---|---|
400 | The request parameters are invalid. |
401 | Missing, malformed, or revoked API key. |
402 | Balance is too low for this request. |
404 | cached=cache_only found nothing saved for these arguments (not_cached; call again with cached=auto to fetch it), or the Meta Ads account or item does not exist (not_found). You are not charged. |
429 | Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged. |
502 | The upstream fetch failed. You are not charged. |
503 | Billing could not be confirmed, so no upstream data was returned. |
504 | The upstream request timed out. You are not charged. |