{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper - Ads, Creatives & Targeting",
    "description": "Scrape LinkedIn Ad Library ads by advertiser, keyword or payer. Get creative copy, images, CTA, destination, payer, run dates, impressions by country and targeting as JSON.",
    "version": "0.1",
    "x-build-id": "tgDvJxQvYMO6Uao82"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/spectre_scrape~linkedin-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-spectre_scrape-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/spectre_scrape~linkedin-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-spectre_scrape-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/spectre_scrape~linkedin-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-spectre_scrape-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": {
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Optional. Paste LinkedIn Ad Library search URLs (https://www.linkedin.com/ad-library/search?accountOwner=microsoft&countries=US) or ad detail URLs (https://www.linkedin.com/ad-library/detail/1702623866). Search URLs keep every filter LinkedIn supports and override the fields below. Detail URLs return one ad each.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "company": {
            "title": "Company / advertiser",
            "type": "string",
            "description": "Advertiser name as it appears in the Ad Library, for example Microsoft, Nike or HubSpot. Matches the accountOwner search box."
          },
          "keyword": {
            "title": "Keyword",
            "type": "string",
            "description": "Word or phrase to find in ad copy, for example AI, sustainability or Black Friday."
          },
          "payer": {
            "title": "Payer",
            "type": "string",
            "description": "Payer name shown in the Ad Library, for example Starcom or a media agency. Payer is the entity that paid for the ad."
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "ISO 3166-1 alpha-2 country codes to search, for example US, GB, DE, FR, BR. Use EU countries or Brazil to get the extra EU fields: run dates, impressions and targeting.",
            "items": {
              "type": "string"
            },
            "default": [
              "US"
            ]
          },
          "dateOption": {
            "title": "Date range",
            "enum": [
              "ALL",
              "last-30-days",
              "current-month",
              "current-year",
              "last-year",
              "custom-date-range"
            ],
            "type": "string",
            "description": "How far back to search. Choose Custom date range to use the two date fields below.",
            "default": "ALL"
          },
          "startDate": {
            "title": "Custom start date",
            "type": "string",
            "description": "First day of the custom range in YYYY-MM-DD format. Only used when Date range is Custom date range."
          },
          "endDate": {
            "title": "Custom end date",
            "type": "string",
            "description": "Last day of the custom range in YYYY-MM-DD format. Only used when Date range is Custom date range."
          },
          "impressionsMin": {
            "title": "Minimum impressions",
            "minimum": 0,
            "type": "integer",
            "description": "Only return ads with at least this many impressions. Combine with the unit below. Leave empty for no minimum."
          },
          "impressionsMinUnit": {
            "title": "Minimum impressions unit",
            "enum": [
              "thousand",
              "million"
            ],
            "type": "string",
            "description": "Unit for the minimum impressions value.",
            "default": "thousand"
          },
          "impressionsMax": {
            "title": "Maximum impressions",
            "minimum": 0,
            "type": "integer",
            "description": "Only return ads with at most this many impressions. Combine with the unit below. Leave empty for no maximum."
          },
          "impressionsMaxUnit": {
            "title": "Maximum impressions unit",
            "enum": [
              "thousand",
              "million"
            ],
            "type": "string",
            "description": "Unit for the maximum impressions value.",
            "default": "thousand"
          },
          "includedTargeting": {
            "title": "Targeting included",
            "type": "array",
            "description": "Only return ads that target these parameter categories. Leave empty for any. This filter is available for ads in the EU and Brazil.",
            "items": {
              "type": "string",
              "enum": [
                "LANGUAGE",
                "LOCATION",
                "AUDIENCE",
                "DEMOGRAPHIC",
                "COMPANY",
                "EDUCATION",
                "JOB",
                "INTERESTS_AND_TRAITS"
              ],
              "enumTitles": [
                "Language",
                "Location",
                "Audience",
                "Demographic",
                "Company",
                "Education",
                "Job",
                "Member interests and traits"
              ]
            }
          },
          "excludedTargeting": {
            "title": "Targeting excluded",
            "type": "array",
            "description": "Only return ads that exclude these parameter categories. Leave empty for any. This filter is available for ads in the EU and Brazil.",
            "items": {
              "type": "string",
              "enum": [
                "LANGUAGE",
                "LOCATION",
                "AUDIENCE",
                "DEMOGRAPHIC",
                "COMPANY",
                "EDUCATION",
                "JOB",
                "INTERESTS_AND_TRAITS"
              ],
              "enumTitles": [
                "Language",
                "Location",
                "Audience",
                "Demographic",
                "Company",
                "Education",
                "Job",
                "Member interests and traits"
              ]
            }
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "DESCENDING",
              "ASCENDING"
            ],
            "type": "string",
            "description": "Order of the search results.",
            "default": "DESCENDING"
          },
          "maxItems": {
            "title": "Maximum ads",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum ads to save across the run. 0 means no limit (up to 5,000).",
            "default": 100
          },
          "maxPages": {
            "title": "Pages per search",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Search result pages to load for each search target. LinkedIn shows about 24 ads per page.",
            "default": 5
          },
          "includeDetails": {
            "title": "Fetch ad details",
            "type": "boolean",
            "description": "Open each ad to add the payer, run dates, impressions, impressions by country, targeting, CTA and destination URL. Adds one request per ad. Run dates, impressions and targeting are only shown for ads in the EU and Brazil.",
            "default": true
          },
          "concurrency": {
            "title": "Parallel detail requests",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many detail requests to run at once. Higher is faster and lowers compute cost; the minimum delay below still applies to every request.",
            "default": 3
          },
          "delayBetweenRequestsMs": {
            "title": "Minimum delay between requests",
            "minimum": 0,
            "maximum": 60000,
            "type": "integer",
            "description": "Global pause between any two requests. 2,000 ms is the recommended minimum; lowering it can cause HTTP 999 or challenge pages.",
            "default": 2000
          },
          "retriesPerRequest": {
            "title": "Retries per request",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Attempts per page before giving up. Each retry uses a new proxy IP.",
            "default": 4
          },
          "requestTimeoutSecs": {
            "title": "Request timeout",
            "minimum": 10,
            "maximum": 180,
            "type": "integer",
            "description": "How long to wait for a single page before retrying.",
            "default": 60
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "The Ad Library is public and works without a login. Apify proxy is used when your account can access it; otherwise the actor runs without a proxy. If you see HTTP 999 or verification pages, set a proxy group your account can access (for example RESIDENTIAL) or disable the proxy.",
            "default": {
              "useApifyProxy": true
            }
          },
          "feedback": {
            "title": "Feedback",
            "type": "string",
            "description": "Optional: tell the maintainer what you needed or what was missing."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}