API Documentation

Adstxt.com API is a wholesale replacement for running your own ads.txt crawler.

Our API is designed to save you weeks of development time and maintenance headaches. You can view the full API documentation below. If you would like additional information or to request demo, please contact us.

Authentication

All API endpoints require a valid API token. To get an API token, login or register, then create an API token. Your API token should be provided as a GET parameter called api_token with all API requests.

Once you have obtained your API key, add the following line to the end of all API URLs. Replace "[YOUR_API_TOKEN]" with your token.

?api_token=[YOUR_API_TOKEN]

Publishers API

Our publishers API endpoint allows you to check a publisher domain's ads.txt file instantly. Our system is updated daily. If we do not the latest information for a publisher in our system, you can submit the domain to be crawled.

This API does not crawl the web in real-time. If you are interested in our real-time crawl API, please contact us.
Example Request
https://api.adstxt.com/v1/publishers/espn.com
Example Response
{
    "domain": "nytimes.com",
    "records": [
        {
            "ad_domain": "openx.com",
            "publisher_id": "539936340",
            "relationship": "DIRECT",
            "cid": null
        },
        {
            "ad_domain": "openx.com",
            "publisher_id": "539052954",
            "relationship": "DIRECT",
            "cid": null
        },
        ...
    ],
    "contacts": [],
    "subdomains": []
}

Ads.txt Aggregate Download API

This endpoint allows you to download our entire ads.txt aggregate file to process the data locally.

This API has 3 steps:

  1. List the available files
  2. Get the download URL for a particular file
  3. Download the file!
The aggregate files is very large, containing tens of millions of records.
Step 1: List Files
https://api.adstxt.com/v1/downloads/list
Example Response
{
    "prefix": "2019/03/31/03/38/",
    "last_updated": "Sun, 31 Mar 2019 03:38:00 +0000",
    "files": [
        {
            "file": "2019/03/31/03/38/contacts.csv.gz",
            "size": 90713
        },
        {
            "file": "2019/03/31/03/38/diff.txt.gz",
            "size": 1901677
        },
        {
            "file": "2019/03/31/03/38/md5.txt",
            "size": 325
        },
        {
            "file": "2019/03/31/03/38/records.csv.gz",
            "size": 149902945
        },
        {
            "file": "2019/03/31/03/38/subdomains.csv.gz",
            "size": 7243
        }
    ]
}
Step 2: Get Temporary Download URL
https://api.adstxt.com/v1/download/get-temporary-url?file=2019/03/31/03/38/diff.txt.gz
Example Response
{
    "file": "2019/03/31/03/38/diff.txt.gz",
    "temporary_url": "https://adstxt-export.s3.us-west-2.amazonaws.com/2019/03/31/03/38/diff.txt.gz?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJFLM55QHQBRFIXHQ%2F20190401%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20190401T033421Z&X-Amz-SignedHeaders=host&X-Amz-Expires=60&X-Amz-Signature=887ca2b1b3441a754ac6d0582e24fc5086d559a8542913811290dc90c1e84221"
}
Step 3: Download the file

Once you get the temporary download URL you must start your download within 60 seconds.