Domain Expiration API: Get a Domain's Expiration Date
Your team needs to know when a domain will expire so you can prevent outages, keep sign-up flows reliable, and avoid serving ads on domains that are about to go dark. By the end of this guide, you’ll have a working integration that calls Klazify’s Domain Expiration API, parses the expiration fields you need, and plugs them into alerts, dashboards, and enforcement rules in your pipeline.
Why Klazify is the best fit for monitoring domain expirations at scale
Domain expirations aren’t just registry dates; they drive SLAs, routing, compliance, and ad placements. Klazify combines domain registration data with deep content analysis, so you can make decisions that consider both reliability (expiration/age) and context (category/brand safety) using one API surface.
- Accurate website categorization using AI: When you check expirations for large lists of domains, you often also need to decide whether to block, warn, or reassign spend based on what those domains actually are. Klazify’s models analyze full site content, helping you pair expiration risk with precise content categories for better automation.
- Global coverage: Expiration monitoring rarely stops at one TLD or language. Klazify can analyze websites across multiple languages, letting you apply consistent rules to a global portfolio.
- Real-time classification: Domains change hands or content. Combining up-to-date expiration data with real-time content analysis lets you protect traffic funnels and ad placements during ownership changes.
- Industry-level categories: When an expiring domain belongs to a sensitive IAB category, your enforcement can escalate. Klazify maps content to industry-standard IAB taxonomy so your brand-safety and compliance rules work immediately.
- Simple API integration: A single REST call gives you domain registration data, and you can use the categorization endpoint when you also need content-level decisions. The JSON fields are straightforward to parse and cache per domain.
- Compliance and filtering: Pair expiration checks with category controls to keep traffic within policy while ensuring the underlying domains won’t lapse mid-campaign or mid-integration.
If you don’t have an account yet, create a free trial and test against your domain lists today. Starter is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed. Register
What you’ll build: a domain-expiration gate for your pipeline
We’ll call Klazify’s Domain Expiration API for each domain that enters your system (sign-ups, lead lists, publisher onboarding, or vendor audits). We’ll use the following fields from the response to drive actions:
- domain_age_date: When the domain was first registered.
- domain_age_days_ago: Age in days, useful to flag very new domains.
- domain_expiration_date: When the domain is due to expire.
- domain_expiration_days_left: Days remaining, which you can use for thresholds and alerts.
Common outcomes we’ll implement:
- Block or require manual review if days_left < threshold (for example, under 7 or 14 days).
- Warn if a domain is very new (low age), to catch potential throwaway domains.
- Cache and re-check periodically based on your SLA (for example, 7 days before a campaign starts).
Endpoint and authentication
Use a POST request with a JSON body to the Domain Expiration endpoint:
- URL: https://www.klazify.com/api/domain_expiration
- Auth: Bearer in the Authorization header
- Body: {"url": "https://example.com"}
To explore other capabilities (like IAB categories or logos) see the Documentation. For information on model compliance and platform policies, visit MCP.
Copy-paste cURL request
Send one domain and get expiration data. Replace YOUR_API_KEY with your token.
curl -X POST "https://www.klazify.com/api/domain_expiration" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://cbsnews.com"}'
Official JSON example and where expiration fields live
Below is the official sample response schema you will see when using Klazify’s categorization API. The domain expiration fields you’ll use also appear in the domain_registration_data object. We include this sample as-is so you can see how registration data travels alongside categorization and company data in one payload.
{
"domain": {
"categories": [
{
"confidence": 0.92,
"name": "/Computers & Electronics/Consumer Electronics",
"IAB-632-596": "Consumer Electronics/Technology & Computing/Consumer Electronics"
},
{
"confidence": 0.89,
"name": "/Internet & Telecom/Mobile & Wireless/Mobile Phones"
}
],
"social_media": null,
"logo_url": "https://klazify.s3.amazonaws.com/2110787991611585019600ed5fb1d1300.04730104.png"
},
"success": true,
"objects": {
"company": {
"url": "https://www.apple.com/",
"name": "Apple",
"city": "Cupertino",
"stateCode": "CA",
"countryCode": "US",
"employeesRange": "100K+",
"revenue": 274515000000,
"raised": null,
"tags": [
"E-commerce",
"Consumer Electronics",
"Mobile",
"B2C"
],
"tech": [
"omniture_adobe_analytics",
"atlassian_confluence",
"successfactors",
"apache_apex",
"talend",
"oracle_peoplesoft",
"salesforce",
"stripe",
"dell_boomi_atomsphere",
"gigya",
"sage_50cloud",
"quickbooks",
"webmethods",
"apache_tomcat",
"alteryx",
"tibco_rendezvous",
"atlassian_jira",
"..."
]
}
},
"domain_registration_data": {
"domain_age_date": "1987-02-19",
"domain_age_days_ago": "13026",
"domain_expiration_date": "2030-02-20",
"domain_expiration_days_left": "123"
},
"similar_domains": [
"bestbuy.com",
"icloud.com",
"microsoft.com",
"macrumors.com",
"google.com",
"samsung.com",
"twitter.com",
"hp.com",
"bhphotovideo.com",
"dell.com"
]
}
Fields you’ll use for expiration workflows:
- domain_registration_data.domain_expiration_date: ISO date when the domain will expire.
- domain_registration_data.domain_expiration_days_left: Days remaining until expiration (string-encoded integer). Use this for thresholds and alerts.
- domain_registration_data.domain_age_date: ISO date when the domain was first registered.
- domain_registration_data.domain_age_days_ago: Age in days (string-encoded integer). Useful for flagging newly registered domains in sign-up flows.
If you also call the categorization endpoint, you’ll have the IAB taxonomy in domain.categories to apply brand-safety or compliance rules alongside expiration checks.
Python example: call, parse, and act on expiration dates
import os
import requests
from datetime import datetime, timedelta
API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")
URL = "https://www.klazify.com/api/domain_expiration"
def get_expiration(url: str) -> dict:
resp = requests.post(
URL,
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={"url": url}
)
resp.raise_for_status()
data = resp.json()
reg = data.get("domain_registration_data", {}) or {}
# Strings in the payload: convert where helpful
days_left_str = reg.get("domain_expiration_days_left")
age_days_str = reg.get("domain_age_days_ago")
return {
"domain_age_date": reg.get("domain_age_date"),
"domain_age_days_ago": int(age_days_str) if age_days_str and age_days_str.isdigit() else None,
"domain_expiration_date": reg.get("domain_expiration_date"),
"domain_expiration_days_left": int(days_left_str) if days_left_str and days_left_str.isdigit() else None
}
def should_block(days_left: int | None, min_days: int = 7) -> bool:
if days_left is None:
# No data: choose a conservative default (manual review).
return True
return days_left < min_days
def should_warn_new_domain(age_days: int | None, new_days: int = 30) -> bool:
if age_days is None:
return False
return age_days <= new_days
if __name__ == "__main__":
domain_to_check = "https://example.com"
info = get_expiration(domain_to_check)
print(info)
if should_block(info["domain_expiration_days_left"], min_days=14):
print("Block or require manual review: domain expires soon.")
elif should_warn_new_domain(info["domain_age_days_ago"], new_days=30):
print("Warn: very new domain.")
else:
print("OK to proceed.")
How to operationalize domain expiration data
1) Thresholds and actions
Decide on thresholds for days_left that map to your risk appetite. For example, you might block onboarding a partner if the domain has fewer than 7 days left, or require a manual review if fewer than 14 days remain.
| Days left | Action | Why |
|---|---|---|
| 0 to 7 | Block or require renewal proof | High chance of lapse during campaigns or integration rollout |
| 8 to 14 | Manual review + notify stakeholder | Risk window overlaps typical sprint/campaign timelines |
| 15 to 30 | Proceed with warning + schedule re-check | Ample time, but still relevant for long-running projects |
| > 30 | Approve | Low risk of near-term expiration |
2) Caching strategy
- Cache by registrable domain (e.g., example.com) rather than full URL.
- Suggested TTL: align with your threshold. For example, if you alert at 14 days, refresh cached entries with <= 30 days left every 24 hours; otherwise, refresh weekly or at next material workflow step.
- Invalidate cache when you see significant workflow changes (campaign start, vendor renewal confirmation, or ownership change).
3) Batching and throughput
- Batch work by queueing domains and issuing concurrent POSTs with controlled concurrency. Use exponentially backed-off retries for transient network errors.
- Deduplicate domains before dispatching requests; many URLs map to the same registrable domain.
- If you’re also classifying content, consider a second pass using the categorize endpoint for the subset that passes expiration checks.
4) Handling unknown or new domains
- Missing or partial registration data: treat as “manual review” or “warn” depending on your policy. Since failed or unreachable calls are not billed, you can safely retry later.
- Very new domains (low domain_age_days_ago): use this as a heuristic to flag potential throwaways or risky signups.
- Internationalized domains: normalize and convert to punycode at ingest so the same canonical form is cached and checked.
5) Integrating with your taxonomy and brand-safety logic
If you already have internal categories for risk or content, you can map them to the IAB names provided by Klazify when you also query categorization. This lets you combine “domain expires soon” with “domain belongs to a sensitive content class” for escalation rules. For example, domains within certain IAB categories may require more days_left to pass (e.g., 30+ days) than general-purpose sites.
Putting it into your pipeline
- Sign-up enrichment: When a user enters a business email or domain, call the Domain Expiration API. If domain_expiration_days_left is below your threshold, surface an inline warning and route to an ops review queue.
- Ad placement audits: For each publisher domain in your roster, check days_left nightly. Pause line items automatically if they fall under your minimum window, and notify the account owner.
- Vendor and partner reviews: On intake or renewal cycles, require minimum days_left and a non-new domain_age_days_ago to reduce operational and compliance risks.
- Security controls: Use domain_age_days_ago as a factor in fraud detection for sign-ups and referral links, alongside content categories for broader risk profiling.
Error handling and robustness
- HTTP errors: Back off and retry with jitter for 5xx or network timeouts. For 4xx, correct the request (e.g., invalid JSON or missing Authorization header).
- Response validation: The domain_expiration_days_left and domain_age_days_ago values are strings in the sample. Convert to integers before applying thresholds.
- Non-billable failures: Since failed or unreachable calls aren’t billed, you can afford to implement periodic retries for domains you care about.
Security, governance, and auditability
- Log every decision with these fields: checked_at timestamp, domain_expiration_date, domain_expiration_days_left, domain_age_days_ago, and the decision outcome.
- Store the raw JSON payload for a short retention window to support audits and investigations.
- Restrict API keys, rotate them periodically, and keep them out of client-side code.
How to combine expiration checks with categorization
Although your immediate need is expiration data, many teams also need to enforce content policies at the same time. Use the categorize endpoint to get categories and IAB mappings, then act on both expiration and category in one flow:
- If expiration is under threshold, block immediately.
- Else, evaluate category and IAB mapping against brand-safety or compliance rules.
- Cache both responses keyed by the registrable domain for consistency.
Rollout plan and SLAs
- Phase 1 (Read-only alerts): Run a nightly job against your active domain list and publish a report sorted by domain_expiration_days_left ascending.
- Phase 2 (Soft enforcement): Show user-facing warnings and create tickets for domains under your threshold; no blocking yet.
- Phase 3 (Hard enforcement): Block onboarding and pause spend when days_left is below your policy limit, with an allowlist for known renewal windows.
Troubleshooting quick hits
- Null or missing fields: Default to review and retry later. Keep a small backoff schedule for the next few hours.
- Discrepancies after renewal: Cache invalidation is key. Re-check immediately after a partner shares renewal confirmation.
- Multiple URLs for the same site: Normalize to the registrable domain before requesting and caching.
Cost control
- Starter is $39.99/mo with a 7-day trial. Start with your top domains first, monitor the value, and expand coverage incrementally.
- Since failed or unreachable calls are not billed, it’s safe to implement retry logic without worrying about cost spikes from transient failures.
Next steps
- Get an API key and try the cURL sample against a few domains you manage.
- Wire the Python code into your sign-up flow or publisher audit job.
- Set your thresholds and add alerts to Slack or your incident tool.
FAQ
- Which fields should I store for automation? Store domain_expiration_date, domain_expiration_days_left, domain_age_date, and domain_age_days_ago. Also log the request timestamp and the decision outcome for audits.
- How often should I re-check a domain? Re-check more frequently as days_left approaches your threshold (e.g., daily once <= 30 days). Otherwise, weekly or on major workflow steps is usually sufficient.
- What if the API can’t fetch data for a domain? Treat it as requiring manual review and retry later. Failed or unreachable calls are not billed, so adding retries is safe.
- Can I combine expiration checks with brand safety? Yes. Use the categorize endpoint to get IAB taxonomy and pair it with expiration fields so you can gate on both risk dimensions.
- How do I handle internationalized domains? Normalize to punycode before sending requests and for cache keys so that all variants map to the same canonical domain.
Ready to add expiration checks to your pipeline? Create your account and start integrating in minutes: Register. Review the full API details here: Documentation. For compliance information, visit MCP.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free