{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper — Meta & Instagram Ads",
    "description": "Extract ads from the Meta Ads Library (Facebook & Instagram) by keyword, by advertiser Page or from any Ads Library link. Get ad copy, days running, carousel cards and landing pages — plus optional EU & UK reach, audience breakdown, payer and advertiser Instagram, at the same price per ad.",
    "version": "1.1",
    "x-build-id": "bqL96olFrHQnJIMne"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/brilliant_gum~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-brilliant_gum-facebook-ads-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/brilliant_gum~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-brilliant_gum-facebook-ads-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/brilliant_gum~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-brilliant_gum-facebook-ads-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "searchTerms": {
            "title": "Search Terms",
            "type": "array",
            "description": "Keywords or brand names to search in the Meta Ads Library. Each term is searched separately. Optional when you fill in Advertisers or Ads Library URLs. A Facebook Page link or an Ads Library link pasted here is used as an advertiser / Ads Library URL automatically.",
            "items": {
              "type": "string"
            }
          },
          "advertisers": {
            "title": "Advertisers (Facebook Pages)",
            "type": "array",
            "description": "Get every ad of specific advertisers instead of (or in addition to) a keyword search. Accepts a Facebook Page link (https://www.facebook.com/nike), a Page username (nike), a numeric Page ID, or the advertiser's Ads Library link (with view_all_page_id). Only an exact username match is used — the Actor never guesses a look-alike page. A name that matches no Page exactly (e.g. \"Coca-Cola\" or \"Nike Inc\") is searched as a keyword instead (without endings like Inc or Ltd), so you still get the ads that mention it. Each advertiser is scraped for each country below. Tip: the form pre-fills Search Terms with \"Nike\" — clear it if you only want these advertisers' ads.",
            "items": {
              "type": "string"
            }
          },
          "adLibraryUrls": {
            "title": "Ads Library URLs",
            "type": "array",
            "description": "Paste results links copied from facebook.com/ads/library — every filter in the link (keyword, advertiser, country, status, media type, dates) is kept as is. Countries and filters below do not apply to these links; Max Ads Per Search does. A Facebook Page link pasted here is used as an advertiser. A link to one ad (facebook.com/ads/library/?id=…) returns exactly that ad, with its EU/UK details when Include ad details is on.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "ISO 2-letter country codes (e.g. US, GB, DE), or ALL for every country. Each country is queried separately per search term and per advertiser.",
            "default": [
              "US"
            ],
            "items": {
              "type": "string"
            }
          },
          "adType": {
            "title": "Ad Category",
            "enum": [
              "ALL",
              "POLITICAL_AND_ISSUE_ADS",
              "HOUSING",
              "EMPLOYMENT",
              "FINANCIAL_PRODUCTS_AND_SERVICES"
            ],
            "type": "string",
            "description": "Filter by ad category. 'All Ads' returns every category. Political, Housing, Employment and Financial ads have additional spend/reach data in EU/UK.",
            "default": "ALL"
          },
          "adActiveStatus": {
            "title": "Ad Status",
            "enum": [
              "ALL",
              "ACTIVE",
              "INACTIVE"
            ],
            "type": "string",
            "description": "Filter by whether ads are currently running.",
            "default": "ACTIVE"
          },
          "maxAds": {
            "title": "Max Ads Per Search",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Maximum number of ads to collect per search term + country combination. Keep under 50 for a quick test run.",
            "default": 25
          },
          "resolveSnapshotUrls": {
            "title": "Resolve Snapshot URLs",
            "type": "boolean",
            "description": "Visit each ad's snapshot page to extract the real landing page URL and CDN media file URLs (images/videos). Slower — adds ~5 sec per ad. Disable for bulk collection, enable when you need destination URLs.",
            "default": false
          },
          "startDate": {
            "title": "Start Date Filter (YYYY-MM-DD)",
            "type": "string",
            "description": "Only ads that Meta shows as running on or after this date. Meta filters by when ads were shown, so an ad that started earlier but was still running in your range is included. Format: YYYY-MM-DD. Leave empty to skip.",
            "default": ""
          },
          "endDate": {
            "title": "End Date Filter (YYYY-MM-DD)",
            "type": "string",
            "description": "Only ads that Meta shows as running on or before this date (same rule as the start date). Format: YYYY-MM-DD. Leave empty to skip.",
            "default": ""
          },
          "includeAdDetails": {
            "title": "Include ad details (EU/UK reach, audience, payer)",
            "type": "boolean",
            "description": "For each ad, also collect what Meta publishes under \"See ad details\": total reach in the EU and in the UK, reach broken down by country × age × gender, the audience the advertiser targeted (locations, age range, gender), who paid for the ad and who benefits, plus the advertiser's Instagram username, follower count and verification. Meta publishes reach only for ads that were shown in the EU or UK — ads shown only elsewhere (e.g. US-only) get adDetailsStatus NOT_AVAILABLE. Same price per ad; adds about one second per ad, plus a few seconds once per search.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}