{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ads Scraper (Ad Library)",
    "description": "Scrape LinkedIn Ad Library ads by advertiser, payer, keyword or pasted Ad Library URL. Extract ad copy, creatives, landing-page click URL, CTA, video, numeric impression ranges and targeting, with no login or cookies.",
    "version": "0.2",
    "x-build-id": "E0iftrtp81ehLF4WN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~linkedin-ads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-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/khadinakbar~linkedin-ads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-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/khadinakbar~linkedin-ads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-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": {
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Advertiser names, payer names, or ad-copy keywords to search in LinkedIn's public Ad Library. Use focused terms such as competitor names, product categories, or B2B phrases.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "LinkedIn Ad Library URLs (optional)",
            "type": "array",
            "description": "Paste LinkedIn Ad Library URLs instead of, or in addition to, search terms. Search URLs such as https://www.linkedin.com/ad-library/search?accountOwner=monday&countries=US&dateOption=last-30-days keep their advertiser, payer or keyword, countries and date filters. Detail URLs such as https://www.linkedin.com/ad-library/detail/123456789 return that single ad with full detail. Other URLs are skipped with a warning.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Query",
            "type": "string",
            "description": "Optional single search query alias for API and MCP callers. Ignored when search terms are provided."
          },
          "keyword": {
            "title": "Keyword",
            "type": "string",
            "description": "Optional single keyword alias for API callers. Ignored when search terms or query are provided."
          },
          "searchMode": {
            "title": "Search mode",
            "enum": [
              "accountOwner",
              "payer",
              "keyword"
            ],
            "type": "string",
            "description": "Where LinkedIn should match the search term. Advertiser searches company or advertiser name. Payer searches the entity paying for the ad. Keyword searches ad text and related copy.",
            "default": "accountOwner"
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "ISO 3166-1 alpha-2 country codes where ads were served, e.g. US, GB, DE, FR. Use ALL to search all countries. Multiple countries are combined in one LinkedIn search.",
            "default": [
              "US"
            ],
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Optional single ISO country code alias for API and MCP callers. Ignored when countries are provided."
          },
          "dateOption": {
            "title": "Date range",
            "enum": [
              "last-30-days",
              "current-month",
              "current-year",
              "last-year"
            ],
            "type": "string",
            "description": "LinkedIn date filter. Ignored when custom start or end dates are provided.",
            "default": "last-year"
          },
          "startDate": {
            "title": "Custom start date",
            "type": "string",
            "description": "Optional custom start date in YYYY-MM-DD format. When set, the actor uses LinkedIn's custom date range filter."
          },
          "endDate": {
            "title": "Custom end date",
            "type": "string",
            "description": "Optional custom end date in YYYY-MM-DD format. Use with custom start date to narrow campaign windows."
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "DESCENDING",
              "ASCENDING"
            ],
            "type": "string",
            "description": "LinkedIn result ordering. Newest first is best for monitoring new competitor ads; oldest first is useful for historical review.",
            "default": "DESCENDING"
          },
          "maxResults": {
            "title": "Maximum ads",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Hard cap on saved and billable ad records across all searches. Each saved ad is one ad-found event; detail enrichment adds one detail-enriched event per enriched ad.",
            "default": 100
          },
          "maxPagesPerSearch": {
            "title": "Maximum pages per search",
            "minimum": 1,
            "maximum": 250,
            "type": "integer",
            "description": "LinkedIn returns about 24 ads per page. This safety cap limits pagination per search term. Raise it for large campaigns or broad keywords.",
            "default": 20
          },
          "startPaginationToken": {
            "title": "Start pagination token",
            "type": "string",
            "description": "Optional token from a previous run summary. Use it to resume a single search from a later LinkedIn page."
          },
          "fetchAdDetails": {
            "title": "Fetch ad detail pages",
            "type": "boolean",
            "description": "Fetch each LinkedIn detail page to enrich records with detail-page fields such as ad format, payer name, advertiser profile URL, and fuller copy when available. Slower and charged as an extra detail event per fetched ad.",
            "default": false
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "full",
              "compact"
            ],
            "type": "string",
            "description": "Full mode keeps all fields. Compact mode keeps the most useful fields for tables, automations, and AI agents.",
            "default": "full"
          },
          "delayMs": {
            "title": "Delay between pages (ms)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Polite delay between LinkedIn pagination requests. Increase for very large runs if LinkedIn responds slowly.",
            "default": 350
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}