{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper - Ads, Impressions & Targeting",
    "description": "Scrape every ad a company runs on LinkedIn from the public LinkedIn Ad Library. Get ad copy, headlines, images, videos, carousels, CTAs, landing pages, who paid, run dates, impressions by country and targeting. Search by advertiser, keyword or country. No login or cookies.",
    "version": "0.1",
    "x-build-id": "0wnuoCnXcYCBdzXoD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jmlp~linkedin-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jmlp-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/jmlp~linkedin-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-jmlp-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/jmlp~linkedin-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-jmlp-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": {
          "advertisers": {
            "title": "Advertisers",
            "type": "array",
            "description": "Company names as LinkedIn shows them, or their LinkedIn company page links (linkedin.com/company/hubspot). One search per advertiser. LinkedIn matches names loosely: 'HubSpot' also finds 'HubSpot Platinum Partner' and agencies with HubSpot in their name - turn on 'Exact advertiser match' to keep only the company itself.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Words in the ad. With advertisers given too, each advertiser is searched for each keyword.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Ad Library links",
            "type": "array",
            "description": "Paste LinkedIn Ad Library links straight from your browser: a search (linkedin.com/ad-library/search?...), which keeps its own filters, or a single ad (linkedin.com/ad-library/detail/...).",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "Where the ads were shown: ISO codes or names (GB, Germany, United States), or a group such as EU or DACH. Empty means every country. Impressions and targeting are published only for ads shown in the EU.",
            "items": {
              "type": "string"
            }
          },
          "dateRange": {
            "title": "Date range",
            "type": "string",
            "description": "When the ads ran. 'Custom' uses the start and end dates below.",
            "default": "all-time"
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "For a custom range: YYYY-MM-DD, or relative such as '90 days'."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "For a custom range: YYYY-MM-DD, or 'today'."
          },
          "sortBy": {
            "title": "Sort by",
            "type": "string",
            "description": "Newest first is LinkedIn's default.",
            "default": "newest"
          },
          "maxAds": {
            "title": "Max ads",
            "type": "integer",
            "description": "Stop after this many unique ads across every search. Caps both runtime and cost. Empty means every ad found."
          },
          "maxAdsPerSearch": {
            "title": "Max ads per search",
            "type": "integer",
            "description": "Cap each advertiser or keyword separately, so one big advertiser does not use up 'Max ads' alone."
          },
          "scrapeAdDetails": {
            "title": "Scrape ad details",
            "type": "boolean",
            "description": "Open each ad's detail page for who paid, the run dates, impressions by country and targeting (published for ads shown in the EU), the call to action, landing URLs and video files. One extra request per ad. Off: only what the search results show.",
            "default": true
          },
          "exactAdvertiserMatch": {
            "title": "Exact advertiser match",
            "type": "boolean",
            "description": "Keep only ads whose advertiser name is exactly the one searched (ignoring case and punctuation), not partners or agencies whose names contain it.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Searches at once",
            "type": "integer",
            "description": "How many advertisers or keywords to search in parallel, 1 to 10. Each uses its own exit IPs. Without a proxy everything runs one request at a time.",
            "default": 3
          },
          "detailConcurrency": {
            "title": "Detail pages at once (per search)",
            "type": "integer",
            "description": "How many ad detail pages each search reads in parallel, each on its own exit IP, 1 to 10. LinkedIn allows one IP about one request every two seconds.",
            "default": 4
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Recommended. LinkedIn limits each IP to about one request every two seconds; Apify Proxy spreads the requests over many IPs, so the run is several times faster.",
            "default": {
              "useApifyProxy": true
            }
          },
          "proxyRotations": {
            "title": "Proxy rotation attempts",
            "type": "integer",
            "description": "How many times a refused search moves to new exit IPs before it is kept for a second pass.",
            "default": 4
          },
          "resume": {
            "title": "Checkpoint progress",
            "type": "boolean",
            "description": "Save progress every ~30s so a run that gets migrated or restarted by the platform picks up where it stopped, without repeating ads.",
            "default": true
          },
          "continueFromLastRun": {
            "title": "Continue from last run",
            "type": "boolean",
            "description": "If your previous run with the same input was interrupted, scrape only what it missed. Ads already collected stay in THAT run's dataset.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}