{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper - Competitor B2B Ads & Creatives",
    "description": "Scrape the LinkedIn Ad Library with no login: competitor ads, creatives, headlines, ad copy and advertisers by keyword, advertiser name, company or payer. Detail mode adds paying entity, CTA, landing page, plus run dates, impressions and targeting for EU ads. Monitoring mode returns only new ads.",
    "version": "1.0",
    "x-build-id": "mxnXM9xdilI60OGaJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~linkedin-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-linkedin-ad-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/scrapesage~linkedin-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-linkedin-ad-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/scrapesage~linkedin-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-linkedin-ad-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": {
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Search the LinkedIn Ad Library by a word or phrase in the ads, e.g. <code>marketing automation</code>, <code>cybersecurity</code>. Each keyword is one search. To get one company's own ads, use <b>Advertiser names</b> or <b>Company IDs</b> instead - a keyword also matches every ad that merely mentions it.",
            "items": {
              "type": "string"
            }
          },
          "advertiserNames": {
            "title": "Advertiser names",
            "type": "array",
            "description": "Search by the advertiser's name, exactly like the Ad Library's \"company/advertiser name\" box, e.g. <code>HubSpot</code>, <code>Salesforce</code>. Returns that advertiser's own ads (and those of advertisers whose name contains it), not every ad that mentions it.",
            "items": {
              "type": "string"
            }
          },
          "companyIds": {
            "title": "Company IDs",
            "type": "array",
            "description": "Numeric LinkedIn company IDs to pull every ad an advertiser is running, e.g. <code>68529</code> (HubSpot). Find the ID in a company's LinkedIn URL or paste the URL under <b>Company URLs</b> below.",
            "items": {
              "type": "string"
            }
          },
          "companyUrls": {
            "title": "Company URLs",
            "type": "array",
            "description": "LinkedIn company URLs (<code>https://www.linkedin.com/company/68529</code> or <code>https://www.linkedin.com/company/hubspot</code>) or Ad Library URLs. Numeric <code>/company/&lt;id&gt;</code> URLs and <code>?companyIds=</code> links search that company exactly; name URLs like <code>/company/hubspot</code> search by advertiser name.",
            "items": {
              "type": "string"
            }
          },
          "payers": {
            "title": "Payer names",
            "type": "array",
            "description": "Search by the entity that paid for the ads (the \"Paid for by\" name), e.g. <code>HubSpot, Inc.</code>. Useful when an advertiser pays under a different legal entity.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Paste LinkedIn Ad Library URLs directly: search pages (<code>/ad-library/search?...</code>) or individual ad pages (<code>/ad-library/detail/&lt;id&gt;</code>). Used in addition to the inputs above. An individual ad page is always read in full, so it is billed as <code>Ad Scraped</code> + <code>Ad Details Enriched</code>.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "Optional ISO country codes to restrict results to ads shown in those countries, e.g. <code>US</code>, <code>GB</code>, <code>DE</code>. Leave empty for all countries.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "Only include ads shown on or after this date: a date (YYYY-MM-DD) or a period such as \"3 months\" or \"30 days\", counted back from the day of the run, so a saved task or schedule always covers the latest period. LinkedIn's Ad Library keeps the last 12 months of ads, so an earlier date is moved to the start of that window."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Only include ads shown on or before this date: a date (YYYY-MM-DD) or a period such as \"7 days\" (that many days before the run). Either date can be used on its own."
          },
          "enrichAdDetails": {
            "title": "Enrich ad details",
            "type": "boolean",
            "description": "Open each ad's detail page to capture the full record: paying entity, advertiser company ID, the complete ad copy (search cards show only the first ~120 characters), CTA button, destination URL, image/video/document creatives, and - where LinkedIn publishes them, mainly for EU-served ads - run dates, total impressions, impressions by country and targeting (language, location, audience, company, job and interest facets). <b>Off by default</b> - it opens one extra page per ad and bills the <code>Ad Details Enriched</code> event on top of <code>Ad Scraped</code>. Leave it off for a fast, cards-only run; turn it on when you need the full record.",
            "default": false
          },
          "maxAds": {
            "title": "Max ads",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of ads to scrape across all searches. One run takes up to 1000 ads (a larger number runs as 1000) - split a larger job across several runs.",
            "default": 100
          },
          "maxAdsPerQuery": {
            "title": "Max ads per search",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of ads taken from each individual keyword / advertiser / company / payer search (0 = no per-search limit, still bounded by Max ads; up to 1000).",
            "default": 0
          },
          "monitorMode": {
            "title": "Monitoring mode (only new ads)",
            "type": "boolean",
            "description": "Remember which ads were already returned in previous runs and output only newly-discovered ads each time. Pair it with Apify <b>Schedules</b> to track competitors' new ads automatically - it does not interfere with the scheduler. The first run returns everything as a baseline; later runs return only what's new.",
            "default": false
          },
          "monitorStateName": {
            "title": "Monitoring store name",
            "type": "string",
            "description": "Named key-value store that holds the \"already seen\" ad IDs for monitoring mode. Use a different name per project so separate monitors don't share state.",
            "default": "linkedin-ad-library-monitor"
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Maximum number of pages fetched in parallel.",
            "default": 8
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings for the last-resort fallback request. The Actor handles LinkedIn's bot protection itself, so you normally do not need to change this.",
            "default": {
              "useApifyProxy": true
            }
          },
          "urlsFromFile": {
            "title": "Import URLs from a file",
            "type": "string",
            "description": "Paste a list of URLs (one per line), OR one link to a .txt/.csv file, Google Sheet or Google Drive file containing them. Lets you import many Start URLs at once instead of typing each. Google Sheet/Drive share links are handled automatically."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}