# X Ads Repository EU Transparency Scraper (`xyrelith-data/twitter-ads-repository`) Actor

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.

- **URL**: https://apify.com/xyrelith-data/twitter-ads-repository.md
- **Developed by:** [Xyrelith Data](https://apify.com/xyrelith-data) (community)
- **Categories:** Social media, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## X Ads Repository EU Transparency Scraper

Collect the ads X served in the European Union from the public Digital Services Act Ads Repository at `ads.x.com/ads-repository`. The actor reads the repository the same way a browser does — anonymous guest session, no X login, no developer app, no cookies to supply, no paid proxy — and turns it into structured rows you can filter, schedule and export.

Use it to see which creatives a competitor runs in which EU member states, compare disclosed impressions and reach, rebuild monthly or daily delivery timelines, export DSA fields for transparency research, and monitor advertiser handles for new ads.

### What the actor returns

The dataset uses `recordType` to distinguish rows:

- **`ad`** — one row per post, line item and EU country. Metrics are for the selected window or month.
- **`creative`** — one row per post when `groupBy=creative`, with all countries and per-country metrics.
- **`advertiser`** — profile lookup rows from `mode=advertisers`.
- **`deliveryReport`** — rows from X's public CSV report workflow with exact flight dates and extra DSA fields.
- **`advertiserError`** — optional rows for handles or CSV exports that failed.

Per ad you get:

- Advertiser ID, handle, display name, 400×400 profile image (plus original), profile URL and verified flag.
- Post ID, post URL, line item ID, ad account ID, account name and deleted flag.
- Country code and name, query window, metrics scope and optional delivery month.
- Impressions, reach and frequency. Monthly mode returns one row per month; daily mode adds `deliveryStartDate`, `deliveryEndDate`, `activeDayCount`, `impressionsByDay` and `impressionsByMonth`.
- Funding instrument type, billing currency and approval status.
- Full targeting list, grouped targeting by type, targeting types, count and a compact summary.
- Creative text, language, author, post creation date, likes, replies, edited flag, hashtags, mentions, URLs, cashtags, official embed HTML, media URLs and video variants, card title/subtitle/landing URL/domain/CTA, and app-store details when the post uses an app card.
- Provenance: `sourceUrl`, `repositoryUrl`, `scrapedAt`, and `qualityFlags` when upstream fields are missing.
- Optional monitor fields: `changeType`, `firstSeenAt`, `lastSeenAt`, `contentHash`.

Creative fields are omitted when the post is no longer available; `creativeFetchStatus` tells you whether enrichment was available, partial or unavailable.

### Modes

| Mode | What it does |
|---|---|
| `ads` | Resolve advertisers and collect ad rows. Supports whole-range, monthly and daily windows, creative grouping, filters, sorting and the only-new monitor. |
| `advertisers` | Resolve handles, @handles, X profile URLs and numeric advertiser IDs into profile rows. |
| `deliveryReport` | Use X's public CSV export for exact flight dates, funding entity, excluded targeting segments and enforcement fields. The export queue is upstream and can stall, so this mode is timeout-guarded and optional. |

### Inputs

| Input | Type | Default | What it does |
|---|---|---|---|
| `mode` | select | `ads` | `ads`, `advertisers` or `deliveryReport`. |
| `advertisers` | string list | – | Handles, `@handles`, profile URLs or numeric advertiser IDs. |
| `marketPreset` | select | `eu27` | `eu27`, `dach`, `nordics`, `benelux`, `southern`, `central_eastern` or `custom`. |
| `countries` | string list | – | Custom EU-27 codes; overrides the preset when non-empty. |
| `startDate` | date | – (last 90 days) | First delivery date, inclusive, `YYYY-MM-DD`. Earliest repository date is 2023-08-26. |
| `endDate` | date | – (today) | Last delivery date, inclusive, `YYYY-MM-DD`. |
| `dateGranularity` | select | `range` | `range`, `monthly` or `daily` (daily supports up to 92 days). |
| `groupBy` | select | `ad` | `ad` keeps post × country rows; `creative` merges countries into one row. Creative grouping requires `dateGranularity=range`. |
| `searchTerms` | string list | – | Keep rows whose creative text, card title, landing URL/domain, targeting summary, account name or advertiser name contains any term. Enables creative enrichment automatically. |
| `minImpressions` | integer | `0` | Drop rows below this impression count. 0 disables it. |
| `minReach` | integer | `0` | Drop rows below this reach. 0 disables it. |
| `maxAdsPerAdvertiser` | integer | `0` | Cap per advertiser after sorting. 0 means no cap. |
| `maxItems` | integer | `200` | Hard cap on emitted rows. |
| `sortBy` | select | `impressions` | `impressions`, `reach` or `newest` (post creation date). |
| `sortOrder` | select | `desc` | `desc` or `asc`. |
| `includeCreatives` | boolean | `true` | Fetch post text, author, media, cards and optional embed HTML. Two small requests per unique post. |
| `includeEmbedHtml` | boolean | `true` | Include the official X oEmbed blockquote. |
| `includeMedia` | boolean | `true` | Include image/video URLs, video variants, card media and app details. |
| `onlyNewAds` | boolean | `false` | Remember emitted keys and skip ads seen in earlier runs. New rows get `changeType=NEW`, `firstSeenAt` and `lastSeenAt`. |
| `monitorStoreName` | string | `x-ads-repository-monitor` | Key-value store used by the only-new monitor. |
| `includeAdvertiserErrors` | boolean | `false` | Push error rows for unresolved advertisers and failed CSV exports. |
| `reportTimeoutSecs` | integer | `180` | Per-report timeout for `deliveryReport` mode. |
| `retries` | integer | `3` | Extra attempts after rate limits, over-capacity answers and transient errors. |
| `requestDelayMs` | integer | `150` | Delay between requests, in milliseconds. |
| `proxyConfiguration` | proxy | – | Optional. The actor works without a proxy and uses its own browser TLS fingerprint. |

### Output example

```json
{
  "recordType": "ad",
  "adKey": "1993023282321514852_53751756_FR",
  "advertiserHandle": "Tesla",
  "postId": "1993023282321514852",
  "postUrl": "https://x.com/Tesla/status/1993023282321514852",
  "countryCode": "FR",
  "queryStartDate": "2025-11-01",
  "queryEndDate": "2025-11-30",
  "metricsScope": "selectedWindow",
  "impressions": 968546,
  "reach": 837677,
  "frequency": 1.16,
  "fundingInstrumentType": "NonExclusiveIo",
  "billingCurrency": "USD",
  "approvalStatus": "Verified",
  "targetingCount": 9,
  "postCreatedAt": "2025-11-24T18:25:53+00:00",
  "creativeText": "With Full Self-Driving Supervised engaged, you're 7x less likely to be involved in an accident",
  "creativeLanguage": "en",
  "cardType": "video_website",
  "cardTitle": "Safety Report",
  "destinationDomain": "tesla.com",
  "creativeFetchStatus": "available",
  "sourceUrl": "https://x.com/Tesla/status/1993023282321514852",
  "scrapedAt": "2026-11-15T09:24:18+00:00"
}
```

### How it works

1. Warm up `https://ads.x.com/ads-repository` and keep only the anonymous guest cookies.
2. Resolve each advertiser with the repository's own `user-search` endpoint (numeric IDs are resolved through X's public profile redirect).
3. Query `ads-search` for the selected EU countries and date windows. One request can cover all 27 countries. The user-facing end date is inclusive; the API end date is exclusive, so the actor adds one day.
4. For `monthly`, query one calendar month per request and emit one row per month. For `daily`, query each day, then query the whole window once for accurate totals, and derive exact first/last delivery dates and per-day impressions.
5. Enrich only the rows that will be emitted. Creative text and media come from X's public oEmbed and syndication endpoints.
6. Apply filters, sorting, per-advertiser and total caps; apply the optional only-new monitor; push clean rows with empty fields omitted.

### Reliability and cost

- Retries with exponential backoff on 429, 5xx and Cloudflare 520/522/524, plus a fresh guest session on 403.
- X often answers 503 Over capacity; the actor retries per request.
- The actor is HTTP-only and runs comfortably at 512 MB. Creative enrichment is two small requests per unique post.
- The default prefill is the smallest run with output: Tesla, France, November 2025, one row, no creative enrichment. It finishes in seconds.
- There is no proxy requirement and no credential input. An optional proxy field exists for users who want to route requests themselves.

### Limitations

- **EU-27 only.** The repository covers ads served in the EU. Switzerland, Norway, Iceland, Liechtenstein and the UK are not EU markets and are not in the presets; non-EU-27 custom codes are ignored and reported in the run status.
- **Sparse coverage.** Many advertisers have no EU rows in a given window. An empty result is a valid answer, not a scraper failure.
- **CSV export can be slow.** X's public export queue sometimes stays in progress for minutes or does not finish. `deliveryReport` mode is timeout-guarded and reports a timeout row when enabled; the main `ads` mode uses the fast JSON API instead. Daily granularity gives exact first and last delivery dates without waiting for the CSV queue.
- **No spend, budget or ROAS.** X does not disclose them. Impressions and reach are the disclosed metrics.
- **No keyword search across all advertisers.** The repository only searches by exact advertiser handle. `searchTerms` filters the rows of the advertisers you provide.
- **No reliable removal detection.** A row can disappear because the selected date window changed. The monitor reports new ads, not removed campaigns.
- **No agency inference.** Account names are shipped as disclosed. The actor does not guess an agency.
- **Reach sums overcount.** In `groupBy=creative` mode, reach is a sum across countries; `reachIsSumAcrossCountries=true` marks it. For exact aggregate reach, use the `ad` grouping and the range window.
- **Creatives can disappear.** Deleted or protected posts may no longer be embeddable; those rows keep the DSA data and set `creativeFetchStatus` instead of fabricating text.
- **Data can lag.** The repository is not a real-time ad feed.

### FAQ

**Do I need an X account or API key?** No. The actor uses the public Ads Repository, public oEmbed and public syndication endpoints.

**Why do I get zero rows for a big brand?** The repository is sparse and EU-scoped. Try a wider date range, another market, or a different handle. The run status tells you how many advertisers and markets were queried.

**What is the difference between `ads` and `deliveryReport`?** `ads` uses the fast JSON API and can rebuild monthly/daily dates itself. `deliveryReport` uses X's CSV export, which adds exact flight dates, funding entity, excluded segments and enforcement fields, but can take minutes or time out.

**How do I get one row per creative instead of per country?** Set `groupBy=creative` with `dateGranularity=range`.

**How do I track new ads?** Set `onlyNewAds=true` and schedule the actor. Rows not seen in earlier runs get `changeType=NEW` and first/last seen timestamps.

**Why is the end date one day later in the API?** The actor treats your `endDate` as inclusive and adds one day for the repository's exclusive end parameter.

### Data source and scope

The actor reads only public X transparency endpoints: `ads.x.com/ads-repository`, `publish.twitter.com/oembed` and `cdn.syndication.twimg.com`. It does not use the authenticated X Ads API, does not log in, and does not collect personal data beyond what X publishes in the repository. Coverage is limited to what X discloses for EU markets.

# Actor input Schema

## `mode` (type: `string`):

`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.

## `advertisers` (type: `array`):

X handles such as `Tesla`, `@Tesla`, profile URLs such as `https://x.com/Tesla`, or numeric advertiser IDs.

## `marketPreset` (type: `string`):

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.

## `countries` (type: `array`):

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.

## `startDate` (type: `string`):

First delivery date in `YYYY-MM-DD` format. The public repository starts on 2023-08-26. Leave blank for 90 days before today.

## `endDate` (type: `string`):

Last delivery date in `YYYY-MM-DD` format. Leave blank for today.

## `dateGranularity` (type: `string`):

`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.

## `groupBy` (type: `string`):

`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`.

## `searchTerms` (type: `array`):

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.

## `minImpressions` (type: `integer`):

Drop rows with fewer impressions in the selected window or month. 0 disables the filter.

## `minReach` (type: `integer`):

Drop rows with lower reach in the selected window or month. 0 disables the filter.

## `maxAdsPerAdvertiser` (type: `integer`):

Cap applied to each advertiser after sorting. 0 means no per-advertiser cap.

## `maxItems` (type: `integer`):

Hard cap on emitted rows across all advertisers.

## `sortBy` (type: `string`):

Sort the final rows before applying caps. `newest` uses the post creation date.

## `sortOrder` (type: `string`):

Ascending or descending order for the selected sort field.

## `includeCreatives` (type: `boolean`):

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.

## `includeEmbedHtml` (type: `boolean`):

Add the official X oEmbed blockquote HTML when creatives are enriched.

## `includeMedia` (type: `boolean`):

Add image/video URLs, video variants, card media and app-store details when creatives are enriched.

## `onlyNewAds` (type: `boolean`):

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.

## `monitorStoreName` (type: `string`):

Key-value store used by the only-new monitor. Change it to keep separate watch lists.

## `includeAdvertiserErrors` (type: `boolean`):

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.

## `reportTimeoutSecs` (type: `integer`):

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.

## `retries` (type: `integer`):

Extra attempts after a rate limit, over-capacity response or transient network error. The repository often answers 503 Over capacity.

## `requestDelayMs` (type: `integer`):

Pause between repository and enrichment requests. Raise it if X starts rate-limiting the run.

## `proxyConfiguration` (type: `object`):

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.

## Actor input object example

```json
{
  "mode": "ads",
  "advertisers": [
    "Tesla"
  ],
  "marketPreset": "custom",
  "countries": [
    "FR"
  ],
  "startDate": "2025-11-01",
  "endDate": "2025-11-30",
  "dateGranularity": "range",
  "groupBy": "ad",
  "searchTerms": [],
  "minImpressions": 0,
  "minReach": 0,
  "maxAdsPerAdvertiser": 0,
  "maxItems": 1,
  "sortBy": "impressions",
  "sortOrder": "desc",
  "includeCreatives": false,
  "includeEmbedHtml": false,
  "includeMedia": false,
  "onlyNewAds": false,
  "monitorStoreName": "x-ads-repository-monitor",
  "includeAdvertiserErrors": false,
  "reportTimeoutSecs": 60,
  "retries": 3,
  "requestDelayMs": 0
}
```

# Actor output Schema

## `ads` (type: `string`):

Dataset containing all collected X Ads Repository records.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "ads",
    "advertisers": [
        "Tesla"
    ],
    "marketPreset": "custom",
    "countries": [
        "FR"
    ],
    "startDate": "2025-11-01",
    "endDate": "2025-11-30",
    "dateGranularity": "range",
    "groupBy": "ad",
    "searchTerms": [],
    "minImpressions": 0,
    "minReach": 0,
    "maxAdsPerAdvertiser": 0,
    "maxItems": 1,
    "sortBy": "impressions",
    "sortOrder": "desc",
    "includeCreatives": false,
    "includeEmbedHtml": false,
    "includeMedia": false,
    "onlyNewAds": false,
    "monitorStoreName": "x-ads-repository-monitor",
    "includeAdvertiserErrors": false,
    "reportTimeoutSecs": 60,
    "retries": 3,
    "requestDelayMs": 0
};

// Run the Actor and wait for it to finish
const run = await client.actor("xyrelith-data/twitter-ads-repository").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "ads",
    "advertisers": ["Tesla"],
    "marketPreset": "custom",
    "countries": ["FR"],
    "startDate": "2025-11-01",
    "endDate": "2025-11-30",
    "dateGranularity": "range",
    "groupBy": "ad",
    "searchTerms": [],
    "minImpressions": 0,
    "minReach": 0,
    "maxAdsPerAdvertiser": 0,
    "maxItems": 1,
    "sortBy": "impressions",
    "sortOrder": "desc",
    "includeCreatives": False,
    "includeEmbedHtml": False,
    "includeMedia": False,
    "onlyNewAds": False,
    "monitorStoreName": "x-ads-repository-monitor",
    "includeAdvertiserErrors": False,
    "reportTimeoutSecs": 60,
    "retries": 3,
    "requestDelayMs": 0,
}

# Run the Actor and wait for it to finish
run = client.actor("xyrelith-data/twitter-ads-repository").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "ads",
  "advertisers": [
    "Tesla"
  ],
  "marketPreset": "custom",
  "countries": [
    "FR"
  ],
  "startDate": "2025-11-01",
  "endDate": "2025-11-30",
  "dateGranularity": "range",
  "groupBy": "ad",
  "searchTerms": [],
  "minImpressions": 0,
  "minReach": 0,
  "maxAdsPerAdvertiser": 0,
  "maxItems": 1,
  "sortBy": "impressions",
  "sortOrder": "desc",
  "includeCreatives": false,
  "includeEmbedHtml": false,
  "includeMedia": false,
  "onlyNewAds": false,
  "monitorStoreName": "x-ads-repository-monitor",
  "includeAdvertiserErrors": false,
  "reportTimeoutSecs": 60,
  "retries": 3,
  "requestDelayMs": 0
}' |
apify call xyrelith-data/twitter-ads-repository --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xyrelith-data/twitter-ads-repository"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/JPBhxiopXxn0s7Mqp/builds/ILmZ6pHxWaNitnSY6/openapi.json
