{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Ads Library Scraper: Meta Ad Library & Instagram Ads",
    "description": "Facebook and Instagram ads from the Meta Ad Library by keyword, page ID or Ad Library link. $0.50 per 1,000 ads; errors free. One row per ad: advertiser, ad text, headline, CTA, landing page, image and video URLs, carousel cards, start date, days running. Filters: country, status, media, dates.",
    "version": "0.1",
    "x-build-id": "EtmT7aoZkRdAlcF4z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/data-for-agents~facebook-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-data-for-agents-facebook-ads-library-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/data-for-agents~facebook-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-data-for-agents-facebook-ads-library-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/data-for-agents~facebook-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-data-for-agents-facebook-ads-library-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": {
          "queries": {
            "title": "Keywords",
            "maxItems": 100,
            "type": "array",
            "description": "Words to search in every advertiser's ads, as in the Ad Library search box. Example: running shoes. Each keyword is one search.",
            "items": {
              "type": "string"
            }
          },
          "pageIds": {
            "title": "Page IDs",
            "maxItems": 100,
            "type": "array",
            "description": "Numeric Facebook page IDs to get all ads of one advertiser: the view_all_page_id value in an Ad Library link. Example: 15087023444.",
            "items": {
              "type": "string"
            }
          },
          "urls": {
            "title": "Ad Library links",
            "maxItems": 100,
            "type": "array",
            "description": "Ad Library search links copied from the browser; their own filters are kept. Example: https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=shoes",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Where the ads were shown: a two-letter code such as US, GB or DE, or ALL for every country.",
            "default": "ALL"
          },
          "maxAds": {
            "title": "Max ads per search",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop each search after this many ads. Each ad is charged; one page of the Ad Library is about 10 to 30 ads.",
            "default": 50
          },
          "activeStatus": {
            "title": "Active status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "active: ads running now (the Ad Library's default). inactive: stopped ads. all: both.",
            "default": "active"
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "image_and_meme",
              "none"
            ],
            "type": "string",
            "description": "Only ads with this media: all, image, video, meme, image_and_meme or none.",
            "default": "all"
          },
          "exactPhrase": {
            "title": "Exact phrase",
            "type": "boolean",
            "description": "On: keywords must appear as written, words together and in order. Off: words anywhere in the ad.",
            "default": false
          },
          "startedAfter": {
            "title": "Started on or after",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "type": "string",
            "description": "Only ads that started running on or after this date, YYYY-MM-DD. Example: 2026-10-01."
          },
          "startedBefore": {
            "title": "Started on or before",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "type": "string",
            "description": "Only ads that started running on or before this date, YYYY-MM-DD. Example: 2026-10-14."
          },
          "minDaysRunning": {
            "title": "Minimum days running",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Only ads running at least this many days, for example 30 for proven ads. Shorter ads are skipped and not charged. 0: no minimum.",
            "default": 0
          },
          "maxDaysRunning": {
            "title": "Maximum days running",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Only ads running at most this many days, for example 7 for new ads. Longer ads are skipped and not charged. 0: no maximum.",
            "default": 0
          },
          "dedupe": {
            "title": "Remove duplicates",
            "enum": [
              "ad",
              "creative",
              "none"
            ],
            "type": "string",
            "description": "ad (default): an ad found by several searches is returned and charged once, for the first search. creative: also one row for ads with the same advertiser, text, headline and link under different IDs. none: every search returns all its ads.",
            "default": "ad"
          },
          "excludeAdIds": {
            "title": "Ad IDs to skip",
            "maxItems": 100000,
            "type": "array",
            "description": "Ad Library IDs you already have (ad_archive_id). They are skipped and not charged. Example: 850871490946466.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}