{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper",
    "description": "Scrape the LinkedIn Ad Library without login: ad copy, creatives, payer, run dates, EU impressions and targeting as structured JSON. Search by advertiser, keyword, country or date. Pure HTTP, fast and cheap.",
    "version": "0.1",
    "x-build-id": "lXPLE3czZR7fs3zN8"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alexmorain~linkedin-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alexmorain-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/alexmorain~linkedin-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-alexmorain-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/alexmorain~linkedin-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-alexmorain-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 or LinkedIn company slugs, one per line: <code>nvidia</code>, <code>doctolib</code>. Each one becomes its own search, and the results carry the advertiser name so you can tell them apart.<br><br><b>How to be sure of a name:</b> open the company LinkedIn page, the slug is the last part of the URL (<code>linkedin.com/company/<b>nvidia</b></code>). Some groups advertise under a legal entity rather than their brand; if a search comes back empty, that is usually why.<br><br>Leave empty if you are searching by keyword across the whole library instead.",
            "items": {
              "type": "string"
            }
          },
          "keyword": {
            "title": "Keyword",
            "type": "string",
            "description": "A word or phrase to search for in the ads themselves.<br><br>Used <b>alone</b>, it sweeps the entire Ad Library and finds every advertiser running that message: the way to discover competitors you had not listed. Used <b>together with advertisers</b>, it narrows each advertiser's ads to those mentioning it.<br><br>Leave empty to get all the ads of the advertisers above."
          },
          "searchUrls": {
            "title": "Search URLs",
            "type": "array",
            "description": "Full Ad Library search URLs, copied straight from your browser: <code>https://www.linkedin.com/ad-library/search?...</code><br><br>The escape hatch: build any filter combination by hand on the LinkedIn site, paste the resulting URL here, and the Actor reproduces it exactly. Useful for filters this input does not expose.<br><br>One caveat, and it is the reason most competing tools return wrong data: LinkedIn <b>silently ignores</b> a start and end date in a URL unless <code>dateOption=custom-date-range</code> is present too. A URL without it returns the whole corpus while looking filtered. Prefer the date fields below, which always send the complete parameter set.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "ISO 3166-1 alpha-2 codes of the countries where the ads were shown: <code>US</code>, <code>FR</code>, <code>DE</code>.<br><br>Leave empty for worldwide, which is the honest default when you do not know where a company advertises. Note that impressions and targeting data only exist for ads served in the <b>EU</b>, so an EU country here is what makes the richest fields appear.",
            "items": {
              "type": "string"
            }
          },
          "dateOption": {
            "title": "Date range",
            "enum": [
              "all-time",
              "last-30-days",
              "current-month",
              "current-year",
              "last-year"
            ],
            "type": "string",
            "description": "The period during which the ads ran. <b>The library only holds roughly the last 12 months</b>, whatever you ask for, so \"All time\" means \"the last twelve months\".<br><br>Ignored when you fill the two custom date fields below.",
            "default": "all-time"
          },
          "startDate": {
            "title": "Custom start date",
            "type": "string",
            "description": "<code>YYYY-MM-DD</code>, within the last 12 months. Fill it together with the end date; either both or neither. It overrides the dropdown above.<br><br>The Actor always sends the extra parameter LinkedIn requires for a custom range to actually apply, so the filter you set is the filter you get."
          },
          "endDate": {
            "title": "Custom end date",
            "type": "string",
            "description": "<code>YYYY-MM-DD</code>. Goes together with the custom start date."
          },
          "payer": {
            "title": "Payer name",
            "type": "string",
            "description": "Filter on the entity that paid for the ad, the \"Paid for by\" line: often a legal entity or an agency rather than the brand.<br><br>Useful to map a group whose subsidiaries advertise separately, or to find every brand handled by one agency. Leave empty in normal use."
          },
          "includeDetails": {
            "title": "Include ad details",
            "type": "boolean",
            "description": "Opens the detail page of every ad, which adds the <b>full ad copy</b>, the payer, the exact run dates and, for ads served in the EU, the <b>impressions</b> (total and per country) and the <b>targeting criteria</b> the advertiser selected.<br><br>Off by default because it costs one extra request per ad and is billed at a higher per-ad rate. The efficient pattern: sweep wide with it off to see who advertises and how much, then re-run with it on for the handful of advertisers you actually analyse.<br><br>Without it you still get advertiser, format, headline, creatives and a copy preview.",
            "default": false
          },
          "maxAdsPerQuery": {
            "title": "Max ads per query",
            "minimum": 0,
            "type": "integer",
            "description": "Stops each search after this many ads. The cap applies per search, so three advertisers with a cap of 100 can return up to 300 ads.<br><br><b>Keep a cap on your first run.</b> A single large advertiser can be running several hundred ads, and you pay per ad returned. 100 is enough to see the shape of a competitor's advertising; raise it once you know what you are getting.<br><br>Set <code>0</code>, or leave the field empty, for no limit at all."
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Leave as is. Datacenter proxies are the default and are enough for the Ad Library; the Actor rotates sessions by itself when LinkedIn rate-limits. Switch to residential only if a large run keeps getting blocked.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}