Skip to main content

Search ads

Supply q, page_id, or both. A keyword search matches ad text; page_id scopes the request to one advertiser. ad_type supports all, political_and_issue_ads, housing_ads, employment_ads, and credit_ads. Availability still depends on what the source exposes.

Date filters

The date window selects ads that ran during the period, regardless of when they started. Dates follow the Ad Library’s Pacific-time calendar. end_date cannot precede start_date. When active_status is omitted, the API uses active, or all when end_date is before today. Set it explicitly when comparing historical searches.

Pagination

Read search_information.next_cursor from the response. If it is present, send it as cursor with the same search arguments. Stop when there is no next cursor. Use a URL encoder: cursors are opaque strings. include_page_info=true is only valid on the first request, without a cursor. Set it to false or omit it on subsequent requests. A 410 response means the saved cursor is no longer available; start a fresh search and deduplicate by ad ID.
The source’s reported total can differ from the number of ads you can retrieve. Keep the returned search information, inspect partial results, and avoid treating a result count as a complete archive.

Get one ad

Replace AD_ID with a numeric ad ID. This endpoint retrieves the detail view for one ad. Creative, advertiser, delivery, and destination fields depend on what the source makes available.

Capture an advertiser’s page

GET /facebook/pages/{page_id}/ads captures the advertiser’s Ad Library page. You can repeat ad_id to select specific ads and set wait_seconds from 5 to 60 (default 40). This is a bounded page capture, not an exhaustive paginated search. For ongoing advertiser discovery, prefer /facebook/ads?page_id=.... See credits and errors for charges and retry behavior, or open the complete API reference for all parameter definitions.