Ad library API: search Meta, Google, LinkedIn and TikTok ads

Find an advertiser, fetch its public ads and read the results with Social Fetch. A beginner guide to advertiser IDs, filters, missing fields, pagination and credits.

Updated
RequestGET /v1/google/ad-library/advertisers/search
const base = "https://api.socialfetch.dev";
const path = "/v1/google/ad-library/advertisers/search?query=Notion&region=US";
const res = await fetch(`${base}${path}`, {
headers: { "x-api-key": "YOUR_API_KEY" },
});
Response200 OK
{
"data": {
"query": "lululemon",
"advertisers": [
{
"name": "lululemon HK Limited",
"advertiserId": "AR01382517811867287553",
// …
On this page

Use Social Fetch to find public ads from Meta (Facebook and Instagram), Google, LinkedIn and TikTok. You can search for an advertiser, fetch its ads and save the results in your own application.

This guide starts with a Google advertiser search, then shows how the other libraries differ. You need a Social Fetch account, credits and an API key. If API keys and requests are new to you, follow the Quickstart first.

Choose the API or Ad Tracker

Use the API when you want JSON data for your own database, report or application. JSON is the structured response your code reads; each request has a data section with the result and a meta section with its request ID and credit charge.

If you want to follow competitors without writing code, use Ad Tracker. It finds advertiser matches, checks the libraries on a schedule and saves ads for you. Start with Track your first competitor.

You do not need to connect an advertising account for either route. These are public ad library lookups, rather than reports from an advertiser's campaign dashboard.

An advertiser is the account or business a library lists as paying for ads. Its display name may differ from the brand name you recognise.

  1. Open the Google advertiser search in the Playground.
  2. Set query to Notion and region to US. Check the filled values before sending: the Playground may include example values.
  3. Click Send. This runs a real request and spends credits. Read the Response tab when it finishes.
Google advertiser search in the Social Fetch Playground, with the Notion query field and Send button labelled.
Start with a name search. Send runs a real lookup, even in the Playground.

To make the same request from a terminal, save your API key in the SOCIALFETCH_API_KEY environment variable, then run this Bash command. Keep the key out of browser code and source control.

Request
bash

The -G option puts the filters in the URL. --data-urlencode handles spaces and special characters for you.

Our real search returned NOTION LLC, Epic Notion, Hit Notion, LLC and Notion Labs, Inc, among other matches. The image below arranges selected rows from that response into a table; it is an explanatory visual, not an app screen. Your results and estimates can change.

Selected real Google advertiser results for Notion, showing different business names and their advertiser IDs. The Notion Labs row is labelled for identity checking.
A matching name is a candidate. Confirm the business before storing its advertiser ID.

Confirm the advertiser against its public library page and the brand's known identity. Do not choose it just because it has the largest adsEstimate. The response's websites list contains domains associated with the search; it does not map each domain to an advertiser row.

For this example, the Notion Labs row has advertiserId=AR13309761427309854721. An ID is a library's identifier for an advertiser. Save the confirmed ID so later requests use the same advertiser.

Fetch the advertiser's ads

Use the confirmed Google advertiserId to list its ads:

Request
bash

Check the price before listing Google ads

Google company ads costs 25 credits per completed request, including each additional page. The advertiser name search above costs 3 credits. They are different operations. Check the Google company ads reference before starting a loop, and read meta.creditsCharged after each response.

You can use domain=notion.so instead of advertiserId when you do not have an ID. For repeat lookups of a confirmed advertiser, prefer the ID.

Our request returned lookupStatus: "found", an ads array and page.hasMore: true. That means there was another page to fetch. Here are selected fields from its first ad, with the other fields omitted:

Request
json

Read the ads from data.ads. For Google, keep creativeId as the ad identifier and adUrl as its public library link. A found result can still have an empty ads array when no ads match your filters.

Google's optional platform filter selects a surface, for example youtube or google_search. format accepts text, image or video; date filters use YYYY-MM-DD. These filters describe which ads are returned, not how much the advertiser spent on a channel. A single-ad lookup uses a public ad URL at Google ad detail.

Search another library

The libraries use different filters and response fields. Keep the platform name beside each stored ID; a Meta page ID is not a LinkedIn company ID.

Meta: find a page, then list its ads

For a brand, first search Meta companies:

Request
bash

Confirm the matching page, then replace YOUR_CONFIRMED_PAGE_ID below with its returned pageId:

Request
bash

Use Meta ad search with query when you want keyword results instead of a confirmed page. It accepts searchType=exact-phrase, mediaType, country and date filters. country=ALL searches across countries supported by the library; it is not a promise of complete worldwide coverage.

Meta ad detail accepts adId or a public library url. includeTranscript=true requests a video transcript when available.

LinkedIn: start with a company or keyword

Request
bash

LinkedIn ad search requires at least one of company, companyId or keyword. A company name can match other businesses. Check advertiser.name and advertiser.pageUrl in the returned ads. Once confirmed, use the numeric company ID from that URL as companyId, and leave company blank.

Add countries=US,CA,GB or date filters when you need them. Start with fewer filters if the result is empty. LinkedIn ad detail accepts adId or a public ad library url.

Request
bash

TikTok ad search accepts exactly one of query (keyword search) or advertiserName. When the response includes advertiserMatches, inspect those candidates. To pin the search to one advertiser, send its businessId as advertiserBusinessId together with advertiserName. Do not send query as well.

TikTok ad detail accepts an adId or a public TikTok library or Top Ads detail URL. Fields available on one surface may be missing on another.

Read missing fields and estimates

A successful lookup does not mean every field is available. In a real LinkedIn ad detail response, the Notion ad below was found and had a headline and image, but its impressions, targeting language and run start were null. The visual uses selected fields from that response.

Real LinkedIn ad detail fields arranged for this guide: a Notion headline, with impressions, language targeting and run start all shown as null.
null means no value was returned. It does not mean zero impressions or no targeting.

Keep the meaning of each field when you store it:

  • null is missing data. An empty country breakdown is not evidence that an ad reached nobody.
  • An impressions band is a range, not an exact count. Keep the original label rather than replacing it with a guessed midpoint.
  • An ad estimate is an estimate. Do not present it as an exact total.
  • Targeting text may be a summary. Do not turn a truncated location string into a complete list of countries.

Meta can return EU/UK transparency fields, and Google can return impression ranges and regional disclosure fields when available. LinkedIn can return impressions and targeting summaries. Do not assume these are always present, or that only political ads have audience disclosures. The operation reference describes each field.

These responses do not establish conversions, profitability or an advertiser's total budget. An ad's age or format alone does not tell you why it ran or whether it worked.

Fetch more pages safely

A list response is one page, not necessarily the whole result. Read data.page.hasMore and data.page.nextCursor. A cursor is an opaque continuation value: pass it back as cursor without editing it, and keep the original filters unchanged.

Here is a bounded LinkedIn example using the TypeScript SDK. It prints a summary of each returned ad and stops with an error if it cannot finish within the chosen page budget. Install the SDK with npm install @socialfetch/sdk and set SOCIALFETCH_API_KEY before running it in your server-side TypeScript environment.

Request
typescript

Each page is another paid lookup. Keep a record of failures and unfinished runs; do not label a partial collection as complete. If you only need a sample, request one page and label it as a sample.

Keep a history

Store each observation with its platform, advertiser ID, ad ID, retrieval time and filters. Use the pair of platform and ad ID to avoid duplicates while keeping dated observations when fields change.

A missing ad on a later check means it was not returned for that check's filters. It does not prove the advertiser stopped all advertising. Libraries can remove old records, and coverage differs by region and ad type. Save the data you need for your research under your retention policy.

If you want scheduled collection and saved creatives without maintaining that code, follow the Ad Tracker guide.

Troubleshooting

A successful response has no ads

Check the advertiser identity, remove optional country and date filters, and inspect the response's pagination fields. An empty ads array can be a valid result and can still cost credits. Do not repeatedly retry the same successful empty response expecting it to become free.

"Provide query or advertiserName, not both."

For TikTok, clear one of those fields. If you use advertiserBusinessId, keep advertiserName and clear query. Check example values left in the Playground too.

"End date must be on or after start date."

For date-filtered searches, use real calendar dates in YYYY-MM-DD format and put the earlier date in startDate.

The request returns an error

Read the HTTP status and error.code, rather than treating the body as an ad list. Check the error reference for authentication, credits and availability errors. Keep the request ID when you contact support. Avoid retrying validation errors without fixing the input.

Common questions

Do I need an advertising account?

No. These routes return public ad library data. You need a Social Fetch API key and credits, not access to the advertiser's account.

Can I search every library with one request?

Each library has its own route and filters. Call the routes you need separately, or use Ad Tracker for a no-code workflow.

Can I see competitor spend or conversions?

Do not treat public ad library data as campaign reporting. Available disclosure fields vary by ad and region. Missing spend, impressions or targeting fields do not mean zero.

How far back does the data go?

Coverage depends on the library, region and ad type. A response is not a complete historical archive. Store dated snapshots if you need your own history.

Why does a brand search return other businesses?

A name can match several advertisers. Confirm the public advertiser identity, then use its platform ID where supported. An ad estimate alone does not confirm a match.

Does an empty result cost credits?

A completed lookup can be charged even when no ads match. Check the operation's price before sending and meta.creditsCharged afterwards. Each additional results page is another request.

Share this article

Try the API

Profiles, posts, comments and metrics on 87 platforms through one REST API.

Try the Playground