Docs · Search Ad Library companies
Search Ad Library companies
Find an advertiser's Facebook page id by name in Meta's Ad Library, with followers and linked Instagram.
https://api.lurkapi.com /v1/facebook/adLibrary/search/companiesWhen to use this
Use it to turn a brand name into the page_id that company ads (facebook_company_ads) needs. Big brands often have several pages, for regions or product lines. Pick one by name, likes and verification.
You get the advertisers the search box at facebook.com/ads/library suggests as you type: up to about 15, in one call, with no further pages.
Example request
Copy one and replace YOUR_API_KEY with your API key (get one free). The code versions read the key from the LURKAPI_API_KEY environment variable instead.
curl "https://api.lurkapi.com/v1/facebook/adLibrary/search/companies?query=nike" \
-H "x-api-key: YOUR_API_KEY"Paste it into a terminal, with your key in place of YOUR_API_KEY.
const params = new URLSearchParams({
query: "nike",
});
const res = await fetch(`https://api.lurkapi.com/v1/facebook/adLibrary/search/companies?${params}`, {
headers: { "x-api-key": process.env.LURKAPI_API_KEY },
});
const data = await res.json();
if (!data.success) throw new Error(`${data.code}: ${data.error}`);
console.log(data.searchResults);Node 18+. Save it as lurk.mjs and run node lurk.mjs. It reads your key from LURKAPI_API_KEY.
import os
import requests
res = requests.get(
"https://api.lurkapi.com/v1/facebook/adLibrary/search/companies",
params={
"query": "nike",
},
headers={"x-api-key": os.environ["LURKAPI_API_KEY"]},
timeout=60,
)
data = res.json()
if not data["success"]:
raise RuntimeError(f"{data['code']}: {data['error']}")
print(data["searchResults"])Run pip install requests, save it as lurk.py and run python lurk.py. It reads your key from LURKAPI_API_KEY.
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"os"
"time"
)
func main() {
params := url.Values{}
params.Set("query", "nike")
req, _ := http.NewRequest("GET", "https://api.lurkapi.com/v1/facebook/adLibrary/search/companies?"+params.Encode(), nil)
req.Header.Set("x-api-key", os.Getenv("LURKAPI_API_KEY"))
client := &http.Client{Timeout: 60 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
panic(err)
}
if data["success"] != true {
panic(fmt.Sprintf("%v: %v", data["code"], data["error"]))
}
out, _ := json.MarshalIndent(data["searchResults"], "", " ")
fmt.Println(string(out))
}Save it as main.go and run go run main.go. It reads your key from LURKAPI_API_KEY.
<?php
$params = http_build_query([
'query' => 'nike',
]);
$context = stream_context_create(['http' => [
'header' => 'x-api-key: ' . getenv('LURKAPI_API_KEY'),
'timeout' => 60,
'ignore_errors' => true,
]]);
$body = file_get_contents('https://api.lurkapi.com/v1/facebook/adLibrary/search/companies?' . $params, false, $context);
$data = json_decode($body, true);
if (!$data['success']) {
throw new Exception("{$data['code']}: {$data['error']}");
}
print_r($data['searchResults']);Save it as lurk.php and run php lurk.php. It reads your key from LURKAPI_API_KEY.
require 'json'
require 'net/http'
uri = URI('https://api.lurkapi.com/v1/facebook/adLibrary/search/companies')
uri.query = URI.encode_www_form(
'query' => 'nike',
)
req = Net::HTTP::Get.new(uri)
req['x-api-key'] = ENV.fetch('LURKAPI_API_KEY')
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', read_timeout: 60) do |http|
http.request(req)
end
data = JSON.parse(res.body)
raise "#{data['code']}: #{data['error']}" unless data['success']
puts JSON.pretty_generate(data['searchResults'])Save it as lurk.rb and run ruby lurk.rb. It reads your key from LURKAPI_API_KEY.
Parameters
Add them to the URL after a ?, as in ?query=nike. Join several with &.
| Parameter | Description |
|---|---|
querystringrequired | Brand or page name, e.g. nike.
|
countrystringoptional | A 2-letter country code (US, GB…) whose pages rank first, or ALL.
|
Example response
A real response, captured from the live API. Lists are trimmed to a couple of items, and long text such as media links is cut short with ….
Show the example response (2 KB)Hide
{
"success": true,
"credits_remaining": 996,
"credits_charged": 1,
"searchResults": [
{
"category": "Sportswear Store",
"country": null,
"entity_type": "PERSON_PROFILE",
"ig_followers": 291075731,
"ig_username": "nike",
"ig_verification": true,
"image_uri": "https://scontent.fbts1-1.fna.fbcdn.net/v/t39.30808-1/284964043_101599038…",
"likes": 39514042,
"name": "Nike",
"page_alias": "nike",
"page_id": "15087023444",
"page_is_deleted": false,
"verification": "BLUE_VERIFIED"
},
{
"category": "Product/service",
"country": null,
"entity_type": "PERSON_PROFILE",
"ig_followers": 44794371,
"ig_username": "nikefootball",
"ig_verification": true,
"image_uri": "https://scontent.fbts1-1.fna.fbcdn.net/v/t39.30808-1/387181570_863325755…",
"likes": 40028551,
"name": "Nike Football",
"page_alias": "nikefootball",
"page_id": "51212153078",
"page_is_deleted": false,
"verification": "BLUE_VERIFIED"
}
]
}Response fields
Every field in a successful response, and what it means. A name with [] belongs to each item of a list: searchResults[].page_id is the page_id of every item in searchResults. null means there's no value.
Show all 17 fieldsHide
| Field | Type | Description |
|---|---|---|
| success | true | Always true here; errors have success: false. |
| credits_remaining | number | Your balance after this call. On anonymous playground calls: free tries left today. |
| credits_charged | number | Credits this call cost; 0 on free endpoints. On anonymous playground calls: tries used (1). |
| searchResults | object[] | Matching advertiser pages, best match first. |
| searchResults[].page_id | stringcan be null | The page id. Pass it as pageId to the company ads endpoint. |
| searchResults[].name | stringcan be null | The page's name. |
| searchResults[].page_alias | stringcan be null | Vanity name: facebook.com/<page_alias>. |
| searchResults[].category | stringcan be null | Page category, e.g. "Sportswear Store". |
| searchResults[].likes | numbercan be null | Page followers. |
| searchResults[].verification | stringcan be null | BLUE_VERIFIED or NOT_VERIFIED. |
| searchResults[].image_uri | stringcan be null | Profile picture URL. |
| searchResults[].ig_username | stringcan be null | Linked Instagram username, without @; null when none is linked. |
| searchResults[].ig_followers | numbercan be null | Followers of the linked Instagram account; null when none is linked. |
| searchResults[].ig_verification | boolean | Whether the linked Instagram account is verified; false when none is linked. |
| searchResults[].country | stringcan be null | The page's country; null in every response we've seen. |
| searchResults[].entity_type | stringcan be null | Facebook's page type; PERSON_PROFILE for most pages, brands included. |
| searchResults[].page_is_deleted | boolean | Whether the page has been deleted. |
Cost and freshness
Each call costs 1 credit. Calls turned away before they reach the platform (invalid parameters, a key or balance problem, a rate limit) are free, and so are 5xx errors. A not_found is charged, since the platform was checked. How charging works.
Answers are cached for up to 1 day. A repeat call within that time can return the same data, and costs the same.
Errors
A failed call returns success: false, an error message, a code your program can check, and a docs link. These are the errors this endpoint can return. All error codes.
| Status | Code | Meaning |
|---|---|---|
| 401 | missing_api_key | No API key was sent. Put it in the x-api-key header. |
| 401 | invalid_api_key | This key doesn't exist or was revoked. |
| 402 | insufficient_credits | Not enough credits for this call. Buy a pack, or wait for tomorrow's free top-up. |
| 402 | over_max_credits | This call would cost more than the max_credits you set. The error says what it needs; raise max_credits to allow it. Not charged. |
| 403 | account_suspended | This account is suspended. Email support@lurkapi.com. Not charged. |
| 405 | method_not_allowed | Endpoints only take GET, with parameters in the URL. |
| 429 | rate_limited | Too many calls in a short time. Wait as many seconds as the retry-after header says, then retry. |
| 500 | internal_error | Something broke on our side. Retry. Not charged. |
| 502 | upstream_error | The platform didn't send a usable answer. Retry. Not charged. |
| 503 | upstream_busy | All our connections to the platform are busy. Retry in a few seconds. Not charged. |
| 504 | upstream_timeout | The platform took over 30 seconds to answer (90 for web pages). Retry. Not charged. |
Use it in Claude
Connect LurkAPI to Claude and ask in plain English. This endpoint is the facebook_search_companies tool. For example:
Use LurkAPI's facebook_search_companies tool with query "nike", then summarize what you find.Claude calls facebook_search_companies with arguments like these, and each call costs 1 credit:
{"query": "nike"}To save tokens, tool results leave out empty fields, keep one URL per image or video, and give transcripts as plain text unless you pass timestamps=true. A result over 45,000 characters comes in parts. Its _note gives the offset for the next part, and later parts are free for 15 minutes. Pass trim=false for the full response.
From the blog
All posts
· 5 min read
Best Reddit scrapers in 2026: price and speed compared
LurkAPI is the best Reddit scraper: 1,000 subreddit posts for $0.04, a feed in 0.92 s, and search and comment threads on the same key.

· 5 min read
Instagram MCP server for Claude and ChatGPT
Claude can’t read Instagram on its own. Add one MCP URL and it reads any public account’s posts, reels and comments, 1 credit a call, no Meta app.

· 5 min read
Best Threads scrapers in 2026: what 1,000 posts cost
LurkAPI is the best Threads scraper: 1,000 posts for $0.06, a page in about 1.2 s, and pages back to an account's first post.