Ads.txt Generator

Ads.txt Generator API

Web Development

Create ads.txt and app-ads.txt files by describing your requirements in natural language.

Authentication

Send your API key in the Authorization header as a Bearer token (Authorization: Bearer YOUR_API_KEY) or in the X-API-Key header.

Rate Limit

10 requests per minute

Endpoints

1 endpoint available

Overview

Send a domain and a plain-language description of your ad setup (networks, publisher IDs, DIRECT or RESELLER) and get back the content for both ads.txt and app-ads.txt.

Notes

  • domain is up to 253 characters. It is only passed to the model; nothing is fetched.
  • requirements is up to 5,000 characters. Include your real publisher IDs: the model cannot look them up and will use placeholders if you leave them out.
  • If the model leaves out a section, that field is an empty string.

This endpoint calls an AI model, so it uses the AI rate limit: 10 requests per minute and 200 requests per day per API key. Output is generated by a model and can be wrong, so review it before you use it.

Endpoints

POST
https://opentools.ca/api/v1/tools/ads-txt-generator
Generate ads.txt and app-ads.txt content

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
domain
string
Required
Your site domain, e.g. "example.com". 1-253 characters.
requirements
string
Required
Plain-language description of your ad networks, publisher IDs and relationships. 1-5,000 characters.

Response Example

{
  "success": true,
  "domain": "example.com",
  "adsTxt": "google.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\npubmatic.com, 156789, RESELLER, 5d62403b186f2ace",
  "appAdsTxt": "google.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0\npubmatic.com, 156789, RESELLER, 5d62403b186f2ace"
}

Error Codes

400
Invalid JSON or a field failed validation (missing, empty, too long, or not an allowed value). details lists each problem.
401
Missing or invalid API key
403
API key is inactive or expired, or the request IP is not allowed for this key
429
Rate limit exceeded (10 per minute or 200 per day per key)
500
Internal server error, including a failed AI model call

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/ads-txt-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "requirements": "Google AdSense publisher ID pub-1234567890123456, direct relationship. Also sell through PubMatic as a reseller, account 156789."
  }'

Ready to get started?

Create an API key to start using the Ads.txt Generator API.

Rather use it in your browser? Open the Ads.txt Generator