ads.txt / app-ads.txt Validator API
Fetch and validate ads.txt or app-ads.txt (IAB 1.1, OWNERDOMAIN, MANAGERDOMAIN): errors, duplicates, required lines and a sellers.json cross-check.
Buyers skip inventory that is not authorised in ads.txt (websites) or app-ads.txt (apps, on the developer website listed in the store). Give a domain (and type=app-ads for apps) and the API fetches /ads.txt over HTTPS (falling back to HTTP), follows redirects within the IAB rules (only one hop outside the root domain), and parses every line with the IAB Tech Lab ads.txt 1.1 grammar: records <ad system domain>, <publisher ID>, <DIRECT|RESELLER>[, <certification authority ID>] with optional ; extensions, comments, and the variables CONTACT, SUBDOMAIN, INVENTORYPARTNERDOMAIN, OWNERDOMAIN and MANAGERDOMAIN (with optional country code). You can also post the file content before publishing it.
Each issue has a level, a code and the line number: wrong field count, URLs instead of domains, invalid relationship (e.g. "RESLLER"), IDs with spaces, duplicates, accounts listed both as DIRECT and RESELLER, aliases such as adsense.com instead of google.com, a wrong Google TAG ID or publisher ID format, more than one OWNERDOMAIN or MANAGERDOMAIN per country, an HTML page served instead of the file, a wrong Content-Type. Pass required (the lines your ad networks ask for, e.g. the AdSense or AdMob line) to see which are missing.
sellers=1 cross-checks the publisher IDs with the sellers.json of the ad systems (the max_systems most used, default 5, max 10): whether each ID exists, the seller name and domain, and whether seller_type PUBLISHER / INTERMEDIARY matches DIRECT / RESELLER. Large files such as Google's (over 100 MB) are streamed and only the needed IDs are kept; results are cached for a day.
Markdown · OpenAPI · Postman · llms.txt
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
domain | query | string | yes | Website (or app developer website) to fetch the file from. Not needed with content. | |
type | query | string | no | ads | ads (ads.txt) or app-ads (app-ads.txt). |
content | body | string | no | File contents to validate instead of fetching (max 2 MB); a text/plain body works too. | |
required | body | string | no | Lines that must be present, one per line (or an array). | |
sellers | query | boolean | no | 1: cross-check publisher IDs with the ad systems' sellers.json. | |
max_systems | query | number | no | 5 | Number of ad systems checked with sellers=1 (1–10, most used first). |
limit | query | number | no | 500 | Maximum records returned (0–5000); issues are always complete up to 500. |
Example
curl -X POST "https://apibox.io.vn/v1/ads-txt" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content":"OWNERDOMAIN=example.vn\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\nadsense.com, pub-1234567890123456, DIRECT\nopenx.com, 537120563, RESELLER, 6a698e2ec38604c6"}'const res = await fetch('https://apibox.io.vn/v1/ads-txt', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"content": "OWNERDOMAIN=example.vn\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\nadsense.com, pub-1234567890123456, DIRECT\nopenx.com, 537120563, RESELLER, 6a698e2ec38604c6"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/ads-txt",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"content": "OWNERDOMAIN=example.vn\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\nadsense.com, pub-1234567890123456, DIRECT\nopenx.com, 537120563, RESELLER, 6a698e2ec38604c6"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/ads-txt');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"content":"OWNERDOMAIN=example.vn\\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\\ngoogle.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\\nadsense.com, pub-1234567890123456, DIRECT\\nopenx.com, 537120563, RESELLER, 6a698e2ec38604c6"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"type": "ads",
"found": true,
"stats": {
"lines": 5,
"records": 4,
"variables": 1,
"comments": 0,
"blank": 0,
"direct": 3,
"reseller": 1,
"ad_systems": 3
},
"valid": true,
"errors": 0,
"warnings": 2,
"issues": [
{
"level": "warning",
"code": "duplicate",
"message": "Duplicate of line 2",
"line": 3
},
{
"level": "warning",
"code": "domain_alias",
"message": "Use \"google.com\" as the ad system domain instead of \"adsense.com\"",
"line": 4
}
],
"variables": [
{
"line": 1,
"name": "OWNERDOMAIN",
"value": "example.vn"
}
],
"records": [
{
"line": 2,
"domain": "google.com",
"account_id": "pub-1234567890123456",
"relationship": "DIRECT",
"cert_id": "f08c47fec0942fa0"
},
{
"line": 3,
"domain": "google.com",
"account_id": "pub-1234567890123456",
"relationship": "DIRECT",
"cert_id": "f08c47fec0942fa0"
},
{
"line": 4,
"domain": "adsense.com",
"account_id": "pub-1234567890123456",
"relationship": "DIRECT",
"cert_id": null
},
{
"line": 5,
"domain": "openx.com",
"account_id": "537120563",
"relationship": "RESELLER",
"cert_id": "6a698e2ec38604c6"
}
],
"records_truncated": false
}
Use cases
- Validate ads.txt after adding a new ad network
- Check app-ads.txt on the developer website before submitting an app to AdMob or AppLovin
- Audit a publisher's supply chain against sellers.json
- Monitor that the AdSense line is still present after a site redesign
FAQ
Where must app-ads.txt be?
At the root of the developer website listed in Google Play or the App Store, e.g. https://studio.example.vn/app-ads.txt, not on the app's own domain.
Is a redirect allowed?
Redirects within the same root domain are fine; the spec allows only one redirect to a different domain. The file must be plain text, not an HTML page.
What does seller_not_found mean?
The ad system's sellers.json has no seller with that ID: the ID may be wrong, the account closed or the file not updated yet. Ask the ad network to confirm.
Related APIs
URL Metadata
Fetch any URL and get its title, description, Open Graph and Twitter Card tags, favicon, canonical, feeds and JSON-LD as JSON.
H:HTTP Headers
See the HTTP status and every response header of a URL, with a summary of security headers like HSTS, CSP and X-Frame-Options.
301Redirect Checker
Follow every 301, 302, 307 and 308 redirect of a URL and get the full chain with status codes, the final URL and the number of hops.