{
  "openapi": "3.0.1",
  "info": {
    "title": "Ad Library Export - Meta & Microsoft Official APIs",
    "description": "Export Microsoft (Bing) Ad Library ads with no token: advertiser, ad text, landing page, served dates, EU impression ranges by country. Meta Ad Library too, with your own Meta token (no Meta proof run on our side yet). Official APIs only. $0.0008 per ad + $0.02 per run.",
    "version": "1.1",
    "x-build-id": "NgXx7K0tQSh0AJpHF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/digivibetech~meta-ad-library-api-export/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-digivibetech-meta-ad-library-api-export",
        "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/digivibetech~meta-ad-library-api-export/runs": {
      "post": {
        "operationId": "runs-sync-digivibetech-meta-ad-library-api-export",
        "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/digivibetech~meta-ad-library-api-export/run-sync": {
      "post": {
        "operationId": "run-sync-digivibetech-meta-ad-library-api-export",
        "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": {
          "sources": {
            "title": "Ad libraries",
            "type": "array",
            "description": "Which official ad libraries to search. Meta needs your own access token below; without a token the Meta leg is skipped (or, if Meta is the only library, you get 3 free illustrative sample rows). Microsoft's public Ad Library API needs no login and returns real Bing ads shown in the EU/EEA. 'maxAds' is the total across both libraries.",
            "items": {
              "type": "string",
              "enum": [
                "meta",
                "microsoft"
              ],
              "enumTitles": [
                "Meta Ad Library (Facebook, Instagram; needs your token)",
                "Microsoft Ad Library (Bing ads in the EU/EEA; no token needed)"
              ]
            },
            "default": [
              "meta",
              "microsoft"
            ]
          },
          "accessToken": {
            "title": "Meta access token (your own)",
            "type": "string",
            "description": "Your own Meta user or System User access token with Ad Library API access (identity confirmed at facebook.com/ID, terms accepted at facebook.com/ads/library/api). Stored encrypted by Apify, sent only to graph.facebook.com in the Authorization header, removed from every returned URL, never logged. Leave empty to search only the Microsoft Ad Library (real ads, no token), or, with Meta as the only library, to get 3 free illustrative sample rows."
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords to search in ad text (max 100 characters each, up to 50). Each term is one query; ads found by several queries are returned and charged once.",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Search type",
            "enum": [
              "KEYWORD_UNORDERED",
              "KEYWORD_EXACT_PHRASE"
            ],
            "type": "string",
            "description": "How Meta matches the search terms.",
            "default": "KEYWORD_UNORDERED"
          },
          "searchPageIds": {
            "title": "Facebook page ids",
            "type": "array",
            "description": "Numeric page ids (from an Ad Library URL: view_all_page_id=...). Sent 10 per request, Meta's limit. Can be combined with search terms.",
            "items": {
              "type": "string"
            }
          },
          "microsoftAdvertiserIds": {
            "title": "Microsoft advertiser ids (optional)",
            "type": "array",
            "description": "AdvertiserId values from the Microsoft Ad Library (numbers) to export all of an advertiser's EU/EEA Bing ads. Meta page ids above do not apply to Microsoft.",
            "items": {
              "type": "string"
            }
          },
          "adReachedCountries": {
            "title": "Ad reached countries",
            "type": "array",
            "description": "ISO two-letter country codes (e.g. DE, FR, BR) or ALL. Coverage limit: ads that did not reach any EU country are only returned when they are about social issues, elections or politics.",
            "items": {
              "type": "string"
            }
          },
          "adType": {
            "title": "Ad type",
            "enum": [
              "ALL",
              "POLITICAL_AND_ISSUE_ADS",
              "EMPLOYMENT_ADS",
              "HOUSING_ADS",
              "FINANCIAL_PRODUCTS_AND_SERVICES_ADS"
            ],
            "type": "string",
            "description": "Political and issue ads add spend, impressions, audience size, funder byline and demographic/regional distribution.",
            "default": "ALL"
          },
          "adActiveStatus": {
            "title": "Active status",
            "enum": [
              "ACTIVE",
              "INACTIVE",
              "ALL"
            ],
            "type": "string",
            "description": "Running ads, stopped ads, or both.",
            "default": "ACTIVE"
          },
          "deliveryDateMin": {
            "title": "Delivered on or after",
            "type": "string",
            "description": "Only ads delivered on or after this date (YYYY-MM-DD). Optional."
          },
          "deliveryDateMax": {
            "title": "Delivered on or before",
            "type": "string",
            "description": "Only ads delivered on or before this date (YYYY-MM-DD). Optional."
          },
          "languages": {
            "title": "Ad languages",
            "type": "array",
            "description": "ISO 639-1 codes such as en, de, es. Empty = any language.",
            "items": {
              "type": "string"
            }
          },
          "publisherPlatforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Only ads that ran on these Meta technologies. Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "FACEBOOK",
                "INSTAGRAM",
                "AUDIENCE_NETWORK",
                "MESSENGER",
                "WHATSAPP",
                "OCULUS",
                "THREADS"
              ]
            }
          },
          "mediaType": {
            "title": "Media type",
            "enum": [
              "ALL",
              "IMAGE",
              "MEME",
              "VIDEO",
              "NONE"
            ],
            "type": "string",
            "description": "Only ads with this kind of media.",
            "default": "ALL"
          },
          "maxAds": {
            "title": "Max ads per run",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Safety cap on unique ads exported (each costs one 'ad-exported' event). The small default keeps a first test run to about one cent.",
            "default": 25
          },
          "maxChargeUsd": {
            "title": "Max charge for this run (USD, optional)",
            "minimum": 0,
            "type": "number",
            "description": "Extra cap on top of Apify's own max cost per run: the run stops before exported ads would cost more than this."
          },
          "includeTargeting": {
            "title": "Include EU/UK targeting and reach breakdown",
            "type": "boolean",
            "description": "Adds target ages, gender, locations and the age/country/gender reach breakdown Meta publishes for ads delivered in the EU/UK. Larger rows, same price.",
            "default": false
          },
          "microsoftAdDetails": {
            "title": "Microsoft ad details (dates, impressions, countries)",
            "type": "boolean",
            "description": "For each Microsoft ad, also read its details: first and last served date, total EU impressions range, impression share per country and targeting types. One extra API call per ad (slower), no extra charge.",
            "default": true
          },
          "apiVersion": {
            "title": "Graph API version",
            "enum": [
              "v25.0",
              "v26.0",
              "v24.0"
            ],
            "type": "string",
            "description": "Meta Graph API version used for ads_archive.",
            "default": "v25.0"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}