Skip to main content
POST
Scrape ads from the Meta ad library
Scrape ads from the Meta ad library.

Request

query is required.

Response

If successful, the response body contains the standard envelope. data.results[] contains the ads that match, each with its page, text, format and platforms. The following example is a real response, truncated: each list shows one item and long strings are cut.
For every field, see the response schema on this page.

Optional parameters

Billing

Each successful request consumes 1 credit, regardless of the number of items returned. Requests that fail, or that return no items, are not billed.

Pagination

Results are paginated. To retrieve the next page, pass the value of data.cursor as cursor in a subsequent request. A response that omits cursor is the last page.
  • Meta ads by page: Accepts an ad’s pageId as advertiser. Scrape the ads a Facebook page runs.
  • Meta ad details: Accepts adUrl. Scrape a Meta ad’s details.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

maxTextLength
integer

Cut every text value in the response to this many characters. A value that was cut ends with …, and a page whose text was cut has isTruncated set to true. A screenshot is never cut. Leave it out to get the full text.

Required range: x >= 1

Body

application/json
query
string
required

Words to find in the ad. Several words match as one exact phrase.

Required string length: 1 - 200
country
string
default:us

ISO 3166-1 alpha-2 country code, or all. Any case is accepted.

Pattern: ^(?:[A-Za-z]{2}|[Aa][Ll][Ll])$
status
enum<string>
default:active
Available options:
active,
inactive,
all
mediaType
enum<string>

The Ad Library's own Media type filter: image, video, or text (no image or video).

Available options:
image,
video,
text
platforms
enum<string>[]

The Ad Library's own Platform filter: only ads shown on at least one of these platforms.

Minimum array length: 1
Available options:
facebook,
instagram,
audienceNetwork,
messenger,
whatsapp,
threads
language
string

The Ad Library's own Language filter: a two-letter code like en. Only ads written in this language.

Pattern: ^[A-Za-z]{2}$
shownFrom
string<date>

The Ad Library's own Impressions by date: ads shown on or after this day.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
shownTo
string<date>

The Ad Library's own Impressions by date: ads shown on or before this day.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
cursor
string

The cursor from the previous response. Send it as is.

Minimum string length: 1

Response

The data, and the credits this call used.

success
any
required
data
object
required
creditsUsed
integer
required
requestId
string
required