{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper",
    "description": "Collect ads from the public LinkedIn Ad Library by company name, keyword, or URL. Extracts ad text, MP4 video links, UTM destination URLs, paying entities, EU impressions, and targeting settings without login.",
    "version": "1.1",
    "x-build-id": "GPf2PnJ8e1oCj8osS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gutacker~linkedin-ad-library/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gutacker-linkedin-ad-library",
        "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/gutacker~linkedin-ad-library/runs": {
      "post": {
        "operationId": "runs-sync-gutacker-linkedin-ad-library",
        "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/gutacker~linkedin-ad-library/run-sync": {
      "post": {
        "operationId": "run-sync-gutacker-linkedin-ad-library",
        "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": {
          "advertisers": {
            "title": "Company / Advertiser Names",
            "type": "array",
            "description": "Company names to look up, such as 'HubSpot', 'Salesforce', 'Personio', or 'Stripe' (single-field 'query', 'company', or 'advertiser' is also accepted). Only ads whose advertiser name equals the requested name or starts with it (ignoring case, punctuation and legal forms like Inc./GmbH) are returned; LinkedIn also lists ads of unrelated advertisers whose name merely contains the text. Use Keywords to search without this filter.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Optional search terms across LinkedIn ads, e.g. 'SOC2', 'CRM', or 'Kubernetes'.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "adUrls": {
            "title": "Direct LinkedIn Ad Library URLs",
            "type": "array",
            "description": "Optional https://www.linkedin.com/ad-library/search or /ad-library/detail/<id> URLs. Only https URLs on linkedin.com / www.linkedin.com with a path starting /ad-library/ are accepted; any other URL is reported as a failed input in RUN_SUMMARY and never fetched. A /ad-library/detail/<id> URL always loads the detail page and is billed 'ad' plus 'ad-detail'. Duplicate URLs (and duplicate advertisers/keywords) are processed once. Detail URLs are processed before the searches, so the detailed record wins when a search finds the same ad.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Country Filter (ISO-2 or ALL)",
            "type": "string",
            "description": "Use 'ALL' or comma-separated ISO-2 country codes like 'DE', 'US', 'GB', or 'DE,FR,NL'. EU countries include impression and targeting disclosures in detail mode.",
            "default": "ALL"
          },
          "adFormat": {
            "title": "Ad Format",
            "enum": [
              "ALL",
              "IMAGE",
              "VIDEO",
              "CAROUSEL",
              "DOCUMENT",
              "EVENT",
              "TEXT"
            ],
            "type": "string",
            "description": "Filter returned ads to one format or keep all.",
            "default": "ALL"
          },
          "dateOption": {
            "title": "Date Window",
            "enum": [
              "ALL",
              "last-30-days",
              "current-month",
              "current-year",
              "last-year",
              "custom-date-range"
            ],
            "type": "string",
            "description": "Time range supported by LinkedIn Ad Library.",
            "default": "ALL"
          },
          "startDate": {
            "title": "Custom Start Date (YYYY-MM-DD)",
            "type": "string",
            "description": "Start date when Date Window is set to 'custom-date-range' (within the past 12 months).",
            "default": ""
          },
          "endDate": {
            "title": "Custom End Date (YYYY-MM-DD)",
            "type": "string",
            "description": "End date when Date Window is set to 'custom-date-range'.",
            "default": ""
          },
          "maxAdsPerQuery": {
            "title": "Max Ads per Query",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum ads returned per advertiser, keyword, or URL.",
            "default": 24
          },
          "fetchAdDetails": {
            "title": "Fetch Ad Detail Pages",
            "type": "boolean",
            "description": "Loads each ad's detail page to get full text, destination URLs with UTM parameters, MP4 video streams, legal payer, run dates, EU impression numbers, and targeting settings. Billed via 'ad-detail'.",
            "default": false
          },
          "minDaysActive": {
            "title": "Minimum Days Active",
            "minimum": 0,
            "maximum": 3650,
            "type": "integer",
            "description": "Keep only ads active for at least this many days. Automatically turns on Fetch Ad Detail Pages when greater than 0. Every inspected ad needs its own detail request, so a query stops scanning after 50 consecutive ads without a match (and after at most 5 x Max Ads per Query inspected ads); inspected ads that are filtered out are not billed. LinkedIn shows no run dates for some ads (mostly new ones); with this filter above 0 those ads are skipped because their age is unknown, and they are counted in RUN_SUMMARY.undatedAdsSkipped.",
            "default": 0
          },
          "concurrency": {
            "title": "Parallel Detail Requests",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Number of concurrent HTTP/2 detail requests.",
            "default": 8
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "LinkedIn blocks cloud/AWS datacenter IPs (HTTP 403) and Apify Proxy restricts linkedin.com on datacenter pools (HTTP 597). Platform runs default to Apify RESIDENTIAL proxies. Traffic per 1,000 ads has not been measured: every search page is one request, and detail pages (Fetch Ad Detail Pages, Minimum Days Active, detail URLs) add one request per inspected ad, including ads that are filtered out afterwards. You can also pass custom residential/ISP proxyUrls ({\"useApifyProxy\": false, \"proxyUrls\": [\"http://user:pass@host:port\"]}) or run locally via CLI without a proxy.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}