# ads.txt Auditor (`phoenix2810/ads-txt-auditor`) Actor

Fetch and deeply audit a public website's /ads.txt file for IAB Authorized Digital Sellers spec compliance.

- **URL**: https://apify.com/phoenix2810/ads-txt-auditor.md
- **Developed by:** [Sanskar Jaiswal](https://apify.com/phoenix2810) (community)
- **Categories:** SEO tools, Developer tools, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## ads.txt Auditor

Fetches and deeply audits a public website's `/ads.txt` file for IAB Authorized Digital Sellers spec compliance. Parses every entry, validates field formatting, checks `DIRECT`/`RESELLER` classification, verifies authority ID presence, detects duplicate entries, checks for `app-ads.txt` availability, and optionally reads `OWNERDOMAIN`/`MANAGERDOMAIN` variables from ads.txt v1.1. Returns a readiness score, letter grade, issues, and recommendations. Built for ad ops teams, programmatic advertising engineers, supply chain transparency auditors, and publisher QA workflows.

### Use cases

- Verify that a published ads.txt file conforms to the IAB Authorized Digital Sellers format after a deploy or CMS migration.
- Detect invalid entries with missing fields or incorrect account types that buyers and DSPs may reject.
- Find duplicate entries (same ad system domain, publisher ID, and account type) that cause buyer confusion.
- Identify RESELLER entries missing the TAG-ID authority ID, reducing supply chain transparency.
- Check whether app-ads.txt is published for in-app inventory verification.
- Confirm ads.txt is served over HTTPS with the correct `text/plain` Content-Type.
- Detect ads.txt v1.1 `OWNERDOMAIN` and `MANAGERDOMAIN` variables for improved seller transparency.
- Run scheduled checks on publisher domains to catch ads.txt configuration drift after deploys and CDN cutovers.
- Feed structured results into ad ops dashboards or CI pipelines.

### Input

| Field | Type | Description |
| --- | --- | --- |
| `startUrl` | string | Public HTTP or HTTPS website URL to audit. The actor fetches `/ads.txt` from this domain. URLs with credentials and private network targets are rejected. |
| `checkAppAdsTxt` | boolean | Also check for `/app-ads.txt` availability and validity. Defaults to true. |
| `timeoutSeconds` | integer | Request timeout from 3 to 30 seconds. Defaults to 10. |

### Output

The actor pushes one dataset item per run.

| Field | Type | Description |
| --- | --- | --- |
| `inputUrl` | string | Original URL from input. |
| `normalizedInputUrl` | string | Normalized input URL after defaulting the scheme. |
| `finalUrl` | string | Final URL of the ads.txt fetch after redirects. |
| `https` | boolean | True when the ads.txt was served over HTTPS. |
| `ok` | boolean | True when the fetch succeeded. |
| `checkedAt` | string | ISO timestamp for the audit. |
| `adsTxtFound` | boolean | True when `/ads.txt` was found and returned a valid response. |
| `adsTxtStatus` | integer or null | HTTP status code from the ads.txt fetch. |
| `adsTxtUrl` | string or null | The full URL of the ads.txt file. |
| `adsTxtContentType` | string or null | Content-Type header from the ads.txt response. |
| `adsTxtLineCount` | integer | Total number of lines in the ads.txt file. |
| `rawAdsTxt` | string or null | Raw ads.txt content (up to 2 MB). |
| `appAdsTxtFound` | boolean | True when `/app-ads.txt` was found and returned a valid response. |
| `appAdsTxtStatus` | integer or null | HTTP status code from the app-ads.txt fetch. |
| `appAdsTxtUrl` | string or null | The full URL of the app-ads.txt file. |
| `appAdsTxtEntryCount` | integer | Number of valid entries in app-ads.txt. |
| `entries` | array | Parsed and validated ads.txt entries. |
| `entryCount` | integer | Number of valid entries. |
| `directCount` | integer | Number of DIRECT entries. |
| `resellerCount` | integer | Number of RESELLER entries. |
| `commentCount` | integer | Number of comment lines. |
| `blankLineCount` | integer | Number of blank lines. |
| `duplicateCount` | integer | Number of duplicate entries. |
| `invalidEntryCount` | integer | Number of invalid entries. |
| `invalidEntries` | array | List of invalid entries with reasons. |
| `duplicateEntries` | array | List of duplicate entries. |
| `uniqueDomains` | array | List of unique ad system domains. |
| `uniqueDomainCount` | integer | Number of unique ad system domains. |
| `variables` | array | Parsed variable assignments (OWNERDOMAIN, MANAGERDOMAIN, etc.). |
| `score` | integer | ads.txt readiness score from 0 to 100. |
| `grade` | string | Letter grade from A+ to F. |
| `issues` | array | Human-readable issues. |
| `recommendations` | array | Suggested fixes. |
| `error` | string or null | Fetch-level error, if the request failed. |

#### Per-entry fields

Each object in the `entries` array contains:

| Field | Type | Description |
| --- | --- | --- |
| `adSystemDomain` | string | Ad system domain (lowercased). |
| `publisherAccountId` | string | Publisher account ID. |
| `accountType` | string | `DIRECT` or `RESELLER`. |
| `authorityId` | string or null | Authority ID (TAG-ID) if present. |
| `raw` | string | Raw line from the ads.txt file. |
| `issues` | array | Per-entry issues with severity and message. |

### Example input

```json
{
  "startUrl": "https://example.com/",
  "checkAppAdsTxt": true,
  "timeoutSeconds": 10
}
```

### Example output

```json
{
  "inputUrl": "https://example.com/",
  "normalizedInputUrl": "https://example.com/",
  "finalUrl": "https://example.com/ads.txt",
  "https": true,
  "ok": true,
  "checkedAt": "2025-01-01T00:00:00.000Z",
  "adsTxtFound": true,
  "adsTxtStatus": 200,
  "adsTxtUrl": "https://example.com/ads.txt",
  "adsTxtContentType": "text/plain; charset=utf-8",
  "adsTxtLineCount": 5,
  "rawAdsTxt": "greenbold.com, 1234, DIRECT, 5345b8ed5e\nrubiconproject.com, 5678, RESELLER, 0ba5b8ed5e\nOWNERDOMAIN=example.com\n# authorized sellers\n",
  "appAdsTxtFound": false,
  "appAdsTxtStatus": 404,
  "appAdsTxtUrl": "https://example.com/app-ads.txt",
  "appAdsTxtEntryCount": 0,
  "entries": [
    {
      "adSystemDomain": "greenbold.com",
      "publisherAccountId": "1234",
      "accountType": "DIRECT",
      "authorityId": "5345b8ed5e",
      "raw": "greenbold.com, 1234, DIRECT, 5345b8ed5e",
      "issues": []
    },
    {
      "adSystemDomain": "rubiconproject.com",
      "publisherAccountId": "5678",
      "accountType": "RESELLER",
      "authorityId": "0ba5b8ed5e",
      "raw": "rubiconproject.com, 5678, RESELLER, 0ba5b8ed5e",
      "issues": []
    }
  ],
  "entryCount": 2,
  "directCount": 1,
  "resellerCount": 1,
  "commentCount": 1,
  "blankLineCount": 1,
  "duplicateCount": 0,
  "invalidEntryCount": 0,
  "invalidEntries": [],
  "duplicateEntries": [],
  "uniqueDomains": ["greenbold.com", "rubiconproject.com"],
  "uniqueDomainCount": 2,
  "variables": [
    { "type": "variable", "name": "OWNERDOMAIN", "value": "example.com", "raw": "OWNERDOMAIN=example.com" }
  ],
  "score": 98,
  "grade": "A+",
  "issues": [],
  "recommendations": [
    "If the domain has a mobile app, publish an app-ads.txt file at the root for in-app inventory verification."
  ],
  "error": null
}
```

### Security

- Only public HTTP and HTTPS URLs are fetched.
- URLs with usernames or passwords are rejected.
- Private IPv4, private IPv6, localhost, link-local, and private DNS resolutions are blocked before fetching.
- Redirect destinations are revalidated before they are followed.
- The actor does not require logins, cookies, browser sessions, or credentials.
- The actor fetches only `/ads.txt` and optionally `/app-ads.txt` from the provided domain. It does not fetch any URLs referenced inside the ads.txt file.

### Pricing

| Event | Suggested price |
| --- | ---: |
| Actor start | `$0.005` |
| Site audited | `$0.01` |

Suggested launch price: about `$0.015` per audited site. Teams can schedule the actor for recurring checks on publisher domains after deploys and CDN cutovers.

### FAQ

#### Does this actor crawl multiple URLs or a whole site?

No. It fetches `/ads.txt` (and optionally `/app-ads.txt`) from one domain per run. This keeps runs cheap and predictable for CI and scheduled monitoring.

#### How does the score work?

The score starts at 100 and is reduced for: invalid entries (-10 each, capped at -40), duplicate entries (-5 each, capped at -20), RESELLER entries without authority ID (-3 each, capped at -15), missing app-ads.txt (-5), non-HTTPS delivery (-10), incorrect Content-Type (-3), and zero valid entries (-30). A bonus of +3 is added when `OWNERDOMAIN` or `MANAGERDOMAIN` variables are present (ads.txt v1.1). Files that are entirely absent receive an `F`.

#### What is the IAB ads.txt format?

Each data line in an ads.txt file is: `adSystemDomain, publisherAccountId, DIRECT|RESELLER, authorityId`. The authority ID is typically the TAG-ID from the Trustworthy Accountability Group. Lines starting with `#` are comments. Blank lines are ignored. Version 1.1 adds optional `OWNERDOMAIN` and `MANAGERDOMAIN` variables for improved seller transparency.

#### What is the difference between this actor and ads.txt scrapers on the Apify Store?

Existing ads.txt scrapers extract seller entries from ads.txt files but do not validate IAB spec compliance, do not score file quality, do not detect duplicates or invalid entries, do not check for RESELLER authority IDs, and do not verify app-ads.txt availability or Content-Type correctness. This actor returns one structured audit diagnostic per domain with a readiness score, letter grade, issues, and recommendations suitable for scheduled monitoring and pipeline checks.

#### What is app-ads.txt?

app-ads.txt is the mobile app counterpart of ads.txt. It is published at `/app-ads.txt` and lists authorized sellers for a publisher's in-app ad inventory. The actor checks for its presence and parses entry count when `checkAppAdsTxt` is enabled (default: true).

# Actor input Schema

## `startUrl` (type: `string`):

Public HTTP or HTTPS website URL to audit. The actor fetches /ads.txt from this domain.

## `checkAppAdsTxt` (type: `boolean`):

Also check for /app-ads.txt availability and validity. Defaults to true.

## `timeoutSeconds` (type: `integer`):

Request timeout from 3 to 30 seconds.

## Actor input object example

```json
{
  "startUrl": "https://example.com/",
  "checkAppAdsTxt": true,
  "timeoutSeconds": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "startUrl": "https://example.com/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("phoenix2810/ads-txt-auditor").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 = { "startUrl": "https://example.com/" }

# Run the Actor and wait for it to finish
run = client.actor("phoenix2810/ads-txt-auditor").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 '{
  "startUrl": "https://example.com/"
}' |
apify call phoenix2810/ads-txt-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,phoenix2810/ads-txt-auditor"
        }
    }
}

```

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/GsSlZdOUPkx2n36nc/builds/kdKpqqiY5GIP1QpUS/openapi.json
