{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper — Ads, Impressions & Targeting",
    "description": "Scrape the LinkedIn Ad Library by company, keyword, payer, or country. Full ad copy, headlines, CTAs, destination URLs, payer entity, run dates, total impressions, impressions by country, targeting parameters, and raw media links (images, video streams, documents). Export JSON/CSV.",
    "version": "0.0",
    "x-build-id": "kp9ZLRTRuesGP0Clv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/memo23~linkedin-ads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-memo23-linkedin-ads-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/memo23~linkedin-ads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-memo23-linkedin-ads-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/memo23~linkedin-ads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-memo23-linkedin-ads-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": {
          "companies": {
            "title": "Companies / advertisers",
            "type": "array",
            "description": "Company or advertiser names to search for (e.g. `HubSpot`, `Microsoft`). Each name runs as its own search.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Words or phrases to search ad copy for. Each keyword runs as its own search.",
            "items": {
              "type": "string"
            }
          },
          "payers": {
            "title": "Payers",
            "type": "array",
            "description": "Entities that paid for the ads (can differ from the advertiser). Each payer runs as its own search.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "Only include ads shown in these countries. Use 2-letter ISO codes (e.g. `US`, `GB`, `DE`). Leave empty for worldwide.",
            "items": {
              "type": "string"
            }
          },
          "dateOption": {
            "title": "Date range",
            "enum": [
              "all-time",
              "last-30-days",
              "current-month",
              "current-year",
              "last-year"
            ],
            "type": "string",
            "description": "Restrict results by when the ads ran. For an exact window, use the custom start/end dates below instead.",
            "default": "all-time"
          },
          "startDate": {
            "title": "Custom start date",
            "type": "string",
            "description": "Only ads that ran on or after this date (YYYY-MM-DD). Overrides the date range preset when set."
          },
          "endDate": {
            "title": "Custom end date",
            "type": "string",
            "description": "Only ads that ran on or before this date (YYYY-MM-DD). Overrides the date range preset when set."
          },
          "impressionsMinValue": {
            "title": "Min impressions",
            "type": "integer",
            "description": "Only return ads with at least this many impressions. Combined with the unit below (e.g. 100 + thousand = 100,000). LinkedIn requires both a min and a max — if you set only one side, the other is opened up automatically."
          },
          "impressionsMinUnit": {
            "title": "Min impressions unit",
            "enum": [
              "none",
              "thousand",
              "million"
            ],
            "type": "string",
            "description": "Multiplier for the minimum impressions value.",
            "default": "thousand"
          },
          "impressionsMaxValue": {
            "title": "Max impressions",
            "type": "integer",
            "description": "Only return ads with at most this many impressions, combined with the unit below."
          },
          "impressionsMaxUnit": {
            "title": "Max impressions unit",
            "enum": [
              "none",
              "thousand",
              "million"
            ],
            "type": "string",
            "description": "Multiplier for the maximum impressions value.",
            "default": "thousand"
          },
          "includedTargetingFacetCategories": {
            "title": "Targeting includes",
            "type": "array",
            "description": "Only return ads whose targeting uses these categories.",
            "items": {
              "type": "string",
              "enum": [
                "LANGUAGE",
                "LOCATION",
                "AUDIENCE",
                "DEMOGRAPHIC",
                "COMPANY",
                "EDUCATION",
                "JOB",
                "INTERESTS_AND_TRAITS"
              ],
              "enumTitles": [
                "Language",
                "Location",
                "Audience",
                "Demographic",
                "Company",
                "Education",
                "Job",
                "Interests and traits"
              ]
            }
          },
          "excludedTargetingFacetCategories": {
            "title": "Targeting excludes",
            "type": "array",
            "description": "Only return ads whose targeting does NOT use these categories. A category may appear in both lists — that is LinkedIn's \"Both\" option.",
            "items": {
              "type": "string",
              "enum": [
                "LANGUAGE",
                "LOCATION",
                "AUDIENCE",
                "DEMOGRAPHIC",
                "COMPANY",
                "EDUCATION",
                "JOB",
                "INTERESTS_AND_TRAITS"
              ],
              "enumTitles": [
                "Language",
                "Location",
                "Audience",
                "Demographic",
                "Company",
                "Education",
                "Job",
                "Interests and traits"
              ]
            }
          },
          "searches": {
            "title": "Independent searches",
            "type": "array",
            "description": "Run several unrelated searches in one go. Each entry takes its own company / payer / keyword plus optional countries, dateOption, startDate, endDate, impressions and targeting filters — anything left out falls back to the settings above. Example: [{\"company\":\"Nike\",\"countries\":[\"DE\"],\"dateOption\":\"last-30-days\"},{\"keyword\":\"AI\",\"impressionsMinValue\":100,\"impressionsMinUnit\":\"thousand\"}]"
          },
          "maxItems": {
            "title": "Maximum ads",
            "type": "integer",
            "description": "Global cap on the number of ads scraped across all searches. On the free plan this is capped at 30.",
            "default": 100
          },
          "maxItemsPerSearch": {
            "title": "Max items per search",
            "type": "integer",
            "description": "Ceiling per individual search URL or search entry. maxItems is a budget for the whole run and is spent in order, so when you batch many companies into one run set this too — otherwise one company with many ads consumes the budget and the rest are skipped without being fetched. Example: 60 companies, maxItemsPerSearch 100, maxItems 6000."
          },
          "scrapeAdDetails": {
            "title": "Scrape full ad details",
            "type": "boolean",
            "description": "Visit each ad's detail page to capture the complete record: full ad copy, headline, CTA, destination URL, payer entity, run dates, total impressions, impressions by country, targeting parameters, and raw media links. Same price per ad either way.",
            "default": true
          },
          "includeEmployerBranding": {
            "title": "Include employer-brand results",
            "type": "boolean",
            "description": "LinkedIn mixes promoted employer-brand pages into some searches. Enable to include them as items (marked `type: EMPLOYER_BRAND`).",
            "default": false
          },
          "startUrls": {
            "title": "Ad Library URLs",
            "type": "array",
            "description": "Paste LinkedIn Ad Library URLs directly: search URLs (`https://www.linkedin.com/ad-library/search?...`) or single ad detail URLs (`https://www.linkedin.com/ad-library/detail/<id>`). Runs in addition to the searches configured above.",
            "items": {
              "type": "string"
            }
          },
          "proxy": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Leave unset and the actor chooses the route itself: pages go through a scraping API that clears LinkedIn's Cloudflare, with Apify Unblocker and a residential proxy behind it. Set a value here to make your own proxy the first route; the others still back it up."
          },
          "maxConcurrency": {
            "title": "Detail-page concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many ad detail pages to load in parallel (1–20). Higher finishes faster; the default suits most runs.",
            "default": 10
          },
          "minDelay": {
            "title": "Min delay (seconds)",
            "type": "integer",
            "description": "Minimum pause between page actions.",
            "default": 1
          },
          "maxDelay": {
            "title": "Max delay (seconds)",
            "type": "integer",
            "description": "Maximum pause between page actions.",
            "default": 3
          },
          "debug": {
            "title": "Enable debug logging",
            "type": "boolean",
            "description": "Verbose logs for troubleshooting.",
            "default": false
          },
          "sessionCookie": {
            "title": "Session cookie (deprecated, ignored)",
            "type": "string",
            "description": "No longer used. The actor reads the Ad Library without a login, so any value here is ignored."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}