RTB Domains API

Intelligent bidding platform with advanced targeting and analytics

๐Ÿ” Security: Two-Key System

Your campaign uses two separate API keys for security:

Bidding Key (Public)

  • Used for the /bids/ endpoint only
  • Safe to share with traffic sources, DSPs, and ad networks
  • Grants read-only access to bidding (cannot modify domain lists)
  • Found in: Campaign Editor โ†’ "Bidding API Key"

Management Key (Private)

  • Used for domain list management (/api/v1/lists/*)
  • Keep this secret! Never share with traffic sources
  • Grants read-write access to your domain lists and analytics
  • Found in: Campaign Editor โ†’ "Management API Key" (click eye icon to reveal)

Why two keys? This prevents traffic sources from manipulating their own bidding modifiers by adding themselves to boost lists or removing competitors.

Quick Start: Bidding Endpoint

Get dynamic bid prices and destination URLs based on country, OS, browser, and traffic source.

Endpoint

GET https://app.rtbdomains.com/bids/

Required Parameters

api [REQUIRED]
Your bidding API key for authentication and campaign identification.
cc [REQUIRED]
Country code (2-letter lowercase). Examples: us, uk, ca, de
ua [REQUIRED]
User agent string (URL-encoded). The browser's full user agent string.
src [REQUIRED]
Traffic source/domain (lowercase). Example: example.com

Domain Matching & Modifiers

The bidding system supports two types of domain matching:

1. Exact Domain Matching (Lists)

Lists contain exact domain names and apply modifiers when the source domain exactly matches.

List "Premium Sites" (2x modifier)
Domains: example.com, test.com

src=example.com โ†’ List matches โ†’ 2x modifier applied
src=example.net โ†’ No match โ†’ 1x modifier (no effect)

2. Contains Pattern Matching (Pattern Rules)

Pattern Rules contain keywords and apply modifiers when the source domain contains the pattern anywhere.

Pattern Rule "Apple Boost" (1.3x modifier)
Patterns: apple, mac, iphone

src=applestore.com โ†’ Contains "apple" โ†’ 1.3x modifier
src=pineapple.com โ†’ Contains "apple" โ†’ 1.3x modifier
src=macdeals.net โ†’ Contains "mac" โ†’ 1.3x modifier
src=google.com โ†’ No match โ†’ 1x modifier

How Modifiers Stack

When multiple lists and pattern rules match, modifiers multiply together:

Base Bid: $0.10
List #1 matches (2x) + Pattern Rule matches (1.3x)
Final Bid: $0.10 ร— 2 ร— 1.3 = $0.26

Response Format

{
  "country": "us",
  "src": "example.com",
  "os": "windows",
  "browser": "chrome",
  "time": "14:30",
  "bid": 1.5,
  "url": "https://destination.com/?cpc=1.5&domain=example.com"
}

Response Fields

Field Type Description
country string Country code from request (normalized to lowercase)
src string Traffic source from request (normalized to lowercase)
os string Detected operating system
windows macos ios linux android
browser string Detected browser
chrome safari firefox edge opera facebook instagram
time string Current time in America/Phoenix timezone (H:M format)
bid number Calculated bid price (0 if no matching campaign or rules)
url string Destination URL with tokens replaced ([cpc] โ†’ bid, [domain] โ†’ source)

Example Request

GET https://app.rtbdomains.com/bids/?api=YOUR_API_KEY&cc=us&ua=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F120.0.0.0%20Safari%2F537.36&src=example.com

Error Responses

The bidding API returns specific error codes for validation failures:

Status Code Error Description
422 Missing Parameter One or more required parameters (api, cc, ua, src) is missing
400 Invalid Domain Format Source domain contains invalid characters (only letters, numbers, hyphens, dots, underscores allowed)
400 Invalid Country Code Country code must be exactly 2 letters (e.g., us, uk, ca)
200 Zero Bid Valid request but bid=0 returned (invalid API key or no matching bid rules for this traffic)

Example Error Response

{
  "error": "Invalid source domain format",
  "message": "Domain must contain only letters, numbers, hyphens, dots, and underscores"
}

Click Tracking

The url field in the bid response contains a signed tracking URL that logs actual clicks before redirecting to your destination.

How It Works

  1. User clicks the tracking URL from your bid response
  2. Request is verified (HMAC-SHA256 signature + timestamp check)
  3. Click is logged to Analytics Engine (actual spend tracking)
  4. User is redirected (301) to your destination URL

Security Features

Click Endpoint

GET https://app.rtbdomains.com/click/{signed_data}

Click Tracking Error Responses

Status Code Error Description
400 Invalid Tracking Data Malformed URL or decoding failed
403 Invalid Signature HMAC signature verification failed (possible tampering)
410 URL Expired Tracking URL is older than 5 minutes
301 Success Valid click - redirects to destination URL

Note: You don't need to call this endpoint directly. Traffic sources automatically click the URL returned in the bid response.

Features

Programmatic Reporting API

Retrieve statistics and performance data using your API key. Perfect for external dashboards and automated reporting.

Authentication

Use either your bidding key or management key as a query parameter: ?api_key=YOUR_KEY

GET /api/v1/stats

Statistics report for a SINGLE DAY aggregated by subId (source domain), detailing impressions and revenue

GET https://app.rtbdomains.com/api/v1/stats?api_key=YOUR_KEY&date=2025-11-18

Response:
{
  "success": true,
  "data": [
    {
      "subId": "example.com",
      "source": "example.com",
      "impressions": 523,
      "clicks": 15,
      "revenue": 7.50,
      "ctr": 2.87,
      "date": "2025-11-18"
    }
  ],
  "meta": {
    "date": "2025-11-18",
    "returned_sources": 15,
    "total_impressions": 2000,
    "total_clicks": 60,
    "total_revenue": 30.00,
    "filters": {
      "min_revenue": 0.0000001,
      "limit": 10000
    },
    "note": "Showing sources with revenue > $0. Use ?min_revenue=0 to include zero-revenue sources."
  }
}

Query Parameters

Error Responses

Status Code Error Description
401 Missing API Key api_key parameter is required
401 Invalid API Key API key not found or campaign inactive
500 Analytics Not Configured Analytics Engine API token not configured on server

Programmatic Domain List API

Manage domain lists programmatically using your API key. Perfect for large portfolios that need daily updates.

Authentication

Use your management API key (found in campaign settings): ?api_key=YOUR_MANAGEMENT_KEY

Endpoints

GET /api/v1/lists

List all domain lists for your campaign

GET https://app.rtbdomains.com/api/v1/lists?api_key=YOUR_KEY

Response:
{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Premium Publishers",
      "modifier": 1.2,
      "list_type": "boost",
      "domain_count": 1523
    }
  ],
  "count": 1
}

POST /api/v1/lists/{id}/domains

Add domains to a list (duplicates are skipped)

POST https://app.rtbdomains.com/api/v1/lists/1/domains?api_key=YOUR_KEY
Content-Type: application/json

{
  "domains": ["example.com", "example2.com", "example3.com"]
}

Response:
{
  "success": true,
  "message": "Added 3 domain(s), skipped 0 duplicate(s)",
  "added": 3,
  "skipped": 0
}

DELETE /api/v1/lists/{id}/domains

Remove specific domains from a list

DELETE https://app.rtbdomains.com/api/v1/lists/1/domains?api_key=YOUR_KEY
Content-Type: application/json

{
  "domains": ["example.com", "example2.com"]
}

Response:
{
  "success": true,
  "message": "Removed 2 domain(s)",
  "removed": 2
}

PUT /api/v1/lists/{id}/domains

Replace all domains in a list (full synchronization)

PUT https://app.rtbdomains.com/api/v1/lists/1/domains?api_key=YOUR_KEY
Content-Type: application/json

{
  "domains": ["newdomain1.com", "newdomain2.com", "newdomain3.com"]
}

Response:
{
  "success": true,
  "message": "Replaced list with 3 domain(s)",
  "total": 3
}

Notes

Error Responses

Status Code Error Description
401 Missing API Key api_key parameter is required
401 Invalid Management Key Invalid or inactive management API key. Use your management key (not bidding key) for domain operations.
404 List Not Found List ID doesn't exist or you don't have permission to access it
400 Invalid Request Body Missing or malformed JSON in request body (e.g., domains array required)

Support

For access to the control panel and additional features, please log in at: /login

RTB Domains - Built with Cloudflare Workers

Powered by D1, Workers KV, and Analytics Engine