{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper - New and Stopped Ads Monitor",
    "description": "For marketers and agencies tracking competitors on Facebook and Instagram: Meta Ad Library ads by keyword or page, with days running, active status, text, links, images and videos. Monitor mode returns only ads that are new since your last run, plus the ones that stopped.",
    "version": "0.1",
    "x-build-id": "IKUhgqj56FvLKHEux"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/neverempty~facebook-ads-library-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-neverempty-facebook-ads-library-monitor",
        "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/neverempty~facebook-ads-library-monitor/runs": {
      "post": {
        "operationId": "runs-sync-neverempty-facebook-ads-library-monitor",
        "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/neverempty~facebook-ads-library-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-neverempty-facebook-ads-library-monitor",
        "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": "Words to search in the Meta Ad Library, one per line (for example a brand, a product or a competitor's name). An Ad Library search link (https://www.facebook.com/ads/library/?…&q=…) also works. Empty together with Pages = the example search \"nike\".",
            "items": {
              "type": "string"
            }
          },
          "pages": {
            "title": "Facebook pages (page ID or Ad Library link)",
            "type": "array",
            "description": "Advertisers to watch, one per line: a numeric page ID (15087023444), an Ad Library link that contains view_all_page_id=…, or a facebook.com/profile.php?id=… link. A page name link (facebook.com/nike) cannot be turned into an ID without logging in: open the page in the Ad Library and copy the view_all_page_id link instead. Up to 30 search terms and pages together.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Ads shown in this country: a two-letter code such as US, GB, DE or BR, or ALL for every country. Empty = ALL. Reach numbers per country (EU reach) are only published for ads shown in the EU."
          },
          "activeStatus": {
            "title": "Active or stopped ads",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Which ads to list. Empty = active ads only. With the monitor on, \"Active ads only\" also reports an ad as stopped when it leaves the full active list."
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "credit_ads",
              "financial_products_and_services_ads"
            ],
            "type": "string",
            "description": "The Ad Library category to search. Empty = all ads. Spend and impressions ranges are published only for issue, election and political ads."
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Only ads with this kind of media. Empty = all media."
          },
          "searchType": {
            "title": "How search terms match",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase"
            ],
            "type": "string",
            "description": "How the Ad Library matches your search terms. Empty = all words in any order. Has no effect on pages."
          },
          "sortBy": {
            "title": "Order",
            "enum": [
              "relevance",
              "newest"
            ],
            "type": "string",
            "description": "The order in which ads are read and returned. Empty = the Ad Library's own order. With the monitor on, ads are always read in the recently started order."
          },
          "maxItems": {
            "title": "Max ads per search or page",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "How many ads to read for each search term or page (1 to 5000). Empty = 100. With the monitor on, this is how far down the list each run compares; to report stopped ads, set it higher than the number of active ads of the search or page."
          },
          "monitor": {
            "title": "Monitor: only new and stopped ads",
            "type": "boolean",
            "description": "On = every run is charged per ad compared (ad check); the first run remembers the ads it reads and returns no ad row, and every later run returns only ads that are new since then, plus remembered active ads that stopped (changeType \"stopped\"). Off (empty) = every run returns all ads it reads."
          },
          "watchName": {
            "title": "Watch name",
            "type": "string",
            "description": "Optional label that keeps separate memories for separate watches with the same filters (letters, numbers, dot, dash or underscore, up to 40). Empty = one shared memory per country and filter set."
          },
          "resetMonitoringState": {
            "title": "Start the watch again",
            "type": "boolean",
            "description": "On = forget what this watch remembered and start over (the run is a first run again: ads compared are charged as ad checks, no ad row is returned). Empty = keep the memory."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}