{
  "openapi": "3.0.1",
  "info": {
    "title": "Ad Library Intelligence (Google, LinkedIn, TikTok)",
    "description": "Monitor competitors' ads across the Google Ads Transparency Center, LinkedIn Ad Library and TikTok Creative Center. Normalized ad records plus change events: new ads, ended ads, creative refreshes, new regions and new landing domains.",
    "version": "0.1",
    "x-build-id": "YnaaEqu5btsIzxlyZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/almoutasem_nabil~ad-library-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-almoutasem_nabil-ad-library-intelligence",
        "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/almoutasem_nabil~ad-library-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-almoutasem_nabil-ad-library-intelligence",
        "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/almoutasem_nabil~ad-library-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-almoutasem_nabil-ad-library-intelligence",
        "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": "Advertisers",
            "type": "array",
            "description": "Advertisers to check on Google and LinkedIn: { name, domain, googleAdvertiserId (AR…), linkedinCompanyId or linkedinUrl }. Name alone works; add the domain or ids to avoid ambiguity (the run summary lists candidates when a name is ambiguous)."
          },
          "platforms": {
            "title": "Platforms",
            "type": "array",
            "description": "Which libraries to read. TikTok is query-based (see tiktokQueries) and uses a headless browser. LinkedIn's Ad Library sits behind Cloudflare and rejects Apify datacenter IPs, so add \"linkedin\" together with residential proxies in \"proxyConfiguration\"; \"tiktok\" needs at least one entry in \"tiktokQueries\".",
            "items": {
              "type": "string",
              "enum": [
                "google",
                "linkedin",
                "tiktok"
              ],
              "enumTitles": [
                "Google Ads Transparency Center",
                "LinkedIn Ad Library",
                "TikTok Creative Center (Top Ads)"
              ]
            },
            "default": [
              "google",
              "linkedin"
            ]
          },
          "googleRegion": {
            "title": "Google region",
            "type": "string",
            "description": "Region filter for the Google Ads Transparency Center: 'anywhere' or an ISO-2 country code (US, AE, SA, GB...).",
            "default": "anywhere"
          },
          "linkedinCountries": {
            "title": "LinkedIn countries",
            "type": "array",
            "description": "ISO-2 codes. When set, the per-country impression breakdown is limited to these countries.",
            "items": {
              "type": "string"
            }
          },
          "tiktokQueries": {
            "title": "TikTok queries",
            "type": "array",
            "description": "TikTok has no per-advertiser search, so each entry is a Top Ads query: { keyword, industry, region (ISO-2, default SA), objective, period (7|30|180, default 30), adFormat }. Without login TikTok shows the top 20 ads per query."
          },
          "activeOnly": {
            "title": "Active ads only",
            "type": "boolean",
            "description": "Keep only ads that are currently running (Google: shown within the last 7 days; LinkedIn: no end date yet or ended today).",
            "default": true
          },
          "lastNDays": {
            "title": "Last N days",
            "minimum": 0,
            "type": "integer",
            "description": "Ignore ads whose last-shown date is older than this many days. 0 = no limit.",
            "default": 90
          },
          "maxAdsPerAdvertiser": {
            "title": "Max ads per advertiser",
            "minimum": 0,
            "type": "integer",
            "description": "Cap per advertiser and platform. 0 = unlimited. Google needs one extra paced request per new ad to resolve its regions, so a first snapshot of many advertisers takes minutes; the Console form suggests 20.",
            "default": 200
          },
          "emitChangesOnly": {
            "title": "Emit changes only",
            "type": "boolean",
            "description": "Output only change events (new_ad, ad_ended, creative_refresh, new_landing_domain, new_region, advertiser_error) compared with the previous run under the same trackingId.",
            "default": false
          },
          "emitBaselineAsNew": {
            "title": "Emit baseline as new",
            "type": "boolean",
            "description": "On the first run for a trackingId, emit every ad as new_ad instead of a silent baseline.",
            "default": false
          },
          "trackingId": {
            "title": "Tracking ID",
            "type": "string",
            "description": "Name of the watch list. State is kept in the 'ad-intel-state' key-value store under this key. Required with 'Emit changes only'."
          },
          "refreshThreshold": {
            "title": "Creative refresh threshold",
            "minimum": 1,
            "type": "integer",
            "description": "New ads from one advertiser on one platform in a single run that count as a creative_refresh event.",
            "default": 5
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Advertiser x platform sources checked in parallel (TikTok queries always run one at a time).",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify datacenter proxies work for Google and TikTok. LinkedIn blocks most datacenter ranges with HTTP 403: switch to residential proxies (RESIDENTIAL group) if LinkedIn sources fail.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}