How to Get Estimated Revenue in Python
You need to enrich a domain in your Python pipeline with an estimated company revenue so you can score leads, prioritize accounts, or segment customers. By the end of this guide you will call a single endpoint, parse the company payload, and store an estimated revenue along with location, size, and tags to power routing, analytics, and product logic.
Why Klazify is a great fit for estimated revenue enrichment
Enriching revenue reliably depends on accurate identification of the company behind a domain, consistent coverage across regions, and a response that plays well with production pipelines. Klazify’s domain intelligence API is built for classification and company enrichment at scale, which makes it practical when all you have is a URL or email domain and you need an estimated revenue to drive decisions.
- Accurate company detection and categorization: Klazify analyzes full site content and metadata to link a domain to the correct organization, enabling you to attach a revenue estimate to the right entity (not just the web property).
- Global coverage: Multi-language site analysis and international location fields (city, stateCode, countryCode) help you enrich domains from different regions with consistent formats.
- Real-time calls: You can query the API on-demand rather than relying on a static dump, keeping revenue and size estimates in sync with your workflow.
- IAB taxonomy and tags: While this article focuses on revenue, you can pair the estimate with standardized IAB categories and business tags when you also use the categorization endpoint, improving downstream targeting or filtering.
- Simple REST integration: A single POST to a dedicated company endpoint returns name, employeesRange, revenue, raised, and tags—everything needed to classify and route a lead in Python.
- Compliance and filtering: Combine revenue tiers with categories to enforce routing rules, lead acceptance criteria, or ad safety policies with less custom logic.
If you’re new, create a free account at https://www.klazify.com and review the Documentation for all parameters and fields.
What you will build: enrich a domain with estimated revenue in Python
The flow is straightforward:
- Accept a domain or URL from your app (for example, during signup).
- POST it to the company enrichment endpoint.
- Extract name, city, stateCode, countryCode, employeesRange, revenue (estimated), raised, and tags.
- Map the revenue to your internal tiers (e.g., SMB, Mid-market, Enterprise) and store alongside the account.
- Cache by domain to avoid duplicate calls and reduce latency.
Make the company enrichment request
Use the company endpoint to pull organization fields directly from a domain. Authentication is via Bearer token. Failed or unreachable calls are not billed.
curl -X POST "https://www.klazify.com/api/domain_company" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://cbsnews.com"}'
Notes:
- Send the full URL or the bare domain; Klazify will resolve to the company record.
- On success, read the company object and specifically the fields you care about for enrichment: name, location, employeesRange, revenue, raised, tags.
- Network failures or unreachable targets won’t incur charges, so you can safely retry with backoff.
Official response format you should expect
Below is the official example payload format you’ll encounter when using Klazify’s domain intelligence. It includes categorization data and a company object with the fields this guide uses.
{
"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"
]
}
How to use these fields in enrichment:
- objects.company.name: Store as the display name for the account.
- objects.company.city, stateCode, countryCode: Normalize for geo routing, SLAs, or territory assignment.
- objects.company.employeesRange: Use as a size proxy when revenue is unknown or to validate segment rules.
- objects.company.revenue: Treat as an estimate for the company’s revenue; use it to assign a revenue tier or drive scoring. Do not treat it as an audited exact amount.
- objects.company.raised: If present, indicates capital raised; helpful for prioritizing growth accounts.
- objects.company.tags: Useful for industry or business model segmentation.
- domain.categories and IAB mapping: When you also need brand safety or targeting, align content categories to your policy engine.
Python example: request, parse, and map to revenue tiers
This Python snippet shows how to call the endpoint, handle basic failures, and normalize the revenue field into tiers you can store. Adjust the tier logic to your internal definitions.
import os
import time
import json
import requests
API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")
API_URL = "https://www.klazify.com/api/domain_company"
def fetch_company(domain_url, retries=2, timeout=10):
payload = {"url": domain_url}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
}
for attempt in range(retries + 1):
try:
resp = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
# Unreachable or other failures are not billed; consider retry with backoff
if resp.status_code >= 500 and attempt < retries:
time.sleep(2 ** attempt)
continue
resp.raise_for_status()
return resp.json()
except requests.RequestException as e:
if attempt == retries:
raise
time.sleep(2 ** attempt)
def revenue_to_tier(revenue_value):
# Treat revenue as an estimate. Customize thresholds to your business logic.
# If revenue_value is None, return "unknown".
if revenue_value is None:
return "unknown"
try:
# If the API provides a numeric estimate, use it directly.
r = float(revenue_value)
if r < 10000000: # < $10M
return "SMB"
elif r < 1000000000: # $10M - < $1B
return "Mid-market"
else: # ≥ $1B
return "Enterprise"
except (TypeError, ValueError):
# If the API returns a non-numeric representation (e.g., "10M-50M"),
# parse accordingly or handle as a tiered string.
s = str(revenue_value).lower()
if "m" in s or "-" in s:
return "Mid-market" # Simplified; replace with your parser if needed
return "unknown"
def enrich(domain_url):
data = fetch_company(domain_url)
company = (data or {}).get("objects", {}).get("company", {})
enriched = {
"domain_url": domain_url,
"name": company.get("name"),
"location": {
"city": company.get("city"),
"stateCode": company.get("stateCode"),
"countryCode": company.get("countryCode"),
},
"employeesRange": company.get("employeesRange"),
"revenue_estimated": company.get("revenue"),
"revenue_tier": revenue_to_tier(company.get("revenue")),
"raised": company.get("raised"),
"tags": company.get("tags") or [],
}
return enriched
if __name__ == "__main__":
result = enrich("https://cbsnews.com")
print(json.dumps(result, indent=2))
Implementation notes:
- Use exponential backoff for transient timeouts or 5xx errors; unreachable calls are not billed.
- Cache the response by domain URL or eTLD+1 for 24 hours (or whatever fits your SLA) to reduce latency and cost.
- Normalize revenue to a numeric estimate or a tier for simpler downstream logic. If the field is a non-numeric representation, fall back to string parsing and a tier-based approach.
Field mapping: from API to your data model
The following table shows how teams commonly map Klazify fields into their CRM or internal models focused on revenue enrichment.
| Klazify field | Type | Usage in pipelines | Example storage |
|---|---|---|---|
| objects.company.name | string | Account display name | accounts.name |
| objects.company.city | string | Geo routing / SLA | accounts.city |
| objects.company.stateCode | string | Geo routing / tax | accounts.state |
| objects.company.countryCode | string (ISO) | Regional policies | accounts.country_code |
| objects.company.employeesRange | string | Size proxy if revenue missing | accounts.employees_range |
| objects.company.revenue | estimated | Lead scoring, tiering | accounts.revenue_est |
| objects.company.raised | number or null | Growth signal | accounts.capital_raised |
| objects.company.tags | array | Industry / ICP mapping | accounts.tags (JSON) |
Operational details that save time in production
Batching and throughput
If you enrich many domains, send requests concurrently with bounded workers to respect service limits and your own timeouts. Group domains by priority (e.g., new signups first, backlog later). For dynamic workloads, maintain a small in-memory LRU cache to prevent duplicate calls during bursts.
Caching strategy
- Key by eTLD+1 (example.com) to avoid duplicates across subdomains.
- Set a TTL that balances freshness with cost/latency (e.g., 1 to 7 days depending on your SLA).
- Invalidate on key lifecycle events (e.g., account status changes) if you want to force refresh.
Handling unknown or new domains
- If the company object is missing or sparse, fall back to employeesRange and tags for initial routing.
- Queue a delayed retry; some domains may become classifiable after crawls update.
- Store a nullable revenue_estimated and a reason code (unknown, transient_error, missing_data) to make dashboards clear.
Revenue tiers and currency
- Treat the revenue field as an estimate, not an audited figure. Use ranges or tiers in your product logic.
- Normalize to your internal base currency. If you track revenue thresholds in USD, convert or compare consistently across workflows.
Mapping categories to your taxonomy
When you also need content-level controls (e.g., ad safety or ICP filters), read the domain.categories array and the IAB mapping in the response. Keep a mapping table from IAB paths to your own categories. That way, the same enrichment call can drive both revenue tiering and content policies.
End-to-end example scenario: enrich a signup form
Suppose your signup form captures an email at example.com. Your backend does the following:
- Extract the domain from the email and build https://example.com.
- POST to the company enrichment endpoint and parse the response.
- Write name, location, employeesRange, revenue (estimated), raised, and tags into your CRM record.
- Assign a revenue_tier via your thresholds. If “Enterprise,” route to sales; if “SMB,” auto-approve self-serve.
- Cache the result under example.com for 72 hours to keep latency predictable for repeat actions.
This approach gives you consistent, automated segmenting without manual research, and it runs inline in your Python services.
Troubleshooting and quality checks
- Null or missing revenue: Fall back to employeesRange and tags. Schedule a refresh later.
- Timeouts: Use retries with exponential backoff. Unreachable calls are not billed.
- Data drift: Periodically re-fetch high-value accounts to keep estimates in line with changes.
- Monitoring: Log response status, success flag, and the presence of key fields to detect upstream changes early.
Pricing, signup, and next steps
You can get started on the Starter plan at $39.99/mo with a 7-day trial. Create your account, generate an API key, and ship your first enrichment in a few minutes. See plan details and examples on https://www.klazify.com, then follow the docs to productionize your pipeline.
Create a free account now: Register
FAQ
Does the API return an exact revenue value?
Treat the revenue field as an estimate suitable for tiering or scoring. Use ranges or thresholds in your logic rather than expecting an audited figure.
What happens if a request fails or the site is unreachable?
Failed or unreachable calls are not billed. Implement retries with backoff and log failures so you can reprocess later.
How should I cache results?
Cache per eTLD+1 with a TTL that matches your SLA (e.g., 1–7 days). Invalidate on demand if you need fresher data for high-value accounts.
Can I combine revenue with categories for brand safety or targeting?
Yes. Use the domain.categories array and IAB mappings to enforce content policies while also applying revenue-based segmentation.
Where can I find schema details and more examples?
Check the Documentation and explore more features such as technology detection, similar domains, and domain registration data. For platform-level integrations, see MCP.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free