> ## Documentation Index
> Fetch the complete documentation index at: https://developers.scrapeunblocker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scrape an advertiser's Meta (Facebook) ads

> Pulls a Facebook/Instagram advertiser's ads from the Meta Ad Library and returns them as JSON for competitor analysis: `ad_text`, `title`, `cta_text`/`cta_type`, `display_format` (image/video/DCO/carousel), `creatives` (image and video URLs), `link_url` (the landing page), `platforms`, `started_running`/`ended`, and `is_active`. `advertiser` is a Page name (keyword search) or a numeric Page ID (that advertiser's whole set). Meta scopes the library by `country`. Use `active_status` ('active'/'inactive'/'all') and `media_type` to filter, and `max_ads` to bound the result.



## OpenAPI

````yaml /api-reference/openapi.json post /ads/meta-ad-library
openapi: 3.1.0
info:
  title: ScrapeUnblocker API
  description: >-
    Public API for the ScrapeUnblocker proxy/anti-bot service. Authenticate
    every request with the `x-scrapeunblocker-key` header. Three endpoints are
    documented here: page-source extraction, Google SERP scraping, and image
    fetch. All other paths exist for internal operations and are intentionally
    hidden from this spec.
  version: 3.0.0
servers:
  - url: https://api.scrapeunblocker.com
    description: Production
security: []
paths:
  /ads/meta-ad-library:
    post:
      tags:
        - Plugins
      summary: Scrape an advertiser's Meta (Facebook) ads
      description: >-
        Pulls a Facebook/Instagram advertiser's ads from the Meta Ad Library and
        returns them as JSON for competitor analysis: `ad_text`, `title`,
        `cta_text`/`cta_type`, `display_format` (image/video/DCO/carousel),
        `creatives` (image and video URLs), `link_url` (the landing page),
        `platforms`, `started_running`/`ended`, and `is_active`. `advertiser` is
        a Page name (keyword search) or a numeric Page ID (that advertiser's
        whole set). Meta scopes the library by `country`. Use `active_status`
        ('active'/'inactive'/'all') and `media_type` to filter, and `max_ads` to
        bound the result.
      operationId: meta_ad_library_ads_meta_ad_library_post
      parameters:
        - name: advertiser
          in: query
          required: true
          schema:
            type: string
            description: >-
              Advertiser to pull ads for: a Facebook Page name (keyword search)
              or a numeric Page ID (that advertiser's whole set).
            title: Advertiser
          description: >-
            Advertiser to pull ads for: a Facebook Page name (keyword search) or
            a numeric Page ID (that advertiser's whole set).
        - name: country
          in: query
          required: false
          schema:
            type: string
            description: >-
              Ad Library country (ISO-2, e.g. 'US', 'GB', 'DE'). Meta scopes the
              library by country.
            default: US
            title: Country
          description: >-
            Ad Library country (ISO-2, e.g. 'US', 'GB', 'DE'). Meta scopes the
            library by country.
        - name: active_status
          in: query
          required: false
          schema:
            type: string
            description: 'Which ads to return: ''active'', ''inactive'', or ''all''.'
            default: active
            title: Active Status
          description: 'Which ads to return: ''active'', ''inactive'', or ''all''.'
        - name: media_type
          in: query
          required: false
          schema:
            type: string
            description: 'Creative type filter: ''all'', ''image'', ''video'', or ''meme''.'
            default: all
            title: Media Type
          description: 'Creative type filter: ''all'', ''image'', ''video'', or ''meme''.'
        - name: max_ads
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            description: >-
              Upper bound on ads returned (the scraper paginates until it
              reaches this or runs out).
            default: 50
            title: Max Ads
          description: >-
            Upper bound on ads returned (the scraper paginates until it reaches
            this or runs out).
      responses:
        '200':
          description: >-
            JSON with a `results` array of ads (may be empty if the advertiser
            has no ads for the given filters).
          content:
            application/json:
              schema: {}
        '400':
          description: Invalid query parameter (country/active_status/media_type).
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '502':
          description: Blocked by Meta or no ads collected (proxy/anti-bot failure).
        '504':
          description: Fetch timed out.
      security:
        - ScrapeUnblockerKey: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ScrapeUnblockerKey:
      type: apiKey
      in: header
      name: x-scrapeunblocker-key
      description: Your ScrapeUnblocker API key. Apply on every request.

````