{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper",
    "description": "Facebook Ads Library scraper for competitor research. Find active Meta ads by keyword or Page, export ad text, images, videos, and landing pages.",
    "version": "0.3",
    "x-build-id": "SgcCWpmreygfuECbZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/devcake~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-devcake-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/devcake~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-devcake-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/devcake~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-devcake-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": {
          "searchQueries": {
            "title": "Search targets",
            "maxItems": 100,
            "type": "array",
            "description": "Enter one target per item. Examples: running shoes, 123456789, https://facebook.com/brand, or an Ads Library search URL. The target type is detected automatically.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "default": []
          },
          "maxAdsPerSearch": {
            "title": "Max ads per target",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Set how many ads to collect for each keyword, Page, or URL target. Start with 25 for a low-cost test, then increase for production.",
            "default": 100
          },
          "countryCode": {
            "title": "Ad delivery country",
            "pattern": "^(ALL|[A-Za-z]{2})$",
            "type": "string",
            "description": "Enter a two-letter country code such as US, GB, or DE. Use ALL for every country.",
            "default": "US"
          },
          "activeStatus": {
            "title": "Active status",
            "enum": [
              "ACTIVE",
              "INACTIVE",
              "ALL"
            ],
            "type": "string",
            "description": "Choose active ads, inactive ads, or both.",
            "default": "ACTIVE"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "ALL",
              "POLITICAL_AND_ISSUE_ADS",
              "HOUSING_ADS",
              "EMPLOYMENT_ADS",
              "FINANCIAL_PRODUCTS_AND_SERVICES_ADS"
            ],
            "type": "string",
            "description": "Limit results to a Meta Ads Library category.",
            "default": "ALL"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "ALL",
              "IMAGE",
              "VIDEO",
              "MEME",
              "NONE"
            ],
            "type": "string",
            "description": "Limit results by the main creative media format.",
            "default": "ALL"
          },
          "searchType": {
            "title": "Keyword matching",
            "enum": [
              "KEYWORD_UNORDERED",
              "KEYWORD_EXACT_PHRASE"
            ],
            "type": "string",
            "description": "Match query words in any order or as an exact phrase.",
            "default": "KEYWORD_UNORDERED"
          },
          "publisherPlatforms": {
            "title": "Publisher platforms",
            "uniqueItems": true,
            "type": "array",
            "description": "Leave empty to include all Meta platforms.",
            "items": {
              "type": "string",
              "enum": [
                "FACEBOOK",
                "INSTAGRAM",
                "AUDIENCE_NETWORK",
                "MESSENGER",
                "THREADS",
                "WHATSAPP"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "Threads",
                "WhatsApp"
              ]
            },
            "default": []
          },
          "contentLanguages": {
            "title": "Content languages",
            "uniqueItems": true,
            "type": "array",
            "description": "Enter BCP-47 language codes such as en, es, pt, or zh. Leave empty for every language.",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
            },
            "default": []
          },
          "startDate": {
            "title": "Earliest ad start date",
            "pattern": "^$|^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
            "type": "string",
            "description": "Select the earliest ad start date to include.",
            "default": ""
          },
          "endDate": {
            "title": "Latest ad start date",
            "pattern": "^$|^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
            "type": "string",
            "description": "Select the latest ad start date to include.",
            "default": ""
          },
          "sortBy": {
            "title": "Sort results",
            "enum": [
              "DEFAULT",
              "MOST_RECENT",
              "IMPRESSIONS"
            ],
            "type": "string",
            "description": "Use Meta's default order, newest-first grouping, or total impressions descending.",
            "default": "DEFAULT"
          },
          "includeTransparencyDetails": {
            "title": "Fetch transparency details",
            "type": "boolean",
            "description": "Fetch each public ad detail page and add advertiser verification, Instagram metrics, payer/beneficiary, demographic, regional, EU-targeting, and violation fields when Meta exposes them. <strong>Cost warning:</strong> This sends one extra request per ad and may trigger the configured ad-detail PPE charge.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}