{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ads Library Scraper - Ad Creatives & Advertisers",
    "description": "Search the LinkedIn Ads Library by advertiser, payer or keyword and export every ad as a row: ad copy, headline, ad format, images, advertiser logo and a link to the ad. Filter by country, date and impressions. For B2B marketers and competitor research.",
    "version": "0.2",
    "x-build-id": "PDp574BnTGDbrTU5Q"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/s-r~linkedin-ads-library/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-s-r-linkedin-ads-library",
        "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/s-r~linkedin-ads-library/runs": {
      "post": {
        "operationId": "runs-sync-s-r-linkedin-ads-library",
        "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/s-r~linkedin-ads-library/run-sync": {
      "post": {
        "operationId": "run-sync-s-r-linkedin-ads-library",
        "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",
        "required": [
          "search"
        ],
        "properties": {
          "search": {
            "title": "Company / advertiser",
            "type": "string",
            "description": "Company or advertiser name to search (e.g. \"hubspot\", \"salesforce\"). Required."
          },
          "max_ads": {
            "title": "Max ads",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many ads to collect. LinkedIn serves 24 per page, so higher values walk more pages and take longer. Large advertisers have thousands of ads.",
            "default": 96
          },
          "payer": {
            "title": "Payer name",
            "type": "string",
            "description": "The party billed for the ads, which is often a media agency rather than the brand itself. It goes into the Ad Library's own payer search box and travels with the request, so LinkedIn narrows the result before anything is paged. It works alongside the company search rather than replacing it: both boxes are sent and both must match."
          },
          "keyword": {
            "title": "Keyword in ad copy",
            "type": "string",
            "description": "Only keep ads whose copy contains this word or phrase. It is sent to LinkedIn's own keyword box next to the company search, so the platform drops the non-matching ads before the pages are walked and a narrow keyword makes the run shorter, not longer."
          },
          "country": {
            "title": "Country",
            "pattern": "^([a-zA-Z]{2})?$",
            "type": "string",
            "description": "ISO 2-letter code, sent to LinkedIn as its countries filter, so it narrows which ads come back and is copied onto every row. It does not pick the proxy exit. The exit country is chosen separately from the Actor's own rotating list and is re-drawn whenever LinkedIn refuses an address, so asking for NL ads does not mean the request leaves from a Dutch IP. Leave blank for all countries."
          },
          "date_range": {
            "title": "Date range",
            "enum": [
              "",
              "last-30-days",
              "current-month",
              "current-year",
              "last-year"
            ],
            "type": "string",
            "description": "Limit results by recency. LinkedIn publishes no running-versus-stopped filter, so this window is the only way to separate current advertising from an advertiser's back catalogue.",
            "default": ""
          },
          "sort": {
            "title": "Sort order",
            "enum": [
              "NEWEST",
              "OLDEST"
            ],
            "type": "string",
            "description": "Order results by recency.",
            "default": "NEWEST"
          },
          "only_total": {
            "title": "Count only",
            "type": "boolean",
            "description": "Return one row with how many ads match and no ads at all. Costs one page fetch and no per-ad charge. LinkedIn serves 24 ads per page, so counting a large advertiser by paging costs hundreds of requests for one number.",
            "default": false
          },
          "impressions_min": {
            "title": "Minimum impressions",
            "minimum": 0,
            "type": "integer",
            "description": "Lower bound on an ad's impression count, multiplied by the unit below, so 10 plus thousand means 10,000. Value and unit are sent together to LinkedIn's own impressions-range filter and the platform does the filtering; sending one without the other makes LinkedIn drop the filter silently instead of erroring, which is why the unit always goes with it."
          },
          "impressions_min_unit": {
            "title": "Minimum impressions unit",
            "enum": [
              "thousand",
              "million"
            ],
            "type": "string",
            "description": "Unit for the minimum impressions value.",
            "default": "thousand"
          },
          "impressions_max": {
            "title": "Maximum impressions",
            "minimum": 0,
            "type": "integer",
            "description": "Upper bound on an ad's impression count, multiplied by the unit below in the same way as the minimum. It is part of the same LinkedIn-side range filter, so it narrows the search rather than trimming rows afterwards. Leave both bounds empty and no impression filter is sent at all."
          },
          "impressions_max_unit": {
            "title": "Maximum impressions unit",
            "enum": [
              "thousand",
              "million"
            ],
            "type": "string",
            "description": "Unit for the maximum impressions value.",
            "default": "thousand"
          },
          "targeting_included": {
            "title": "Targeting used",
            "type": "array",
            "description": "Only return ads that targeted on these parameters. Useful for finding who runs tightly targeted campaigns.",
            "items": {
              "type": "string",
              "enum": [
                "LANGUAGE",
                "LOCATION",
                "AUDIENCE",
                "DEMOGRAPHIC",
                "COMPANY",
                "EDUCATION",
                "JOB_EXPERIENCE",
                "INTEREST"
              ]
            },
            "default": []
          },
          "targeting_excluded": {
            "title": "Targeting not used",
            "type": "array",
            "description": "Only return ads that did NOT target on these parameters.",
            "items": {
              "type": "string",
              "enum": [
                "LANGUAGE",
                "LOCATION",
                "AUDIENCE",
                "DEMOGRAPHIC",
                "COMPANY",
                "EDUCATION",
                "JOB_EXPERIENCE",
                "INTEREST"
              ]
            },
            "default": []
          },
          "proxy_url": {
            "title": "Your own proxy (optional)",
            "type": "string",
            "description": "Optional residential HTTP or HTTPS proxy URL with a DNS hostname. Used exactly as given for this run; no country is added. Leave blank to use the configured pool."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}