{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook, Instagram & Meta Ad Spy ($0.50/1k)",
    "description": "⚡ Fast & Cheap ($0.50/1k): Competitor Meta, Facebook & Instagram ad spy by Page URL, @handle or keyword. Find winning ads, new launches, HD videos, CTAs & IG stats.",
    "version": "1.0",
    "x-build-id": "bTwFWLYslofp254QO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/unitbytes~facebook-instagram-ad-spy-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-unitbytes-facebook-instagram-ad-spy-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/unitbytes~facebook-instagram-ad-spy-scraper/runs": {
      "post": {
        "operationId": "runs-sync-unitbytes-facebook-instagram-ad-spy-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/unitbytes~facebook-instagram-ad-spy-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-unitbytes-facebook-instagram-ad-spy-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": {
          "pageUrls": {
            "title": "Competitor Facebook Page URLs or Ad Library URLs",
            "maxItems": 25,
            "type": "array",
            "description": "Competitor Facebook Page URLs (`https://www.facebook.com/nike`, `https://www.facebook.com/shopify`), Instagram URLs (`https://www.instagram.com/gymshark/`), or pasted Meta Ad Library URLs (up to 25 URLs/handles per run).",
            "items": {
              "type": "string"
            }
          },
          "instagramHandles": {
            "title": "Competitor Instagram Handles (Optional)",
            "maxItems": 25,
            "type": "array",
            "description": "Instagram advertiser handles (e.g. `@gymshark`, `@loungebyzalando`) to resolve and track all linked Instagram & Facebook creatives (up to 25 URLs/handles per run).",
            "items": {
              "type": "string"
            }
          },
          "queries": {
            "title": "Niche or Competitor Brand Keywords (Optional)",
            "maxItems": 50,
            "type": "array",
            "description": "Search competitor brand names or product keywords (e.g. `protein powder`, `AI note taker`). Up to 50 queries per run. Automatically overrides untouched Page URL prefill when provided.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Target Market Country (ISO Code or 'ALL')",
            "type": "string",
            "description": "2-letter country code (`US`, `GB`, `DE`, `CA`, `AU`) or `ALL` for global competitor tracking.",
            "default": "US"
          },
          "activeStatus": {
            "title": "Ad Status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Monitor live active ads or inspect historical inactive ads.",
            "default": "active"
          },
          "mediaType": {
            "title": "Creative Format Filter",
            "enum": [
              "all",
              "video",
              "image",
              "meme"
            ],
            "type": "string",
            "description": "Focus on competitor video hooks, static images, or all formats.",
            "default": "all"
          },
          "publisherPlatforms": {
            "title": "Filter Placements (Optional)",
            "type": "array",
            "description": "Restrict to `instagram`, `facebook`, `threads`, `messenger`, `whatsapp`, or `audience_network`.",
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort Order",
            "enum": [
              "default",
              "impressions",
              "relevancy"
            ],
            "type": "string",
            "description": "Native upstream sort order.",
            "default": "default"
          },
          "startDateMin": {
            "title": "Active Window From (YYYY-MM-DD)",
            "type": "string",
            "description": "Matches Meta Ad Library's native date filter (`start_date[min]`): returns competitor ads active on or after this date (e.g. `2026-01-01`)."
          },
          "scrapeAdDetails": {
            "title": "Include Instagram Followers, Page Bio & EU/UK Reach",
            "type": "boolean",
            "description": "Enriches every competitor ad with linked Instagram handle/followers, Page likes/bio, and EU/UK reach when applicable.",
            "default": true
          },
          "enableChangeTracking": {
            "title": "Track New vs Continuing Competitor Ads Across Runs",
            "type": "boolean",
            "description": "Persists advertiser ad snapshots in Key-Value Store (`AD_MONITOR_STATE`, defaulting to `meta-ads-monitor-state` on Cloud) so scheduled runs label `monitorStatus` as `'baseline'` (first run), `'new'`, or `'continuing'`, and record stopped IDs when a page catalog is fully scanned.",
            "default": true
          },
          "monitorStoreName": {
            "title": "Named Key-Value Store for Scheduled Monitoring (Optional)",
            "type": "string",
            "description": "Custom persistent Named Key-Value Store name (defaults automatically to `meta-ads-monitor-state` on Apify Cloud; also accepts `stateStoreName` via API)."
          },
          "maxItems": {
            "title": "Maximum Competitor Ads to Scrape",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum total ads to return.",
            "default": 20
          },
          "resumptionToken": {
            "title": "Resumption Token",
            "type": "string",
            "description": "Paste `resumptionToken` from `RESUMPTION_TOKEN` in Key-Value Store for zero-duplicate multi-batch pagination."
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Apify Residential Proxy is automatically configured on cloud runs.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}