{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper: Ads, Impressions & Targeting",
    "description": "Get any company's LinkedIn ads from the Ad Library: ad copy, images, videos, carousels, documents, call to action and landing page, who paid, run dates, impressions by country and targeting. Search by company, keyword or payer; schedule it to get only new ads.",
    "version": "0.1",
    "x-build-id": "fL0W2NGthm4ZVngMp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automatic~linkedin-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automatic-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/automatic~linkedin-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-automatic-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/automatic~linkedin-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-automatic-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": "Companies or advertisers",
            "type": "array",
            "description": "Company or advertiser names, one search each (up to 30 searches per run), for example HubSpot or Salesforce. Each finds the ads LinkedIn lists for advertisers with that name. A name with no ads (a typo, for example) is skipped and named in the run summary so other searches can continue. The form is prefilled with a quick sample of 20 HubSpot ad cards.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Words or phrases, one search each: finds ads whose text mentions them, from any advertiser (for example \"AI agents\" or \"cybersecurity\").",
            "items": {
              "type": "string"
            }
          },
          "payers": {
            "title": "Paid for by",
            "type": "array",
            "description": "Names of the legal entity that paid for the ads, one search each (for example \"HubSpot, Inc.\"). Useful when a group runs ads from several brand pages.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "Only ads shown in these countries. Two-letter codes (US, DE, GB) or English names (Germany). Empty means all countries. Applies to the company, keyword and payer searches.",
            "items": {
              "type": "string"
            }
          },
          "dateRange": {
            "title": "Date range",
            "enum": [
              "all",
              "last-30-days",
              "current-month",
              "current-year",
              "last-year",
              "custom"
            ],
            "type": "string",
            "description": "Only ads shown in this period. The Ad Library keeps about one year of ads. Choose Custom and set the dates below for your own range (setting a date also switches to a custom range).",
            "default": "all"
          },
          "startDate": {
            "title": "From date",
            "type": "string",
            "description": "Custom range start, as YYYY-MM-DD. Leave empty for the earliest day the Ad Library offers."
          },
          "endDate": {
            "title": "To date",
            "type": "string",
            "description": "Custom range end, as YYYY-MM-DD. Leave empty for today."
          },
          "includeDetails": {
            "title": "Include ad details",
            "type": "boolean",
            "description": "Open each ad's own page and add the full ad text, call-to-action button and destination link, who paid for the ad, the dates it ran, the impressions range with each country's share, and the targeting (languages, locations, and whether audiences, companies, job titles and more were targeted or excluded). Impressions and targeting are published for ads shown in the EU and Brazil. Each ad with details adds the ad-details charge (see Pricing). The quick sample leaves this off. Pasted single-ad links always include details and incur the details charge for each ad delivered.",
            "default": true
          },
          "onlyNewAds": {
            "title": "Only new ads since the last run",
            "type": "boolean",
            "description": "For scheduled runs: skip ads this saved search already delivered, so each run returns just the ads that appeared since the last one. Skipped ads are free. The first run collects the current ads as the starting point.",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Optional name for the history kept by \"Only new ads\", for example competitor-ads. Runs with the same name share one history. Leave empty to give each set of searches its own history automatically."
          },
          "startUrls": {
            "title": "Ad Library links",
            "type": "array",
            "description": "Links copied from linkedin.com/ad-library: a search results page (it keeps all the filters set in it) or a single ad (https://www.linkedin.com/ad-library/detail/...). A company's LinkedIn page (https://www.linkedin.com/company/...) works too and finds that company's ads, with the country and date filters above. Pasted single-ad links share one result limit. Each delivered single ad adds the ad-details charge ($0.001 on the Free plan) even when Include ad details is off. Other links are skipped and named in the run summary.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Maximum ads per search",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Most ads saved for each company, keyword, payer or search link (up to 5,000). Pasted single-ad links share one limit and are processed in input order. Search results are saved newest first.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}