{
  "openapi": "3.0.1",
  "info": {
    "title": "X Ads Repository EU Transparency Scraper",
    "description": "Extract EU-served X ads by advertiser from the public DSA Ads Repository: exact flight dates, impressions, reach, frequency, targeting, excluded segments, funding and creative text, with no X login.",
    "version": "1.0",
    "x-build-id": "ILmZ6pHxWaNitnSY6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/xyrelith-data~twitter-ads-repository/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-xyrelith-data-twitter-ads-repository",
        "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/xyrelith-data~twitter-ads-repository/runs": {
      "post": {
        "operationId": "runs-sync-xyrelith-data-twitter-ads-repository",
        "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/xyrelith-data~twitter-ads-repository/run-sync": {
      "post": {
        "operationId": "run-sync-xyrelith-data-twitter-ads-repository",
        "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": [
          "mode",
          "advertisers"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "ads",
              "advertisers",
              "deliveryReport"
            ],
            "type": "string",
            "description": "`ads` collects ad rows. `advertisers` only resolves handles, @handles, profile URLs or numeric IDs. `deliveryReport` uses X's public CSV export workflow for exact flight dates, funding entity, excluded segments and enforcement fields.",
            "default": "ads"
          },
          "advertisers": {
            "title": "Advertisers",
            "type": "array",
            "description": "X handles such as `Tesla`, `@Tesla`, profile URLs such as `https://x.com/Tesla`, or numeric advertiser IDs.",
            "items": {
              "type": "string"
            }
          },
          "marketPreset": {
            "title": "Market preset",
            "enum": [
              "eu27",
              "dach",
              "nordics",
              "benelux",
              "southern",
              "central_eastern",
              "custom"
            ],
            "type": "string",
            "description": "EU market set to query. A non-empty `countries` list overrides this preset. The repository covers the EU-27 only: Switzerland, Norway and the UK are not EU markets.",
            "default": "eu27"
          },
          "countries": {
            "title": "Custom countries",
            "type": "array",
            "description": "Two-letter EU country codes such as `FR`, `DE`, `ES`. Overrides the preset when non-empty. Codes outside the EU-27 are ignored and reported in the run status.",
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "Start date (inclusive)",
            "type": "string",
            "description": "First delivery date in `YYYY-MM-DD` format. The public repository starts on 2023-08-26. Leave blank for 90 days before today."
          },
          "endDate": {
            "title": "End date (inclusive)",
            "type": "string",
            "description": "Last delivery date in `YYYY-MM-DD` format. Leave blank for today."
          },
          "dateGranularity": {
            "title": "Date granularity",
            "enum": [
              "range",
              "monthly",
              "daily"
            ],
            "type": "string",
            "description": "`range` returns one row per ad and country with metrics for the whole window. `monthly` returns one row per ad, country and calendar month with that month's impressions and reach. `daily` returns exact first and last delivery dates plus per-day impressions for windows up to 92 days.",
            "default": "range"
          },
          "groupBy": {
            "title": "Group rows by",
            "enum": [
              "ad",
              "creative"
            ],
            "type": "string",
            "description": "`ad` keeps the DSA row per post, line item and country. `creative` merges the same post across countries into one row with `countries`, `impressionsByCountry` and `reachByCountry`; reach is then a sum across countries. Creative grouping requires `dateGranularity=range`.",
            "default": "ad"
          },
          "searchTerms": {
            "title": "Keyword filter",
            "type": "array",
            "description": "Keep ads whose creative text, card title, landing URL/domain, targeting summary, account name or advertiser name contains any of these terms. Creative enrichment is enabled automatically when this filter is used.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "minImpressions": {
            "title": "Minimum impressions",
            "minimum": 0,
            "maximum": 1000000000000,
            "type": "integer",
            "description": "Drop rows with fewer impressions in the selected window or month. 0 disables the filter.",
            "default": 0
          },
          "minReach": {
            "title": "Minimum reach",
            "minimum": 0,
            "maximum": 1000000000000,
            "type": "integer",
            "description": "Drop rows with lower reach in the selected window or month. 0 disables the filter.",
            "default": 0
          },
          "maxAdsPerAdvertiser": {
            "title": "Maximum rows per advertiser",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Cap applied to each advertiser after sorting. 0 means no per-advertiser cap.",
            "default": 0
          },
          "maxItems": {
            "title": "Maximum records",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on emitted rows across all advertisers.",
            "default": 200
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "impressions",
              "reach",
              "newest"
            ],
            "type": "string",
            "description": "Sort the final rows before applying caps. `newest` uses the post creation date.",
            "default": "impressions"
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "desc",
              "asc"
            ],
            "type": "string",
            "description": "Ascending or descending order for the selected sort field.",
            "default": "desc"
          },
          "includeCreatives": {
            "title": "Enrich creatives",
            "type": "boolean",
            "description": "Resolve post text, language, author, hashtags, mentions, URLs, media, cards, app details and embed HTML through X's public oEmbed and syndication endpoints. This adds two small requests per unique post.",
            "default": true
          },
          "includeEmbedHtml": {
            "title": "Include embed HTML",
            "type": "boolean",
            "description": "Add the official X oEmbed blockquote HTML when creatives are enriched.",
            "default": true
          },
          "includeMedia": {
            "title": "Include media and app cards",
            "type": "boolean",
            "description": "Add image/video URLs, video variants, card media and app-store details when creatives are enriched.",
            "default": true
          },
          "onlyNewAds": {
            "title": "Only new ads",
            "type": "boolean",
            "description": "Remember emitted ad keys in a key-value store and skip ads seen in earlier runs. New rows get `changeType=NEW`, `firstSeenAt` and `lastSeenAt`. Works in ads and deliveryReport modes.",
            "default": false
          },
          "monitorStoreName": {
            "title": "Monitor store name",
            "type": "string",
            "description": "Key-value store used by the only-new monitor. Change it to keep separate watch lists.",
            "default": "x-ads-repository-monitor"
          },
          "includeAdvertiserErrors": {
            "title": "Include advertiser errors",
            "type": "boolean",
            "description": "Push a row for each advertiser that could not be resolved and for each delivery report that failed, instead of only recording it in the run log.",
            "default": false
          },
          "reportTimeoutSecs": {
            "title": "CSV report timeout (seconds)",
            "minimum": 30,
            "maximum": 600,
            "type": "integer",
            "description": "How long to wait for one delivery report. X's export queue can be slow or stay in progress; the deliveryReport mode reports a timeout row when this expires.",
            "default": 180
          },
          "retries": {
            "title": "Retries per request",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Extra attempts after a rate limit, over-capacity response or transient network error. The repository often answers 503 Over capacity.",
            "default": 3
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Pause between repository and enrichment requests. Raise it if X starts rate-limiting the run.",
            "default": 150
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The actor works without a proxy and uses its own browser TLS fingerprint. Provide a proxy only if you want to route requests yourself."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}