{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper - Reports & Monitor",
    "description": "Scrape public Facebook and Instagram ads by keyword, Page ID, or URL. Extract creatives and transparency data, analyze political-ad reports, resolve branded profiles, and monitor new, changed, stopped, or reactivated ads.",
    "version": "0.0",
    "x-build-id": "mlaTig5uEgTHgNNgO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapingmonkey~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapingmonkey-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/scrapingmonkey~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapingmonkey-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/scrapingmonkey~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapingmonkey-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "details",
              "political",
              "report",
              "brandedContent",
              "monitor"
            ],
            "type": "string",
            "description": "Search ads, fetch direct ad details, force political transparency, build country report tables, resolve branded profiles, or monitor ads on a schedule.",
            "default": "search"
          },
          "searchQueries": {
            "title": "Search queries",
            "maxItems": 100,
            "type": "array",
            "description": "Keywords or exact phrases for Search, Political, Branded content, and Monitor modes.",
            "items": {
              "type": "string"
            },
            "default": [
              "Nike"
            ]
          },
          "pageIds": {
            "title": "Advertiser page IDs",
            "maxItems": 100,
            "type": "array",
            "description": "Numeric Facebook Page IDs. Each page becomes an independent ad search source.",
            "items": {
              "type": "string"
            }
          },
          "pageUrls": {
            "title": "Ads Library page URLs",
            "maxItems": 100,
            "type": "array",
            "description": "Facebook Ads Library URLs containing view_all_page_id or other native filters.",
            "items": {
              "type": "string"
            }
          },
          "adArchiveIds": {
            "title": "Ad archive IDs or URLs",
            "maxItems": 100,
            "type": "array",
            "description": "Numeric ad archive IDs or direct Facebook Ads Library URLs containing ?id=. Required in Details mode.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Facebook Ads Library URLs",
            "maxItems": 100,
            "type": "array",
            "description": "Optional mixed Ads Library search, advertiser, or direct ad URLs. Existing native URL filters are retained.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "maxItems": 50,
            "type": "array",
            "description": "Two-letter country codes such as US, GB, DE, or ALL. One search can target multiple countries.",
            "items": {
              "type": "string"
            },
            "default": [
              "US"
            ]
          },
          "language": {
            "title": "Interface language",
            "type": "string",
            "description": "Request locale such as en-US, de, fr-FR, or pt-BR.",
            "default": "en-US"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "ALL",
              "POLITICAL_AND_ISSUE_ADS",
              "HOUSING_ADS",
              "EMPLOYMENT_ADS",
              "CREDIT_ADS",
              "FINANCIAL_PRODUCTS_AND_SERVICES_ADS"
            ],
            "type": "string",
            "description": "Search all ads or a regulated Ads Library category. Political mode always uses political and issue ads.",
            "default": "ALL"
          },
          "activeStatus": {
            "title": "Ad status",
            "enum": [
              "all",
              "active",
              "inactive"
            ],
            "type": "string",
            "description": "Return all, currently active, or inactive ads.",
            "default": "all"
          },
          "searchType": {
            "title": "Keyword matching",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase",
              "page"
            ],
            "type": "string",
            "description": "Unordered keywords or exact phrase matching. Page-ID searches automatically use page matching.",
            "default": "keyword_unordered"
          },
          "mediaType": {
            "title": "Creative media",
            "enum": [
              "all",
              "image",
              "meme",
              "image_and_meme",
              "video",
              "none"
            ],
            "type": "string",
            "description": "Filter by image, meme, image or meme, video, or ads without image/video.",
            "default": "all"
          },
          "publisherPlatforms": {
            "title": "Publisher platforms",
            "maxItems": 6,
            "type": "array",
            "description": "Any of FACEBOOK, INSTAGRAM, AUDIENCE_NETWORK, MESSENGER, WHATSAPP, or THREADS.",
            "items": {
              "type": "string"
            }
          },
          "contentLanguages": {
            "title": "Ad content languages",
            "maxItems": 50,
            "type": "array",
            "description": "Meta language filter values. Leave empty for every content language.",
            "items": {
              "type": "string"
            }
          },
          "bylines": {
            "title": "Political bylines or disclaimers",
            "maxItems": 100,
            "type": "array",
            "description": "Political-ad disclaimer/byline filters.",
            "items": {
              "type": "string"
            }
          },
          "regions": {
            "title": "Delivery regions",
            "maxItems": 100,
            "type": "array",
            "description": "Optional Meta delivery-region filter values, mainly useful for political ads.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Started from",
            "type": "string",
            "description": "Minimum ad start date in YYYY-MM-DD format."
          },
          "dateTo": {
            "title": "Started before",
            "type": "string",
            "description": "Maximum ad start date in YYYY-MM-DD format."
          },
          "sortMode": {
            "title": "Sort metric",
            "enum": [
              "none",
              "total_impressions",
              "reach",
              "recent"
            ],
            "type": "string",
            "description": "Use Meta's natural order or sort supported searches by impressions, reach, or recency.",
            "default": "none"
          },
          "sortDirection": {
            "title": "Sort direction",
            "enum": [
              "desc",
              "asc"
            ],
            "type": "string",
            "description": "Descending or ascending when a sort metric is selected.",
            "default": "desc"
          },
          "maxResults": {
            "title": "Maximum results per source",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum ads per query/page, report advertisers, or branded profiles per query.",
            "default": 50
          },
          "maxItems": {
            "title": "Global result limit",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum deduplicated dataset rows for the whole run. Use 0 for no Actor-level global limit.",
            "default": 0
          },
          "includeAdDetails": {
            "title": "Fetch transparency details",
            "type": "boolean",
            "description": "Open each discovered ad and add advertiser, audience, geographic, EU/UK/BR, payer, and violation data when Meta provides it.",
            "default": false
          },
          "includeRaw": {
            "title": "Include raw source objects",
            "type": "boolean",
            "description": "Keep Meta's complete source objects inside raw in addition to normalized fields. This increases dataset size.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Maximum concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Independent sources and ad detail pages processed in parallel. Conservative values reduce Meta rate limits.",
            "default": 3
          },
          "maxRequestRetries": {
            "title": "Request retries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Retries for temporary blocks, rate limits, proxy failures, stale persisted queries, and server errors. Proxy sessions rotate between attempts.",
            "default": 5
          },
          "reportCountry": {
            "title": "Report country",
            "type": "string",
            "description": "Two-letter country for Ad Library Report totals, advertisers, and locations.",
            "default": "US"
          },
          "reportDate": {
            "title": "Report snapshot date",
            "type": "string",
            "description": "Report date in YYYY-MM-DD. Defaults to the run date."
          },
          "reportTimePreset": {
            "title": "Report time range",
            "enum": [
              "YESTERDAY",
              "LAST_7_DAYS",
              "LAST_30_DAYS",
              "LAST_90_DAYS",
              "LIFELONG"
            ],
            "type": "string",
            "description": "Political-ad report aggregation window.",
            "default": "LAST_30_DAYS"
          },
          "reportQuery": {
            "title": "Advertiser name filter",
            "type": "string",
            "description": "Optional text filter for the report advertiser ranking."
          },
          "reportSortColumn": {
            "title": "Advertiser ranking metric",
            "enum": [
              "SPEND",
              "ADS"
            ],
            "type": "string",
            "description": "Rank report advertisers by spend or ad count.",
            "default": "SPEND"
          },
          "reportSortDescending": {
            "title": "Highest values first",
            "type": "boolean",
            "description": "Sort report advertisers from highest to lowest.",
            "default": true
          },
          "trackedPageIds": {
            "title": "Spend tracker page IDs",
            "maxItems": 100,
            "type": "array",
            "description": "Optional advertiser Page IDs for the report spend tracker chart.",
            "items": {
              "type": "string"
            }
          },
          "includeReportDownloads": {
            "title": "Include report download availability",
            "type": "boolean",
            "description": "Add a row describing available official report snapshots and supported countries.",
            "default": true
          },
          "brandedPlatform": {
            "title": "Branded-content platform",
            "enum": [
              "INSTAGRAM",
              "FACEBOOK"
            ],
            "type": "string",
            "description": "Resolve public creator or business profiles on Instagram or Facebook.",
            "default": "INSTAGRAM"
          },
          "brandedStartDate": {
            "title": "Branded content from",
            "type": "string",
            "description": "Selected branded-content page start date in YYYY-MM-DD."
          },
          "brandedEndDate": {
            "title": "Branded content to",
            "type": "string",
            "description": "Selected branded-content page end date in YYYY-MM-DD."
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Stable name for persistent monitor state across scheduled runs.",
            "default": "facebook-ads-monitor"
          },
          "monitorBehavior": {
            "title": "Monitor behavior",
            "enum": [
              "newOnly",
              "newAndChanged"
            ],
            "type": "string",
            "description": "Emit only new ads or all new, changed, stopped, and reactivated ads.",
            "default": "newAndChanged"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}