{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library to Video Scripts: Winning Ads + AI",
    "description": "Find winning video ads on Meta (Facebook, Instagram), Google (YouTube) and TikTok, transcribe them with timestamps, get a contact sheet of each, break down hook, structure and CTA, and get original shoot-ready ad scripts for your product.",
    "version": "1.0",
    "x-build-id": "cgmcBGW6TaYNQ9LjR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ingeniela~winning-ad-video-script-writer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ingeniela-winning-ad-video-script-writer",
        "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/ingeniela~winning-ad-video-script-writer/runs": {
      "post": {
        "operationId": "runs-sync-ingeniela-winning-ad-video-script-writer",
        "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/ingeniela~winning-ad-video-script-writer/run-sync": {
      "post": {
        "operationId": "run-sync-ingeniela-winning-ad-video-script-writer",
        "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": {
          "yourProduct": {
            "title": "Your product",
            "type": "string",
            "description": "What it is, who it's for and what it does. Or just add your website below. Not needed to only review ads."
          },
          "websiteUrl": {
            "title": "Your website or product page",
            "type": "string",
            "description": "The scripts use the facts on this page (benefits, offer, reviews) and never invent others."
          },
          "offer": {
            "title": "Offer (optional)",
            "type": "string",
            "description": "e.g. '20% off the first order', 'free shipping'."
          },
          "proof": {
            "title": "Proof you can use (optional)",
            "type": "string",
            "description": "Real facts only: reviews, ratings, studies, awards. Nothing else is claimed."
          },
          "avoidClaims": {
            "title": "Never claim (optional)",
            "type": "string",
            "description": "e.g. 'medical claims, cures, before/after promises'."
          },
          "adUrls": {
            "title": "Ad or video links",
            "type": "array",
            "description": "Remake one ad for your product: a Facebook Ad Library ad link (facebook.com/ads/library/?id=…), a TikTok, Instagram or YouTube link, or a video file link. You get its transcript, audio (MP3), contact sheet, breakdown and a remix script. Leave the keywords below empty to study only these.",
            "items": {
              "type": "string"
            }
          },
          "platforms": {
            "title": "Ad platforms",
            "type": "array",
            "description": "Each platform gets its own winners.",
            "items": {
              "type": "string",
              "enum": [
                "meta",
                "google",
                "tiktok"
              ],
              "enumTitles": [
                "Meta (Facebook + Instagram Ad Library)",
                "Google (YouTube ads, Ads Transparency Center)",
                "TikTok (Creative Center top ads)"
              ]
            },
            "default": [
              "meta"
            ]
          },
          "keywords": {
            "title": "Niche keywords",
            "type": "array",
            "description": "Searched in the Meta Ad Library and TikTok Creative Center.",
            "items": {
              "type": "string"
            }
          },
          "googleAdvertisers": {
            "title": "Google: competitor domains or advertiser names",
            "type": "array",
            "description": "Google's ad library is searched by advertiser, e.g. 'theordinary.com'.",
            "items": {
              "type": "string"
            }
          },
          "tiktokPeriod": {
            "title": "TikTok: top ads of the last",
            "enum": [
              "7",
              "30",
              "180"
            ],
            "type": "string",
            "description": "Creative Center period.",
            "default": "30"
          },
          "tiktokOrderBy": {
            "title": "TikTok: rank by",
            "enum": [
              "ctr",
              "impression",
              "cvr",
              "play_6s_rate",
              "like"
            ],
            "type": "string",
            "description": "What 'winning' means on TikTok.",
            "default": "ctr"
          },
          "adLibraryUrls": {
            "title": "Or Ad Library links",
            "type": "array",
            "description": "A competitor's page in the Ad Library, or any Ad Library search link.",
            "items": {
              "type": "string"
            }
          },
          "adTexts": {
            "title": "Or paste ad scripts",
            "type": "array",
            "description": "Ads you already know work: paste their text or transcript, one per line.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Two-letter code (US, ES, MX, BR…).",
            "default": "US"
          },
          "videoOnly": {
            "title": "Video ads only",
            "type": "boolean",
            "description": "Video ads are transcribed: what they say is the script.",
            "default": true
          },
          "minDaysRunning": {
            "title": "Min days running",
            "minimum": 0,
            "maximum": 365,
            "type": "integer",
            "description": "Ads still paid for after 30+ days are usually profitable.",
            "default": 30
          },
          "adsToStudy": {
            "title": "Winning ads to study",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Max 2 per advertiser, for variety.",
            "default": 6
          },
          "transcribeVideos": {
            "title": "Transcribe the video ads",
            "type": "boolean",
            "description": "Whisper with timestamps, first 90 seconds of each video ad.",
            "default": true
          },
          "contactSheet": {
            "title": "Contact sheet per video ad",
            "type": "boolean",
            "description": "A grid of timestamped frames plus a timeline of what is said at each frame.",
            "default": true
          },
          "extractAudio": {
            "title": "Audio of each video ad (MP3)",
            "type": "boolean",
            "description": "Download the voiceover and music of each ad as an MP3.",
            "default": true
          },
          "framesPerSheet": {
            "title": "Frames per contact sheet",
            "minimum": 4,
            "maximum": 24,
            "type": "integer",
            "description": "12 = one frame every 2.5 s on a 30 s ad.",
            "default": 12
          },
          "scraperMaxCostUsd": {
            "title": "Max spend on data collection (USD)",
            "minimum": 1,
            "type": "integer",
            "description": "Limit per platform: Meta ~US$0.00075/ad, Google ~US$0.0019/ad, TikTok ~US$0.001/ad, YouTube downloads ~US$0.006/MB.",
            "default": 1
          },
          "writeScripts": {
            "title": "Write scripts for my product",
            "type": "boolean",
            "description": "Turn off to only review the winning ads (transcripts, contact sheets, breakdowns).",
            "default": true
          },
          "scriptsToWrite": {
            "title": "Scripts to write",
            "minimum": 1,
            "maximum": 15,
            "type": "integer",
            "description": "Each with scenes, voiceover, on-screen text, hooks to test and a creator brief.",
            "default": 5
          },
          "durations": {
            "title": "Lengths (seconds)",
            "type": "array",
            "description": "e.g. [15, 30, 60].",
            "default": [
              15,
              30,
              45
            ]
          },
          "formats": {
            "title": "Formats",
            "type": "array",
            "description": "e.g. 'UGC unboxing', 'routine / get ready with me', 'myth vs fact'.",
            "default": [
              "UGC testimonial",
              "problem-solution demo",
              "founder talking head"
            ],
            "items": {
              "type": "string"
            }
          },
          "hooksPerScript": {
            "title": "Hooks to test per script",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Alternative opening lines for A/B tests.",
            "default": 3
          },
          "language": {
            "title": "Language",
            "enum": [
              "English",
              "Spanish",
              "Portuguese",
              "French",
              "German",
              "Italian"
            ],
            "type": "string",
            "description": "Language of the scripts.",
            "default": "English"
          },
          "onlyNewAds": {
            "title": "Only ads not seen in earlier runs",
            "type": "boolean",
            "description": "Schedule the Actor weekly (Saved tasks → Schedule) and each run studies only the new winning ads of your competitors.",
            "default": false
          },
          "monitorName": {
            "title": "Spy name",
            "type": "string",
            "description": "Keeps the memory of seen ads separate per brand or client, e.g. 'skincare-client'.",
            "default": "default"
          },
          "slackWebhookUrl": {
            "title": "Send to Slack (incoming webhook)",
            "type": "string",
            "description": "A Slack incoming webhook link (api.slack.com/messaging/webhooks). You get the winning ads, hooks and scripts with a link to the report."
          },
          "emailTo": {
            "title": "Send by email",
            "type": "array",
            "description": "Email addresses that get the full report.",
            "items": {
              "type": "string"
            }
          },
          "notifyWhenNothingNew": {
            "title": "Notify even when nothing is new",
            "type": "boolean",
            "description": "Off = you only hear from it when there are new winning ads.",
            "default": false
          },
          "aiProvider": {
            "title": "AI provider",
            "enum": [
              "auto",
              "anthropic",
              "openai",
              "openrouter",
              "gemini",
              "xai",
              "deepseek",
              "mistral"
            ],
            "type": "string",
            "description": "Leave all keys empty to use the built-in AI (billed per AI event).",
            "default": "auto"
          },
          "aiModel": {
            "title": "AI model (optional)",
            "type": "string",
            "description": "Empty = a good default for the provider. Your OpenAI or OpenRouter key is also used for Whisper."
          },
          "anthropicApiKey": {
            "title": "Anthropic API key (optional)",
            "type": "string",
            "description": "With your own key (any provider) that provider bills you and AI events are not charged."
          },
          "openaiApiKey": {
            "title": "OpenAI API key (optional)",
            "type": "string",
            "description": "Your own key from platform.openai.com."
          },
          "openrouterApiKey": {
            "title": "OpenRouter API key (optional)",
            "type": "string",
            "description": "Your own key from openrouter.ai/keys."
          },
          "geminiApiKey": {
            "title": "Google Gemini API key (optional)",
            "type": "string",
            "description": "Your own key from aistudio.google.com/apikey."
          },
          "xaiApiKey": {
            "title": "xAI (Grok) API key (optional)",
            "type": "string",
            "description": "Your own key from console.x.ai."
          },
          "deepseekApiKey": {
            "title": "DeepSeek API key (optional)",
            "type": "string",
            "description": "Your own key from platform.deepseek.com."
          },
          "mistralApiKey": {
            "title": "Mistral API key (optional)",
            "type": "string",
            "description": "Your own key from console.mistral.ai."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}