{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ad Library Facebook & Instagram Ad Intelligence",
    "description": "Scrape Meta's Ad Library to research Facebook and Instagram advertising strategies. Discover competitor creatives, copy & targeting insights.\nAd creative extraction\nCopy analysis\nPlatform targeting\nDemographic insights\nSpend estimates\nStatus filtering\nAd research\nCreative inspo\nCompetitors",
    "version": "1.0",
    "x-build-id": "vJvitRdRCIacZR1lp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alizarin_refrigerator-owner~meta-ad-library-facebook-instagram-ad-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alizarin_refrigerator-owner-meta-ad-library-facebook-instagram-ad-intelligence",
        "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/alizarin_refrigerator-owner~meta-ad-library-facebook-instagram-ad-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-alizarin_refrigerator-owner-meta-ad-library-facebook-instagram-ad-intelligence",
        "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/alizarin_refrigerator-owner~meta-ad-library-facebook-instagram-ad-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-alizarin_refrigerator-owner-meta-ad-library-facebook-instagram-ad-intelligence",
        "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": {
          "searchQuery": {
            "title": "Search Query",
            "type": "string",
            "description": "Search for ads by keyword (e.g., 'fitness app', 'meal delivery')"
          },
          "pageName": {
            "title": "Page Name",
            "type": "string",
            "description": "Search for ads from a specific Facebook/Instagram page (e.g., 'Nike', 'Adidas')"
          },
          "pageId": {
            "title": "Page ID",
            "type": "string",
            "description": "Direct Facebook Page ID (more accurate than name search)"
          },
          "country": {
            "title": "Country",
            "enum": [
              "US",
              "GB",
              "CA",
              "AU",
              "DE",
              "FR",
              "ES",
              "IT",
              "BR",
              "IN",
              "MX",
              "JP",
              "KR",
              "ALL"
            ],
            "type": "string",
            "description": "Filter ads by target country",
            "default": "US"
          },
          "platform": {
            "title": "Platform Filter",
            "enum": [
              "ALL",
              "FACEBOOK",
              "INSTAGRAM",
              "MESSENGER",
              "AUDIENCE_NETWORK"
            ],
            "type": "string",
            "description": "Filter by platform where ads run",
            "default": "ALL"
          },
          "adType": {
            "title": "Ad Type",
            "enum": [
              "ALL",
              "POLITICAL",
              "HOUSING",
              "EMPLOYMENT",
              "CREDIT"
            ],
            "type": "string",
            "description": "Type of ads to search for (special categories)",
            "default": "ALL"
          },
          "mediaType": {
            "title": "Media Type",
            "enum": [
              "ALL",
              "IMAGE",
              "VIDEO",
              "MEME",
              "NONE"
            ],
            "type": "string",
            "description": "Filter by ad creative format",
            "default": "ALL"
          },
          "activeStatus": {
            "title": "Ad Status",
            "enum": [
              "ALL",
              "ACTIVE",
              "INACTIVE"
            ],
            "type": "string",
            "description": "Filter by ad status",
            "default": "ACTIVE"
          },
          "maxAds": {
            "title": "Maximum Ads",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of ads to scrape",
            "default": 50
          },
          "includeCreatives": {
            "title": "Include Creatives",
            "type": "boolean",
            "description": "Download ad images and video URLs",
            "default": true
          },
          "includeEngagement": {
            "title": "Include Engagement Metrics",
            "type": "boolean",
            "description": "Include detailed engagement metrics (impressions, reach, spend estimates)",
            "default": false
          },
          "demoMode": {
            "title": "Demo Mode",
            "type": "boolean",
            "description": "Generate sample data for testing (no scraping, no charges). Set to FALSE for real scraping.",
            "default": true
          },
          "useFirecrawl": {
            "title": "Use Firecrawl",
            "type": "boolean",
            "description": "Use Firecrawl API for enhanced scraping (requires API key)",
            "default": false
          },
          "firecrawlApiKey": {
            "title": "Firecrawl API Key",
            "type": "string",
            "description": "Your Firecrawl API key from firecrawl.dev"
          },
          "useCamoufox": {
            "title": "Use Camoufox",
            "type": "boolean",
            "description": "Use Camoufox browser for anti-detection (helps avoid blocks)",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Proxy settings for scraping"
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "URL to POST results when scraping completes (Zapier, Make, n8n)"
          },
          "enableSentimentAnalysis": {
            "title": "Enable AI Sentiment Analysis",
            "type": "boolean",
            "description": "Use AI to analyze sentiment and tone of ad copy",
            "default": false
          },
          "aiProvider": {
            "title": "AI Provider",
            "enum": [
              "none",
              "openai",
              "anthropic",
              "google",
              "mistral",
              "cohere"
            ],
            "type": "string",
            "description": "Which AI provider to use for sentiment analysis",
            "default": "none"
          },
          "aiApiKey": {
            "title": "AI API Key",
            "type": "string",
            "description": "API key for your chosen AI provider"
          },
          "aiModel": {
            "title": "AI Model (Optional)",
            "type": "string",
            "description": "Custom model name (leave empty for default). Examples: gpt-4o, claude-3-5-sonnet-20241022, gemini-1.5-pro"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}