{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper: Meta Ads + Instagram Data",
    "description": "Scrape Facebook Ads Library (Meta Ad Library) with 57 fields per ad, no login needed. Get ad copy, images, videos, CTAs, Instagram followers, page verification, AI-content flag and EU transparency, plus optional EU reach and advertiser data. Search by keyword, advertiser, or any Ad Library URL.",
    "version": "0.0",
    "x-build-id": "1ro9LBW8SKmWf1NhH"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sourabhbgp~facebook-ads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sourabhbgp-facebook-ads-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/sourabhbgp~facebook-ads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sourabhbgp-facebook-ads-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/sourabhbgp~facebook-ads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sourabhbgp-facebook-ads-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "advertiser",
              "resolve"
            ],
            "type": "string",
            "description": "search: find ads by keyword. advertiser: get all ads from specific Facebook pages. resolve: look up advertiser pages by brand name and return their page IDs, follower counts and verification.",
            "default": "search"
          },
          "query": {
            "title": "Search Query",
            "type": "string",
            "description": "Keyword to search for (search mode), or the brand/advertiser name to look up (resolve mode). Examples: 'nike', 'shopify', 'real estate'."
          },
          "advertiserUrls": {
            "title": "Advertiser URLs / Page IDs",
            "type": "array",
            "description": "Facebook Page URLs or Page IDs to scrape all ads from (advertiser mode). Examples: 'https://www.facebook.com/nike' or '15087023444'.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "ISO 2-letter country code to filter ads by (e.g. US, GB, DE, IN).",
            "default": "US"
          },
          "activeStatus": {
            "title": "Active Status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Filter by ad active status.",
            "default": "active"
          },
          "adType": {
            "title": "Ad Type",
            "enum": [
              "all",
              "political_and_issue_ads"
            ],
            "type": "string",
            "description": "Filter by ad type.",
            "default": "all"
          },
          "mediaType": {
            "title": "Media Type",
            "enum": [
              "all",
              "image",
              "video"
            ],
            "type": "string",
            "description": "Filter by media type.",
            "default": "all"
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of ads to return. 0 = unlimited. If you omit this field entirely, the platform uses 100, not the 5 shown in the form.",
            "default": 100
          },
          "startDate": {
            "title": "Start Date Filter",
            "type": "string",
            "description": "Only return ads that started running on or after this date (YYYY-MM-DD). Applied to the results, so ads outside the range are never returned and never charged."
          },
          "endDate": {
            "title": "End Date Filter",
            "type": "string",
            "description": "Only return ads that started running on or before this date (YYYY-MM-DD). Applied to the results, so ads outside the range are never returned and never charged."
          },
          "urls": {
            "title": "Ads Library URLs",
            "type": "array",
            "description": "Paste full Facebook Ads Library URLs here. The actor will parse filters from the URL automatically.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries (multi)",
            "type": "array",
            "description": "ISO 2-letter country codes. Overrides the Country field. Use for multi-country search.",
            "items": {
              "type": "string"
            }
          },
          "platforms": {
            "title": "Publisher Platforms",
            "type": "array",
            "description": "Filter by platforms: FACEBOOK, INSTAGRAM, MESSENGER, THREADS, WHATSAPP",
            "items": {
              "type": "string"
            }
          },
          "languages": {
            "title": "Content Languages",
            "type": "array",
            "description": "Filter by ad content language codes (e.g. en, es, fr, de)",
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort By (not supported)",
            "enum": [
              "total_impressions",
              "start_date"
            ],
            "type": "string",
            "description": "Not currently supported. The Ad Library does not apply a sort order for anonymous access, so this value is ignored and results come back in the default ordering."
          },
          "enrichDetails": {
            "title": "Enrich with Ad Details",
            "type": "boolean",
            "description": "Fetch additional data per ad: Instagram followers, page verification, Instagram handle, entity type. Slower — adds 1 extra request per ad.",
            "default": false
          },
          "includeTransparency": {
            "title": "Include EU transparency data",
            "type": "boolean",
            "description": "Adds EU DSA transparency to each ad: who paid for it and who benefits, target age range and gender, target locations including excluded ones, total EU reach, and a per country age by gender reach breakdown. Also adds the Ad Library permalink and page deleted/restricted flags. Only EU targeted ads carry this data. Turning this on also turns on Enrich with Ad Details, which adds one request per ad and makes the run slower. Off by default so existing output is unchanged.",
            "default": false
          },
          "includeAdvertiserIntel": {
            "title": "Include advertiser intelligence (advertiser mode)",
            "type": "boolean",
            "description": "Advertiser mode only, and only when you pass numeric page IDs. Adds page level intelligence to every row from that advertiser: confirmed page owner and disclosed address, where the page admins are located by country, page creation and rename history, ad spend by disclaimer, hidden ad count and related pages. For social issue, electoral and political advertisers it also adds the aggregate targeting profile (age, gender, language, location, custom audiences, lookalike audiences). Costs one extra request per advertiser, not per ad.",
            "default": false
          },
          "audienceTimeframe": {
            "title": "Targeting profile timeframe",
            "enum": [
              "LAST_30_DAYS",
              "LAST_7_DAYS"
            ],
            "type": "string",
            "description": "Window for the aggregate targeting profile when advertiser intelligence is on.",
            "default": "LAST_30_DAYS"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. Required — Facebook rate-limits Apify datacenter IPs. Defaults to Apify residential proxy.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}