{
  "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, CTAs, advertiser & paying entity, run dates, total impressions, impressions by country and full targeting. Search by keyword, company or payer. Monitoring mode returns only new ads. Export JSON, CSV, Excel.",
    "version": "1.0",
    "x-build-id": "vLiriqWMHCQS9kO0c"
  },
  "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 keyword (matches advertiser names and ad copy), e.g. <code>marketing automation</code>, <code>cybersecurity</code>. Each keyword is one search.",
            "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 Ad Library URLs. Numeric <code>/company/&lt;id&gt;</code> URLs and <code>?companyIds=</code> links are resolved automatically; vanity slugs fall back to a keyword search.",
            "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.",
            "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 (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Only include ads shown on or before this date (YYYY-MM-DD)."
          },
          "enrichAdDetails": {
            "title": "Enrich ad details",
            "type": "boolean",
            "description": "Open each ad's detail page to capture the full record: advertiser company ID, paying entity, exact run dates, total impressions, impressions by country, complete targeting (language, locations, audience, company, job & interest facets), CTA and destination URL, and image/video creatives. Adds one fast request per ad. Turn off for a cheaper, cards-only run.",
            "default": true
          },
          "maxAds": {
            "title": "Max ads",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of ads to scrape across all searches. Set 0 for no limit.",
            "default": 100
          },
          "maxAdsPerQuery": {
            "title": "Max ads per search",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of ads taken from each individual keyword / company / payer search (0 = no per-search limit).",
            "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. The LinkedIn Ad Library is public, so Apify Proxy (the default) works well; switch to residential for very large jobs.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}