{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ad Library collector",
    "description": "Collect structured public ads from the Meta Ad Library by keyword, page, country, status, and ad category without requiring a Meta API key.",
    "version": "0.0",
    "x-build-id": "27yf7yDDn4FmeAQCK"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/data_dino~fb-meta-ads/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-data_dino-fb-meta-ads",
        "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_dino~fb-meta-ads/runs": {
      "post": {
        "operationId": "runs-sync-data_dino-fb-meta-ads",
        "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_dino~fb-meta-ads/run-sync": {
      "post": {
        "operationId": "run-sync-data_dino-fb-meta-ads",
        "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",
        "required": [
          "country"
        ],
        "properties": {
          "query": {
            "title": "Search query",
            "type": "string",
            "description": "Keyword or phrase to search in the Meta Ad Library. Leave blank to search all ads matching the other filters.",
            "default": "solar panels"
          },
          "country": {
            "title": "Country code",
            "pattern": "^[A-Za-z]{2}$",
            "type": "string",
            "description": "Two-letter ISO country code used by the Ad Library search, such as US, GB, CA, or AU.",
            "default": "US"
          },
          "adType": {
            "title": "Ad category",
            "enum": [
              "all",
              "political",
              "housing",
              "employment",
              "credit"
            ],
            "type": "string",
            "description": "Restrict results to a special ad category or collect all ad categories.",
            "default": "all"
          },
          "status": {
            "title": "Ad status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Return active ads, inactive ads, or both.",
            "default": "active"
          },
          "searchType": {
            "title": "Search matching",
            "enum": [
              "keyword",
              "exact",
              "page"
            ],
            "type": "string",
            "description": "Choose unordered keyword matching, exact phrase matching, or page matching.",
            "default": "keyword"
          },
          "sortBy": {
            "title": "Sort order",
            "enum": [
              "relevancy",
              "impressions"
            ],
            "type": "string",
            "description": "Sort by Meta relevance or by total impressions when supported by the Ad Library.",
            "default": "impressions"
          },
          "pageIds": {
            "title": "Facebook page IDs",
            "type": "array",
            "description": "Optional numeric Facebook page IDs to restrict the search. Use pageUrl or pageName when you do not know the numeric ID.",
            "items": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "default": []
          },
          "pageUrl": {
            "title": "Facebook page URL",
            "type": "string",
            "description": "Optional Facebook page URL or numeric page path. The actor extracts its numeric page ID and searches that page's ads.",
            "default": ""
          },
          "pageName": {
            "title": "Facebook page name",
            "type": "string",
            "description": "Optional page name to resolve through Meta typeahead before collecting that page's ads.",
            "default": ""
          },
          "maxResults": {
            "title": "Maximum ads",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of ad records to return. Use 0 for no limit.",
            "default": 20
          },
          "pageSize": {
            "title": "Ads per request",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Number of ads requested from Meta per GraphQL page. Smaller values can be useful when requests are rate limited.",
            "default": 10
          },
          "delay": {
            "title": "Page delay in seconds",
            "minimum": 0,
            "maximum": 60,
            "type": "number",
            "description": "Base delay between paginated requests. A small random jitter is added by the scraper.",
            "default": 2
          },
          "timeout": {
            "title": "Request timeout in seconds",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout for each Meta request.",
            "default": 30
          },
          "includeRaw": {
            "title": "Include raw response data",
            "type": "boolean",
            "description": "Include the raw GraphQL ad payload under raw_data. This can make dataset records substantially larger.",
            "default": false
          },
          "minImpressions": {
            "title": "Minimum impressions",
            "minimum": 0,
            "type": "integer",
            "description": "Optional lower bound for impression filtering."
          },
          "maxImpressions": {
            "title": "Maximum impressions",
            "minimum": 0,
            "type": "integer",
            "description": "Optional upper bound for impression filtering."
          },
          "minSpend": {
            "title": "Minimum spend",
            "minimum": 0,
            "type": "integer",
            "description": "Optional lower bound for reported spend filtering, in the ad's currency."
          },
          "maxSpend": {
            "title": "Maximum spend",
            "minimum": 0,
            "type": "integer",
            "description": "Optional upper bound for reported spend filtering, in the ad's currency."
          },
          "startDate": {
            "title": "Delivery start date",
            "type": "string",
            "description": "Optional ISO 8601 date or datetime; exclude ads that started before this value.",
            "default": ""
          },
          "endDate": {
            "title": "Delivery end date",
            "type": "string",
            "description": "Optional ISO 8601 date or datetime; exclude ads that started after this value.",
            "default": ""
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "all",
              "image",
              "video",
              "meme",
              "none"
            ],
            "type": "string",
            "description": "Optionally keep only image, video, meme, or media-free ads.",
            "default": "all"
          },
          "publisherPlatforms": {
            "title": "Publisher platforms",
            "type": "array",
            "description": "Optional platform names such as facebook, instagram, audience_network, or messenger.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "languages": {
            "title": "Creative languages",
            "type": "array",
            "description": "Optional language codes used to filter returned creatives.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "hasVideo": {
            "title": "Require video",
            "type": "boolean",
            "description": "When enabled, keep only ads with detected video creative media.",
            "default": false
          },
          "hasImage": {
            "title": "Require image",
            "type": "boolean",
            "description": "When enabled, keep only ads with detected image creative media.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}