POST /v1/meta_ads/stored/search

Meta Ad Library stored search API: filter tracked ads by CTA, domain

Searches the Meta Ad Library ads we track, with filters on advertiser, page id, CTA type, link domain, platform, media type, running ads, days active and start date, all sent as a JSON body. Sort by start date, longevity (daysActive) or A/B-test breadth (collation); the answer carries total, the exact match count, and a next_cursor for the next page.

Price
$0.0010 per call
Batch
Yes, through /v1/batch
Failed calls
Not charged

Example request

curl
curl -X POST 'https://api.virev.ai/v1/meta_ads/stored/search' \
  -H "Authorization: Bearer $VIREV_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"pageId":"15087023444","activeOnly":true,"limit":2}'
python
import os
import requests

response = requests.request(
    "POST",
    "https://api.virev.ai/v1/meta_ads/stored/search",
    json={
        "pageId": "15087023444",
        "activeOnly": True,
        "limit": 2,
    },
    headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())

Request body

json
{
  "pageId": "15087023444",
  "activeOnly": true,
  "limit": 2
}

Example response

The example response of the API reference, with lists cut to their first 3 items and long text shortened.

json
{
  "data": {
    "ads": [
      {
        "adArchiveId": "1120113070497516",
        "pageId": "15087023444",
        "pageName": "Nike",
        "pageProfilePicUrl": "https://api.virev.ai/v1/media/meta_advertiser/15087023444/profile_pic?e=1793750400&s=98b4bdad4fd7074de644339239015e70",
        "igUsername": "nike",
        "ctaType": "SHOP_NOW",
        "ctaText": "Shop now",
        "linkUrl": "https://www.nike.com/",
        "linkDomain": "nike.com",
        "title": "{{product.name}}",
        "bodyText": "Get the gear not afraid to put in the work.",
        "displayFormat": "DPA",
        "publisherPlatforms": [
          "facebook",
          "instagram"
        ],
        "startDate": "2026-10-23T07:00:00Z",
        "isActive": true,
        "daysActive": 4,
        "collationCount": null,
        "endedAt": null,
        "creatives": [
          {
            "creativeId": 4395,
            "mediaType": "card",
            "metaSrcUrl": "https://api.virev.ai/v1/media/meta_ad_creative/4395/creative?e=1793750400&s=c7ccfb5a4aaefaeddfb3b504498e7a70",
            "b2Url": null,
            "media_state": "live"
          },
          {
            "creativeId": 4396,
            "mediaType": "card",
            "metaSrcUrl": "https://api.virev.ai/v1/media/meta_ad_creative/4396/creative?e=1793750400&s=ddb11cc45f38f4745e4ffec542e6b3fa",
            "b2Url": null,
            "media_state": "live"
          },
          {
            "creativeId": 4397,
            "mediaType": "card",
            "metaSrcUrl": "https://api.virev.ai/v1/media/meta_ad_creative/4397/creative?e=1793750400&s=4f9840c411c5fbfc47f4a11f41784cc8",
            "b2Url": null,
            "media_state": "live"
          }
        ]
      },
      {
        "adArchiveId": "1476143881043704",
        "pageId": "15087023444",
        "pageName": "Nike",
        "pageProfilePicUrl": "https://api.virev.ai/v1/media/meta_advertiser/15087023444/profile_pic?e=1793750400&s=98b4bdad4fd7074de644339239015e70",
        "igUsername": "nike",
        "ctaType": "SHOP_NOW",
        "ctaText": "Shop now",
        "linkUrl": "https://www.nike.com/",
        "linkDomain": "nike.com",
        "title": "{{product.name}}",
        "bodyText": "Get the gear that goes hard on and off the field.",
        "displayFormat": "DPA",
        "publisherPlatforms": [
          "facebook",
          "instagram"
        ],
        "startDate": "2026-10-23T07:00:00Z",
        "isActive": true,
        "daysActive": 4,
        "collationCount": null,
        "endedAt": null,
        "creatives": [
          {
            "creativeId": 4407,
            "mediaType": "card",
            "metaSrcUrl": "https://api.virev.ai/v1/media/meta_ad_creative/4407/creative?e=1793750400&s=b5fe69728cf5cce311c8723c83a61107",
            "b2Url": null,
            "media_state": "live"
          },
          {
            "creativeId": 4408,
            "mediaType": "card",
            "metaSrcUrl": "https://api.virev.ai/v1/media/meta_ad_creative/4408/creative?e=1793750400&s=53cbbe4d84e633f6ee5d3af20cfdfcd1",
            "b2Url": null,
            "media_state": "live"
          },
          {
            "creativeId": 4409,
            "mediaType": "card",
            "metaSrcUrl": "https://api.virev.ai/v1/media/meta_ad_creative/4409/creative?e=1793750400&s=413d351393d9d36507b651045f84a6b7",
            "b2Url": null,
            "media_state": "live"
          }
        ]
      }
    ],
    "total": 36,
    "next_cursor": "eyJvZmZzZXQiOjJ9",
    "has_more": true
  },
  "meta": {
    "cost": "$0.0010",
    "balance": "$49.9775",
    "request_id": "req_26a82ad75291478480626d4468944390"
  }
}

How it works

Full-text search over tracked Meta Ad Library ads with structured filters: advertiser name, page id, CTA type, link domain, publisher platform, media type, active-only, minimum days active, and start date. Sortable by start date, longevity (daysActive), or A/B-test breadth (collation).

A POST — the filter object is a JSON body. Unknown fields are ignored; invalid types return 400 before billing.

The answer carries total, the exact count of every match, and next_cursor with has_more while more matches remain. next_cursor is an opaque string; send it back as cursor, with the same filters and sortBy, for the next page, at any depth. It is null on the last page.

A search without pageId reads the ad search index: query matches whole words of the ad title and body, with no English stemming and no stop words, so every word you send must appear.

Errors

StatusWhen
400The request parameters are invalid.
401Missing, malformed, or revoked API key.
402Balance is too low for this request.
429Over 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.
502The upstream fetch failed. You are not charged.
503Billing could not be confirmed, so no upstream data was returned.
504The upstream request timed out. You are not charged.

Guides that use this endpoint