Rate Limits

DomainKit uses rate limiting to ensure fair usage and API stability.

Current Limits

Limit Value
Requests per minute 60
Scope Per IP address

Note: Authentication is not currently required. All requests are rate-limited by IP address.

Rate Limit Headers

Every response includes rate limit information:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 1704067200
Header Description
X-RateLimit-Limit Maximum requests per minute
X-RateLimit-Remaining Requests remaining in current window
X-RateLimit-Reset Unix timestamp when the limit resets

Handling Rate Limits

When you exceed the rate limit, you’ll receive a 429 response:

{
  "error": "rate_limit_exceeded",
  "message": "Too many requests. Please retry after 60 seconds."
}

The response also includes a Retry-After header indicating seconds to wait.

Best Practices

  1. Check headers — Monitor X-RateLimit-Remaining proactively
  2. Implement backoff — Use exponential backoff on 429 responses
  3. Cache results — Domain availability rarely changes instantly
  4. Batch requests — Check multiple TLDs in a single call by omitting tld

Example: Exponential Backoff

import time
import requests

def check_domain_with_retry(name, max_retries=3):
    for attempt in range(max_retries):
        response = requests.get(
            "https://api.domainkit.bot/check",
            params={"name": name}
        )
        
        if response.status_code == 429:
            retry_after = int(response.headers.get("Retry-After", 60))
            wait_time = retry_after * (2 ** attempt)
            print(f"Rate limited. Waiting {wait_time}s...")
            time.sleep(wait_time)
            continue
            
        return response.json()
    
    raise Exception("Max retries exceeded")

Example: Checking Rate Limit Headers

import requests

response = requests.get(
    "https://api.domainkit.bot/check",
    params={"name": "example"}
)

remaining = int(response.headers.get("X-RateLimit-Remaining", 0))
limit = int(response.headers.get("X-RateLimit-Limit", 60))

print(f"Requests remaining: {remaining}/{limit}")

if remaining < 10:
    print("Warning: Running low on rate limit")

Optimizing API Usage

Use Bulk Checks

Instead of making separate requests for each TLD:

# ❌ Inefficient: 3 requests
curl "https://api.domainkit.bot/check?name=example&tld=com"
curl "https://api.domainkit.bot/check?name=example&tld=io"
curl "https://api.domainkit.bot/check?name=example&tld=dev"

# ✓ Efficient: 1 request (checks all TLDs)
curl "https://api.domainkit.bot/check?name=example"

Cache Results

Domain availability doesn’t change frequently. Cache results for a reasonable duration:

import time

cache = {}
CACHE_TTL = 300  # 5 minutes

def check_cached(name):
    cache_key = name
    now = time.time()
    
    if cache_key in cache:
        data, timestamp = cache[cache_key]
        if now - timestamp < CACHE_TTL:
            return data
    
    response = requests.get(
        "https://api.domainkit.bot/check",
        params={"name": name}
    )
    data = response.json()
    cache[cache_key] = (data, now)
    return data

Need Higher Limits?

If you need higher rate limits for your application, please contact us to discuss enterprise options.