If you show ads in your app, there is a small plain text file on your website that affects whether buyers trust your inventory. It's called app-ads.txt. Most indie developers set it up once when they first add AdMob, then forget about it. That works until a domain change, a new mediation partner or a website redesign quietly breaks it.
This post covers what the file does, what goes in it, where it has to live, and how to check it in a way you can repeat after every change.
What app-ads.txt actually does
Programmatic ad buying has an obvious weak spot. A seller can claim to be offering inventory from a popular app when it isn't. app-ads.txt is the IAB Tech Lab's fix for that, adapted from the older ads.txt standard for websites.
It works like this:
- Your app's store listing points to a developer website.
- You publish a file at the root of that domain listing every ad system that is allowed to sell your inventory, along with your account ID in each one.
- Ad exchanges and buyers crawl that file. When a bid request says it comes from your app and arrives through seller X with account Y, they check whether X and Y appear in your file.
If the seller isn't listed, many buyers treat the inventory as unauthorized and either bid less or don't bid at all. Nothing in your app crashes. You just earn less, and the drop is easy to blame on something else. If you've been chasing a mysterious drop in demand, check this file early. It belongs on the same list as the other causes in Diagnosing Low Fill Rates in Your App's Ads.
The file format
Each line is one authorized seller, with comma-separated fields:
<ad system domain>, <your publisher account ID>, <DIRECT|RESELLER>, <certification authority ID (optional)>A minimal file for an app that uses only AdMob looks like this:
# app-ads.txt for example-studio.com
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0The fields:
- Ad system domain: the canonical domain of the ad network or exchange. Use the exact value the network tells you to use. It isn't always their marketing domain.
- Publisher account ID: your ID in that system. For AdMob it's the
pub-ID from your account settings. It is not an app ID or an ad unit ID. Mixing these up is the most common mistake. - Relationship:
DIRECTif you hold the account yourself,RESELLERif a partner sells your inventory through their own account. - Certification authority ID: an optional identifier for the ad system. Copy it from the network's instructions instead of typing it from memory.
Lines starting with # are comments. The spec also defines variables such as CONTACT=, SUBDOMAIN= and OWNERDOMAIN=. You don't need them for a basic setup, but OWNERDOMAIN is worth adding if your network or a recent spec revision asks for it.
Mediation means more lines
If you use mediation, every network that can fill your ad requests needs its own lines. Each network publishes the exact lines it expects, and some of them include several RESELLER entries for exchanges they work with. Don't write these by hand. Copy them from each network's dashboard or documentation, and keep a note of where each block came from:
# --- Google AdMob (source: AdMob > Apps > app-ads.txt) ---
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
# --- Network B (source: Network B dashboard, copied 2026-10) ---
network-b.example, 12345, DIRECT
exchange-partner.example, 98765, RESELLERWhen you remove a network from your mediation stack, remove its block too. A clean file is easier to audit, and stale lines authorize sellers you no longer work with.
Where the file has to live
This is where most setups break. Crawlers don't look for the file wherever you'd like to put it. They follow a fixed path:
- They read the developer website URL from your store listing. On Google Play that's the developer website field. On the App Store, check your ad network's documentation for which listing URL it reads, and make sure that field holds your domain.
- They take the root domain of that URL and request
https://yourdomain.com/app-ads.txt(falling back tohttpif needed).
That leads to some rules:
- Root of the domain, not a subpath.
https://example-studio.com/apps/app-ads.txtwon't be found. - The listing URL has to match the domain hosting the file. If your store listing points to a link-in-bio page, a social profile or a third-party page builder you don't control, crawlers can't find your file.
- Plain text. Serve it with a
200status andContent-Type: text/plain. If a site builder wraps it in an HTML template, it fails silently. - Avoid redirect chains. Crawlers may follow some redirects, but the safest setup is a direct
200at the canonical URL.
Hosting it when your site runs on a CMS
Some hosted site builders and blogging platforms don't make it easy to serve an arbitrary file at the root. If you run a reverse proxy in front of the site, you can serve the file there and leave the CMS alone. With nginx:
location = /app-ads.txt {
default_type text/plain;
alias /var/www/static/app-ads.txt;
add_header Cache-Control "public, max-age=3600";
}Keep the cache lifetime modest so a fix you deploy doesn't stay hidden behind a CDN for days. A short cache period with an explicit header is better than whatever your CDN does by default. If you're on static hosting, put the file in the published root directory and make sure your build step doesn't drop it.
How to verify it
Don't trust a dashboard's green checkmark alone. Check the file yourself, the way a crawler would.
Step 1: Request it like a crawler
curl -sS -D - -o /dev/null https://example-studio.com/app-ads.txtLook for a 200 status, a text/plain content type, and no chain of 301/302 hops. Then fetch the body:
curl -sS https://example-studio.com/app-ads.txtIf you see <html> anywhere, your server is returning a page instead of the file.
Step 2: Lint the contents
A short script catches the boring mistakes: wrong field counts, bad relationship values, an app ID pasted where the publisher ID belongs, and duplicates.
import sys, urllib.request
url = sys.argv[1]
with urllib.request.urlopen(url, timeout=10) as r:
ctype = r.headers.get("Content-Type", "")
body = r.read().decode("utf-8", errors="replace")
if "text/plain" not in ctype:
print(f"WARN content-type is {ctype!r}")
seen = set()
for n, raw in enumerate(body.splitlines(), 1):
line = raw.split("#", 1)[0].strip()
if not line or "=" in line.split(",")[0]:
continue # blank, comment, or variable line
fields = [f.strip() for f in line.split(",")]
if len(fields) < 3:
print(f"line {n}: expected at least 3 fields: {raw!r}")
continue
domain, acct, rel = fields[0].lower(), fields[1], fields[2].upper()
if rel not in ("DIRECT", "RESELLER"):
print(f"line {n}: bad relationship {fields[2]!r}")
if domain == "google.com" and not acct.startswith("pub-"):
print(f"line {n}: AdMob ID should start with pub-")
if "~" in acct:
print(f"line {n}: looks like an app or ad unit ID, not a publisher ID")
key = (domain, acct, rel)
if key in seen:
print(f"line {n}: duplicate entry")
seen.add(key)
print(f"checked {len(seen)} unique seller lines")Run it with python3 lint_app_ads.py https://example-studio.com/app-ads.txt. It isn't a full spec validator, but it catches the mistakes that actually show up in small setups.
Step 3: Confirm the store listing
Open your public store page in a browser where you're not signed in and look at the developer website link. Make sure it resolves to the same domain hosting the file. Do this for every app, on both platforms. One app often still has an old URL.
Step 4: Check each network's status page
AdMob and most mediation networks show whether they found and accepted your file. These checks run on the network's crawl schedule, so a fix won't show up right away. Write down the date you changed things and check again later, instead of editing the file over and over.
Step 5: Watch the effect in reports
The real test is whether demand behaves normally afterwards. Compare match rate and eCPM per network over the weeks before and after a fix, using the same date ranges and the same countries. If one network barely changes while the others improve, recheck that network's lines first.
A maintenance checklist
Run through this whenever one of these things happens:
- You add or remove a mediation network: update its block and re-lint.
- You change domains or redesign the site: re-run the curl checks, because new hosting setups often drop root files.
- You change store listing URLs: confirm the new domain hosts the file before you publish the listing change.
- You publish a new app: point its listing at the same developer domain so one file covers all your apps.
- Once a quarter or so: run the lint script and compare the file against each network's current recommended lines.
You can also add the curl check to any uptime monitoring you already run, and alert on anything other than a 200 with text/plain. It costs almost nothing and catches the silent failures.
Wrapping up
app-ads.txt is a few lines of text, but it decides whether buyers believe your inventory is really yours. Copy the lines from each network instead of writing them by hand. Host the file at the root of the exact domain your store listing names, serve it as plain text, and check it yourself with curl and a small lint script instead of relying on a dashboard. After that, it only needs attention when your network stack, domain or listing changes, and the checklist above covers those moments.