{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper for ClaudeCode",
    "description": "Scrapes public ads from Meta / Facebook Ads Library from Ads Library URLs, Facebook Page URLs, or keyword/page handles.",
    "version": "0.1",
    "x-build-id": "OVrVdwrHGR9n5ixHi"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/dexterous_seahorse~facebook-ads-library-scraper-for-claudecode/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-dexterous_seahorse-facebook-ads-library-scraper-for-claudecode",
        "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/dexterous_seahorse~facebook-ads-library-scraper-for-claudecode/runs": {
      "post": {
        "operationId": "runs-sync-dexterous_seahorse-facebook-ads-library-scraper-for-claudecode",
        "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/dexterous_seahorse~facebook-ads-library-scraper-for-claudecode/run-sync": {
      "post": {
        "operationId": "run-sync-dexterous_seahorse-facebook-ads-library-scraper-for-claudecode",
        "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": {
          "url": {
            "title": "Single URL or keyword",
            "type": "string",
            "description": "Optional API-compatible shortcut. Use this for a single Meta Ads Library URL, Facebook Page URL, page handle, or keyword. If startUrls is filled, startUrls takes priority."
          },
          "startUrls": {
            "title": "Meta Ad Library URL or Facebook Page URL",
            "type": "array",
            "description": "Add a Meta Ad Library URL, Facebook Page URL, page handle, or search keyword. You can add multiple URLs using Bulk edit.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "description": "Meta Ads Library URL, Facebook Page URL, page handle, or keyword to search in Meta Ads Library."
                }
              }
            }
          },
          "mode": {
            "title": "Output mode",
            "enum": [
              "canonical",
              "raw",
              "mediaOnly",
              "metadataOnly",
              "videoOnly",
              "imageOnly"
            ],
            "type": "string",
            "description": "canonical returns one normalized item per ad. mediaOnly returns compact creative/media fields. videoOnly and imageOnly filter and return compact media rows. metadataOnly omits heavy snapshot data. raw keeps the full normalized snapshot shape.",
            "default": "canonical"
          },
          "resultsLimit": {
            "title": "Maximum ads",
            "minimum": 1,
            "type": "integer",
            "description": "If you leave this field empty, the actor will scrape until the page stops loading more ads or the run times out."
          },
          "maxCards": {
            "title": "Maximum cards per ad",
            "minimum": 1,
            "type": "integer",
            "description": "Optional. Limits snapshot.cards before creative summary selection. Leave empty to keep all cards returned by Meta."
          },
          "maxPages": {
            "title": "Maximum scroll pages",
            "minimum": 1,
            "type": "integer",
            "description": "Optional. Limits how many scroll/pagination rounds are attempted after the first page load."
          },
          "stopAfterFirstPage": {
            "title": "Stop after first loaded page",
            "type": "boolean",
            "description": "If checked, the actor collects payloads from the initial page load and does not scroll for more ads.",
            "default": false
          },
          "onlyTotal": {
            "title": "I want only the total count of ads per page",
            "type": "boolean",
            "description": "If checked, the actor saves one dataset item per input with totalCount, observedAdsCount, and count confidence fields. Sample ad rows are omitted unless Include sample ads in onlyTotal is enabled.",
            "default": false
          },
          "includeResultsInOnlyTotal": {
            "title": "Include sample ads in onlyTotal",
            "type": "boolean",
            "description": "If checked, onlyTotal output includes normalized sample ads under results. By default onlyTotal is a compact count-only result.",
            "default": false
          },
          "includeAboutPage": {
            "title": "Include about page information",
            "type": "boolean",
            "description": "If checked, the actor keeps any advertiser transparency/about-page metadata returned by Meta in pageInfo.",
            "default": false
          },
          "isDetailsPerAd": {
            "title": "I want ad details as well",
            "type": "boolean",
            "description": "If checked, the actor also opens individual Ads Library detail URLs for scraped ads when possible.",
            "default": false
          },
          "activeStatus": {
            "title": "Active status (if not specified within the Meta Ad Library URL)",
            "enum": [
              "",
              "active",
              "inactive"
            ],
            "type": "string",
            "description": "Select active status for ads.",
            "default": ""
          },
          "onlyVideos": {
            "title": "Only video creatives",
            "type": "boolean",
            "description": "Return only ads whose selected creative has a playable video URL.",
            "default": false
          },
          "onlyImages": {
            "title": "Only image creatives",
            "type": "boolean",
            "description": "Return only ads whose selected creative has a real image URL and no playable video URL.",
            "default": false
          },
          "onlyCards": {
            "title": "Only ads with cards",
            "type": "boolean",
            "description": "Return only ads that contain at least one snapshot card.",
            "default": false
          },
          "dedupeByAdArchiveId": {
            "title": "Dedupe by ad archive ID",
            "type": "boolean",
            "description": "If checked, keeps one output row per adArchiveID when Meta returns repeated variants.",
            "default": true
          },
          "dedupeByCreativeUrl": {
            "title": "Dedupe by creative media URL",
            "type": "boolean",
            "description": "If checked, keeps one output row per best video/image/preview URL.",
            "default": false
          },
          "preferPlayableMedia": {
            "title": "Prefer playable media",
            "type": "boolean",
            "description": "If checked, creativeSummary prefers real video URLs over previews and still images.",
            "default": true
          },
          "excludePreviewOnly": {
            "title": "Exclude preview-only creatives",
            "type": "boolean",
            "description": "If checked, removes ads where only a video preview/thumbnail was found and no playable video or real image URL was found.",
            "default": false
          },
          "strictPageResolve": {
            "title": "Strict Facebook Page resolution",
            "type": "boolean",
            "description": "If checked, Facebook Page URLs must resolve to an exact page ID. The run fails instead of silently falling back to keyword search.",
            "default": false
          },
          "strictAdDetail": {
            "title": "Strict ad detail mode",
            "type": "boolean",
            "description": "If checked, direct Ads Library detail URLs must produce a result matching the requested ad archive ID.",
            "default": false
          },
          "strictOnlyTotal": {
            "title": "Strict total count mode",
            "type": "boolean",
            "description": "If checked, onlyTotal mode fails when Meta does not expose an explicit total count and the actor would otherwise fall back to observedAdsCount.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Meta can block datacenter traffic; residential proxy is recommended for reliable 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}