Ad library API. 4 platforms, one schema.
Public ad library entries with their advertiser, creatives, run dates, placements and, where disclosed, reach and spend ranges. We handle the proxies, blocks and platform changes.
GET socialtap.dev/v1/tiktok/ad
Live data from 33 platforms.
11 endpoints, one parser.
Ads from all 4 platforms come back in the same fields, null where a platform doesn't show one.
-
Ad
TikTok Ad Library Ad API
Targeting, reach by country and takedowns
1 creditGET /v1/tiktok/ad -
Ad
TikTok Ad Library Search API
Ads by keyword or advertiser, with reach
1 credit / pageGET /v1/tiktok/search_ads -
Ad
TikTok Top Ads API
Best-performing ads by country, period and industry
1 credit / pageGET /v1/tiktok/top_ads -
Ad
Facebook Ad Library Ad API
Creatives, run dates, placements and EU reach
1 creditGET /v1/facebook/ad -
Ad
Facebook Ad Library Advertiser Ads API
Active and past ads of one Page, with creatives
1 credit / pageGET /v1/facebook/ads -
Ad
Facebook Ad Library Search API
Ads by keyword, with creatives and run dates
1 credit / pageGET /v1/facebook/search_ads -
Ad
Google Ads Transparency Center Ad API
Advertiser, creative and where and when it ran
1 creditGET /v1/google/ad -
Ad
Google Ads Transparency Center Advertiser Ads API
Advertiser's ads by format, service and date
1 credit / pageGET /v1/google/ads -
Ad
Google Ads Transparency Center Ads by Website API
Ads that lead to a website, from any advertiser
1 credit / pageGET /v1/google/search_ads -
Ad
LinkedIn Ad Library Ad API
Creative, payer and EU targeting, in any format
1 creditGET /v1/linkedin/ad -
Ad
LinkedIn Ad Library Search API
Ads by keyword, advertiser or payer
1 credit / pageGET /v1/linkedin/search_ads
Call the Ad library API from your code.
Copy the request for your language, or hand it to your agent.
const params = new URLSearchParams({
url: "https://library.tiktok.com/ads/detail/?ad_id=1874500065342865",
});
const res = await fetch(`https://socialtap.dev/v1/tiktok/ad?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/tiktok/ad",
params={"url": "https://library.tiktok.com/ads/detail/?ad_id=1874500065342865"},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, meta = body["data"], body["meta"]
print(data, meta["credits_charged"])require "json"
require "net/http"
uri = URI("https://socialtap.dev/v1/tiktok/ad")
uri.query = URI.encode_www_form('url' => 'https://library.tiktok.com/ads/detail/?ad_id=1874500065342865')
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]<?php
$query = http_build_query([
'url' => 'https://library.tiktok.com/ads/detail/?ad_id=1874500065342865',
]);
$ch = curl_init('https://socialtap.dev/v1/tiktok/ad?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
q.Set("url", "https://library.tiktok.com/ads/detail/?ad_id=1874500065342865")
req, err := http.NewRequest("GET", "https://socialtap.dev/v1/tiktok/ad?"+q.Encode(), nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var body struct {
Data json.RawMessage `json:"data"`
Meta map[string]any `json:"meta"`
Error *struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
if body.Error != nil {
log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
}
fmt.Println(string(body.Data), body.Meta["credits_charged"])
}curl -G 'https://socialtap.dev/v1/tiktok/ad' \
--data-urlencode 'url=https://library.tiktok.com/ads/detail/?ad_id=1874500065342865' \
-H "x-api-key: $SOCIALTAP_API_KEY"GET https://socialtap.dev/v1/tiktok/adDocs const params = new URLSearchParams({
query: "coffee",
});
const res = await fetch(`https://socialtap.dev/v1/tiktok/search_ads?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, page, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/tiktok/search_ads",
params={"query": "coffee"},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, page, meta = body["data"], body["page"], body["meta"]
print(data, meta["credits_charged"])require "json"
require "net/http"
uri = URI("https://socialtap.dev/v1/tiktok/search_ads")
uri.query = URI.encode_www_form('query' => 'coffee')
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]<?php
$query = http_build_query([
'query' => 'coffee',
]);
$ch = curl_init('https://socialtap.dev/v1/tiktok/search_ads?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
q.Set("query", "coffee")
req, err := http.NewRequest("GET", "https://socialtap.dev/v1/tiktok/search_ads?"+q.Encode(), nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var body struct {
Data json.RawMessage `json:"data"`
Page json.RawMessage `json:"page"`
Meta map[string]any `json:"meta"`
Error *struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
if body.Error != nil {
log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
}
fmt.Println(string(body.Data), body.Meta["credits_charged"])
}curl 'https://socialtap.dev/v1/tiktok/search_ads?query=coffee' \
-H "x-api-key: $SOCIALTAP_API_KEY"GET https://socialtap.dev/v1/tiktok/search_adsDocs const params = new URLSearchParams({
});
const res = await fetch(`https://socialtap.dev/v1/tiktok/top_ads?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, page, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/tiktok/top_ads",
params={},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, page, meta = body["data"], body["page"], body["meta"]
print(data, meta["credits_charged"])require "json"
require "net/http"
uri = URI("https://socialtap.dev/v1/tiktok/top_ads")
uri.query = URI.encode_www_form()
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]<?php
$query = http_build_query([
]);
$ch = curl_init('https://socialtap.dev/v1/tiktok/top_ads?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
req, err := http.NewRequest("GET", "https://socialtap.dev/v1/tiktok/top_ads?"+q.Encode(), nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var body struct {
Data json.RawMessage `json:"data"`
Page json.RawMessage `json:"page"`
Meta map[string]any `json:"meta"`
Error *struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
if body.Error != nil {
log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
}
fmt.Println(string(body.Data), body.Meta["credits_charged"])
}curl 'https://socialtap.dev/v1/tiktok/top_ads' \
-H "x-api-key: $SOCIALTAP_API_KEY"GET https://socialtap.dev/v1/tiktok/top_adsDocs const params = new URLSearchParams({
url: "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=DE&id=1103375555695370&media_type=all",
});
const res = await fetch(`https://socialtap.dev/v1/facebook/ad?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/facebook/ad",
params={"url": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=DE&id=1103375555695370&media_type=all"},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, meta = body["data"], body["meta"]
print(data, meta["credits_charged"])require "json"
require "net/http"
uri = URI("https://socialtap.dev/v1/facebook/ad")
uri.query = URI.encode_www_form('url' => 'https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=DE&id=1103375555695370&media_type=all')
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]<?php
$query = http_build_query([
'url' => 'https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=DE&id=1103375555695370&media_type=all',
]);
$ch = curl_init('https://socialtap.dev/v1/facebook/ad?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
q.Set("url", "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=DE&id=1103375555695370&media_type=all")
req, err := http.NewRequest("GET", "https://socialtap.dev/v1/facebook/ad?"+q.Encode(), nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var body struct {
Data json.RawMessage `json:"data"`
Meta map[string]any `json:"meta"`
Error *struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
if body.Error != nil {
log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
}
fmt.Println(string(body.Data), body.Meta["credits_charged"])
}curl -G 'https://socialtap.dev/v1/facebook/ad' \
--data-urlencode 'url=https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=DE&id=1103375555695370&media_type=all' \
-H "x-api-key: $SOCIALTAP_API_KEY"GET https://socialtap.dev/v1/facebook/adDocs const params = new URLSearchParams({
handle: "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=20531316728&search_type=page&media_type=all",
});
const res = await fetch(`https://socialtap.dev/v1/facebook/ads?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, page, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/facebook/ads",
params={"handle": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=20531316728&search_type=page&media_type=all"},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, page, meta = body["data"], body["page"], body["meta"]
print(data, meta["credits_charged"])require "json"
require "net/http"
uri = URI("https://socialtap.dev/v1/facebook/ads")
uri.query = URI.encode_www_form('handle' => 'https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=20531316728&search_type=page&media_type=all')
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]<?php
$query = http_build_query([
'handle' => 'https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=20531316728&search_type=page&media_type=all',
]);
$ch = curl_init('https://socialtap.dev/v1/facebook/ads?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
q.Set("handle", "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=20531316728&search_type=page&media_type=all")
req, err := http.NewRequest("GET", "https://socialtap.dev/v1/facebook/ads?"+q.Encode(), nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var body struct {
Data json.RawMessage `json:"data"`
Page json.RawMessage `json:"page"`
Meta map[string]any `json:"meta"`
Error *struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
if body.Error != nil {
log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
}
fmt.Println(string(body.Data), body.Meta["credits_charged"])
}curl -G 'https://socialtap.dev/v1/facebook/ads' \
--data-urlencode 'handle=https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=20531316728&search_type=page&media_type=all' \
-H "x-api-key: $SOCIALTAP_API_KEY"GET https://socialtap.dev/v1/facebook/adsDocs const params = new URLSearchParams({
country: "US",
query: "coffee",
});
const res = await fetch(`https://socialtap.dev/v1/facebook/search_ads?${params}`, {
headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, page, meta } = body;
console.log(data, meta.credits_charged);import os
import requests
res = requests.get(
"https://socialtap.dev/v1/facebook/search_ads",
params={"country": "US", "query": "coffee"},
headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, page, meta = body["data"], body["page"], body["meta"]
print(data, meta["credits_charged"])require "json"
require "net/http"
uri = URI("https://socialtap.dev/v1/facebook/search_ads")
uri.query = URI.encode_www_form('country' => 'US', 'query' => 'coffee')
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]<?php
$query = http_build_query([
'country' => 'US',
'query' => 'coffee',
]);
$ch = curl_init('https://socialtap.dev/v1/facebook/search_ads?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os"
)
func main() {
q := url.Values{}
q.Set("country", "US")
q.Set("query", "coffee")
req, err := http.NewRequest("GET", "https://socialtap.dev/v1/facebook/search_ads?"+q.Encode(), nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var body struct {
Data json.RawMessage `json:"data"`
Page json.RawMessage `json:"page"`
Meta map[string]any `json:"meta"`
Error *struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
if body.Error != nil {
log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
}
fmt.Println(string(body.Data), body.Meta["credits_charged"])
}curl 'https://socialtap.dev/v1/facebook/search_ads?country=US&query=coffee' \
-H "x-api-key: $SOCIALTAP_API_KEY"GET https://socialtap.dev/v1/facebook/search_adsDocs Does the Facebook Ad Library Ad API return ads that stopped running?
What do I send?
Is the data live?
What does null mean in a response?
Are the fields the same on every platform?
What happens when a platform changes its pages?
Do you read private or logged-in content?
Can my AI agent use it?
Send your first request in a minute.
Get a key, send a link you already have and see what comes back. The same key works on every platform.
- No credit card
- Failed requests are free
- Works on all 218 endpoints