{
  "openapi": "3.0.1",
  "info": {
    "title": "LinkedIn Ad Library Scraper - B2B Ads Spy",
    "description": "Scrape LinkedIn Ad Library ads for competitor research, B2B ad intelligence, agency prospecting, and paid social monitoring. Search by keyword, advertiser, payer, country, date range, or direct ad URL and export structured ad copy, creative URLs, advertiser metadata, payer names, and detail links.",
    "version": "0.0",
    "x-build-id": "PebDDoyv4NsNezyec"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/elliotpadfield~linkedin-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-elliotpadfield-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/elliotpadfield~linkedin-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-elliotpadfield-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/elliotpadfield~linkedin-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-elliotpadfield-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": {
          "keywords": {
            "title": "Keywords",
            "uniqueItems": true,
            "type": "array",
            "description": "Search ad text and advertiser content by one or more words or phrases, such as competitor names, product categories, or campaign themes.",
            "items": {
              "type": "string"
            },
            "default": [
              "notion"
            ]
          },
          "queries": {
            "title": "Quick Keyword Queries",
            "uniqueItems": true,
            "type": "array",
            "description": "Alias for Keywords. Useful when triggering the Actor from API clients that use a generic queries field.",
            "items": {
              "type": "string"
            }
          },
          "companyOrAdvertiserNames": {
            "title": "Company or Advertiser Names",
            "uniqueItems": true,
            "type": "array",
            "description": "Search by advertiser or company name as shown in LinkedIn Ad Library.",
            "items": {
              "type": "string"
            }
          },
          "payerNames": {
            "title": "Payer Names",
            "uniqueItems": true,
            "type": "array",
            "description": "Search by the entity that paid for the ad. This is useful for agency, brand, and compliance research.",
            "items": {
              "type": "string"
            }
          },
          "adUrls": {
            "title": "Direct Ad URLs or IDs",
            "uniqueItems": true,
            "type": "array",
            "description": "Paste LinkedIn Ad Library detail URLs or numeric ad IDs to enrich specific ads directly.",
            "items": {
              "type": "string"
            }
          },
          "detailUrls": {
            "title": "Direct Detail URLs",
            "uniqueItems": true,
            "type": "array",
            "description": "Alias for Direct Ad URLs or IDs. Kept for integration compatibility.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "uniqueItems": true,
            "type": "array",
            "description": "LinkedIn country codes to search. Common values: US, GB, CA, AU, DE, FR, NL, ES, IT, IN, BR. Defaults to US.",
            "items": {
              "type": "string"
            },
            "default": [
              "US"
            ]
          },
          "dateFrom": {
            "title": "Start Date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Optional start date passed to LinkedIn's Ad Library date filter. Use YYYY-MM-DD."
          },
          "dateTo": {
            "title": "End Date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Optional end date passed to LinkedIn's Ad Library date filter. Use YYYY-MM-DD."
          },
          "creativeTypes": {
            "title": "Creative Types",
            "uniqueItems": true,
            "type": "array",
            "description": "Optional post-filter for LinkedIn creative type codes found in the HTML, such as SPONSORED_STATUS_UPDATE.",
            "items": {
              "type": "string"
            }
          },
          "adFormats": {
            "title": "Ad Formats",
            "uniqueItems": true,
            "type": "array",
            "description": "Optional post-filter for visible ad formats such as Single Image Ad or Video Ad.",
            "items": {
              "type": "string"
            }
          },
          "maxAds": {
            "title": "Maximum Ads",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of unique ads to save across all search sources and direct ad URLs.",
            "default": 100
          },
          "maxPages": {
            "title": "Maximum Search Pages",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum pagination pages to fetch per search source. Each page normally contains around 24 ads.",
            "default": 5
          },
          "includeDetails": {
            "title": "Include Full Ad Details",
            "type": "boolean",
            "description": "Fetch each LinkedIn Ad Library detail page to get full ad copy, advertiser URL, payer name, and additional media/link metadata. Disable for faster preview-only runs.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Maximum Concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Number of ad detail pages to fetch in parallel.",
            "default": 5
          },
          "requestDelayMs": {
            "title": "Retry Delay",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Base delay in milliseconds between retry attempts after transient failures.",
            "default": 500
          },
          "maxRetries": {
            "title": "Maximum Retries",
            "minimum": 0,
            "maximum": 8,
            "type": "integer",
            "description": "Number of retries for transient HTTP, timeout, or proxy failures.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}