{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Ad Creative Analyzer – Facebook Ad Hooks & Angles",
    "description": "Analyze competitor Facebook & Instagram ads with AI: scrapes the Meta Ad Library and extracts hook, angle, offer, CTA, emotional trigger, format, audience and a winner signal (days running). Optional video transcription. Bring your own LLM key or use the free built-in analyzer.",
    "version": "0.1",
    "x-build-id": "lchcmeDhiIKBNJzVa"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sarel-data~ai-ad-creative-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sarel-data-ai-ad-creative-analyzer",
        "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/sarel-data~ai-ad-creative-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-sarel-data-ai-ad-creative-analyzer",
        "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/sarel-data~ai-ad-creative-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-sarel-data-ai-ad-creative-analyzer",
        "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": {
          "pageIds": {
            "title": "Advertiser Page IDs / Ad Library page URLs",
            "type": "array",
            "description": "Numeric Page IDs (or Ad Library URLs containing view_all_page_id=). Returns every ad the Page runs.",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "Keywords or advertiser names",
            "type": "array",
            "description": "Keywords to search, one per line. Each term is a separate search.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Ad Library URLs",
            "type": "array",
            "description": "Paste any search URL from facebook.com/ads/library. Filters in the URL are used as-is and override the filters below.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Two-letter country code (US, GB, FR, DE...) or ALL.",
            "default": "US"
          },
          "startDateMin": {
            "title": "Date range: ads started on/after",
            "type": "string",
            "description": "Facebook's own date filter: keeps ads that were delivering on or after this date (YYYY-MM-DD). Combine with \"Filter by start date\" for ads that *started* in the range."
          },
          "startDateMax": {
            "title": "Date range: ads started on/before",
            "type": "string",
            "description": "Keeps ads that were delivering on or before this date (YYYY-MM-DD)."
          },
          "maxAds": {
            "title": "Max ads to analyze",
            "minimum": 1,
            "type": "integer",
            "description": "Total ads scraped and analyzed across all inputs.",
            "default": 20
          },
          "llmProvider": {
            "title": "AI provider (bring your own key)",
            "enum": [
              "none",
              "openai",
              "anthropic",
              "gemini",
              "openrouter",
              "groq",
              "custom"
            ],
            "type": "string",
            "description": "Your own LLM key is used for analysis, so you pay the LLM provider directly (typically well under $0.001 per ad with small models). Without a key, a built-in rule-based analyzer fills the same fields.",
            "default": "none"
          },
          "llmApiKey": {
            "title": "LLM API key",
            "type": "string",
            "description": "Your API key for the provider above. Stored encrypted, never logged."
          },
          "llmModel": {
            "title": "LLM model (optional)",
            "type": "string",
            "description": "Defaults: gpt-4o-mini, claude-3-5-haiku-latest, gemini-2.0-flash, openai/gpt-4o-mini (OpenRouter), llama-3.3-70b-versatile (Groq)."
          },
          "llmBaseUrl": {
            "title": "Custom base URL (optional)",
            "type": "string",
            "description": "For the \"custom\" provider: an OpenAI-compatible base URL such as https://my-host/v1."
          },
          "transcriptionProvider": {
            "title": "Video transcription",
            "enum": [
              "local",
              "openai",
              "groq",
              "none"
            ],
            "type": "string",
            "description": "Video ads are downloaded and the voice-over is transcribed so the spoken hook can be analyzed. \"Local\" runs faster-whisper inside the Actor at no API cost. Off by default. \"local\" (free Whisper on CPU) is slow and needs 4 GB+ memory – raise run memory if you enable it.",
            "default": "none"
          },
          "transcriptionApiKey": {
            "title": "Transcription API key",
            "type": "string",
            "description": "Required only for the OpenAI/Groq transcription options."
          },
          "localWhisperModel": {
            "title": "Local Whisper model size",
            "enum": [
              "tiny",
              "base",
              "small"
            ],
            "type": "string",
            "description": "Bigger = more accurate but slower and needs more memory.",
            "default": "tiny"
          },
          "maxTranscribeSeconds": {
            "title": "Max seconds of audio per video",
            "minimum": 5,
            "type": "integer",
            "description": "Only the first N seconds are transcribed (hooks live in the first seconds).",
            "default": 120
          },
          "maxVideosToTranscribe": {
            "title": "Max videos to transcribe",
            "minimum": 0,
            "type": "integer",
            "description": "Cap on video downloads/transcriptions per run.",
            "default": 50
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political_and_issue_ads",
              "housing_ads",
              "employment_ads",
              "financial_products_and_services_ads"
            ],
            "type": "string",
            "description": "Ad category",
            "default": "all"
          },
          "activeStatus": {
            "title": "Active status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Active status",
            "default": "active"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Media type",
            "default": "all"
          },
          "searchType": {
            "title": "Keyword matching",
            "enum": [
              "keyword_unordered",
              "keyword_exact_phrase"
            ],
            "type": "string",
            "description": "Keyword matching",
            "default": "keyword_unordered"
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Leave empty for all platforms.",
            "items": {
              "type": "string",
              "enum": [
                "facebook",
                "instagram",
                "audience_network",
                "messenger",
                "threads"
              ],
              "enumTitles": [
                "Facebook",
                "Instagram",
                "Audience Network",
                "Messenger",
                "Threads"
              ]
            }
          },
          "strictStartDate": {
            "title": "Filter by start date",
            "type": "boolean",
            "description": "Also drop ads whose start date is outside the range above (e.g. long-running ads that started earlier).",
            "default": false
          },
          "sortBy": {
            "title": "Sort",
            "enum": [
              "relevancy",
              "total_impressions"
            ],
            "type": "string",
            "description": "Sort",
            "default": "relevancy"
          },
          "includeAdDetails": {
            "title": "Include EU transparency & advertiser details",
            "type": "boolean",
            "description": "Adds EU reach (total and by age/gender/country), targeting, payer/beneficiary, page spend and Instagram info. Most useful with EU countries. Slower: one extra request per ad.",
            "default": false
          },
          "deduplicateAcrossInputs": {
            "title": "Deduplicate across inputs",
            "type": "boolean",
            "description": "Save an ad only once even if several inputs return it.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Parallel browsers",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Parallel browsers",
            "default": 3
          },
          "maxRequestRetries": {
            "title": "Retries per input",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Each retry uses a fresh browser session and proxy IP.",
            "default": 6
          },
          "analysisConcurrency": {
            "title": "Analysis concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel transcription/analysis workers.",
            "default": 3
          },
          "includeSummaryInDataset": {
            "title": "Append summary record to dataset",
            "type": "boolean",
            "description": "Adds a final item with recordType=\"summary\" (top hooks, angles, triggers). Always saved to key-value store record SUMMARY too.",
            "default": true
          },
          "directFirst": {
            "title": "Try direct connection first",
            "type": "boolean",
            "description": "Connect without a proxy first (cheapest) and use the proxy below only after Facebook blocks a request. Turn off to send all traffic through the proxy.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Fallback proxy. By default the actor connects directly and switches to this proxy only when Facebook blocks it. Residential is recommended as the fallback.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}