Integrate the Company Revenue API in Python

November 23, 2026
Integrate the Company Revenue API in Python

You’re building a Python enrichment step that turns a raw domain (for example, from a signup form or lead list) into actionable company attributes like name, location, employeesRange, revenue, raised, and tags. By the end of this guide, you’ll be able to call Klazify’s Company data endpoint from Python, parse the revenue range and size fields you need, and integrate them into your pipeline with caching, batching, and resilient error handling.

Why Klazify is the right fit for revenue and size enrichment

When your goal is to augment domains with company-level signals—especially revenue ranges and employee ranges—you need accurate identification of the entity behind each domain and consistent fields you can standardize in your data model. Klazify focuses on domain intelligence and content understanding, which makes the downstream business data (revenue range, employeesRange, location, tags) more reliable because the domain-to-company match is strong.

Illustration: Integrate the Company Revenue API in Python
  • Accurate website categorization supports enrichment: Klazify analyzes on-site content, improving the precision of the company match behind a URL so revenue and employeesRange are tied to the right entity.
  • Global coverage matters for multinational leads: Analyze domains in multiple languages so you can assign revenue ranges and sizes consistently across regions.
  • Real-time classification helps with fast-changing companies: Fresh content analysis reduces stale matches that could mis-attribute size or tags.
  • IAB taxonomy alignment: When you enrich with revenue and employeesRange, you can also pull categories mapped to IAB, enabling unified reporting across marketing and ad tech systems.
  • Simple, developer-friendly REST model: One POST to retrieve company fields from a domain; straightforward to call from ETL, serverless functions, or ingestion services.
  • Compliance and filtering: Accurate categories help you apply brand safety or content filtering logic while you enrich records with business-relevant attributes like tags and revenue ranges.

If you’re enriching leads, gating trials by company size, prioritizing outreach by revenue range, or flagging accounts for territory routing, Klazify’s domain-to-company resolution and consistent response format are well-suited for production workflows.

What you’ll build

We’ll implement a Python function that calls Klazify’s Company data API, parses company fields (name, city, stateCode, countryCode, employeesRange, revenue, raised, tags), and returns a normalized object you can write into your CRM, data warehouse, or CDP. We’ll also cover batching, caching, fallback behavior for unknown domains, and taxonomy mapping for IAB categories if you also consume classification output.

Prerequisites and account setup

Create a free Klazify account to get your API key. The Starter plan is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed. You can sign up here:

Explore the API reference and model catalog for available endpoints and fields:

You can also visit the homepage to learn more about domain intelligence and enrichment: https://www.klazify.com.

Endpoint and request format

Use the Company data endpoint to resolve a domain into company attributes, including revenue and employeesRange.

  • HTTP method: POST
  • URL: https://www.klazify.com/api/domain_company
  • Auth: Bearer token in the Authorization header
  • Body: JSON with a single key url whose value is the website you want to enrich

cURL example

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"}'

Replace YOUR_API_KEY with your token from your Klazify account. Failed or unreachable calls are not billed.

Python integration for company revenue and size

The snippet below posts a domain to the API, reads the company object, and returns a normalized set of fields you can persist or use for routing. It includes basic retries, null handling, and a place to plug in your cache.

import os
import time
import json
import requests
from typing import Any, Dict, Optional

KLAZIFY_API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")
ENDPOINT = "https://www.klazify.com/api/domain_company"
TIMEOUT = 15  # seconds

# Simple in-memory cache; replace with Redis/Memcached for production.
_cache: Dict[str, Dict[str, Any]] = {}

def fetch_company_from_domain(domain_url: str, max_retries: int = 2, backoff: float = 0.5) -> Optional[Dict[str, Any]]:
    if domain_url in _cache:
        return _cache[domain_url]

    payload = {"url": domain_url}
    headers = {
        "Authorization": f"Bearer {KLAZIFY_API_KEY}",
        "Content-Type": "application/json",
    }

    attempt = 0
    while True:
        try:
            resp = requests.post(ENDPOINT, headers=headers, json=payload, timeout=TIMEOUT)
            # Handle non-2xx without assuming specific error codes
            if resp.status_code // 100 != 2:
                # Backoff on transient errors; stop on client errors
                attempt += 1
                if attempt > max_retries or resp.status_code == 400:
                    return None
                time.sleep(backoff * attempt)
                continue

            data = resp.json()

            # Defensive parsing depending on response shape
            company = None
            if isinstance(data, dict):
                # Primary shape: {"objects": {"company": {...}}}
                company = (
                    data.get("objects", {})
                        .get("company", None)
                ) or data.get("company")  # Fallback if top-level

            if not company:
                return None

            # Normalize the fields your pipeline needs
            normalized = {
                "url": company.get("url"),
                "name": company.get("name"),
                "city": company.get("city"),
                "stateCode": company.get("stateCode"),
                "countryCode": company.get("countryCode"),
                "employeesRange": company.get("employeesRange"),
                # revenue is a range per API description; treat it as opaque string/number
                "revenue": company.get("revenue"),
                "raised": company.get("raised"),
                "tags": company.get("tags") or [],
            }

            # Cache result to reduce duplicate requests
            _cache[domain_url] = normalized
            return normalized

        except requests.RequestException:
            attempt += 1
            if attempt > max_retries:
                return None
            time.sleep(backoff * attempt)

if __name__ == "__main__":
    result = fetch_company_from_domain("https://cbsnews.com")
    print(json.dumps(result, indent=2, ensure_ascii=False))

Notes:

  • revenue is designed for prioritization and routing; handle it as a range or opaque value without assuming precision.
  • Cache results per domain_url to reduce latency and cost. A 1–7 day TTL is common for enrichment, but choose what aligns with your update needs.
  • If result is None, handle unknown or newly observed domains by deferring enrichment, flagging for re-try, or passing through without size-based automation.

Example JSON response and field usage

This is the official sample JSON showing how company data and categorization can be returned in a single payload. Use these fields directly in your enrichment mapping.


{
    "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 the fields:

  • objects.company.name, url: Normalize your Account/Company names and link to the canonical site.
  • objects.company.city, stateCode, countryCode: Geographical routing and territory assignment.
  • objects.company.employeesRange: Useful for ICP fit, lead scoring, and queue routing.
  • objects.company.revenue: Use as a range-like indicator for pipeline prioritization and SLAs. Store as provided; do not assume currency or precision beyond the API value.
  • objects.company.raised: Funding context; can refine outreach strategy.
  • objects.company.tags: Business tags for segmentation or model features.
  • domain.categories[].name, domain.categories[]."IAB-...": Content categories you can map into IAB-based workflows (brand safety, audience matching, ad placement control).
  • domain.logo_url: Display in CRM/BI for quick visual context.
  • domain_registration_data: Dates are ISO-format. Can be used for heuristics like “newly registered” vs. “established.”
  • similar_domains: Drive deduplication and research or competitive clustering.

Schema mapping: from Klazify to your data model

Adopt a clear schema that preserves raw values and normalized variants as needed. Below is a simple mapping suggestion you can adapt:

Klazify field Suggested target field Notes
objects.company.url company.website Use canonical URL as a unique reference alongside the domain you queried.
objects.company.name company.name Keep a raw and a normalized variant for dedupe.
objects.company.city company.location.city String; don’t coerce prematurely.
objects.company.stateCode company.location.region_code Two-letter codes where applicable.
objects.company.countryCode company.location.country_code Store ISO alpha-2 code.
objects.company.employeesRange company.size.bucket Preserve original bucket; optionally map to your own tiers.
objects.company.revenue company.revenue.bucket Treat as an enrichment range/value; do not attempt precision math unless your workflow requires it.
objects.company.raised company.funding.total Store raw value and update strategy as needed.
objects.company.tags[] company.tags[] Keep an array and derive normalized tags if needed.
domain.categories[].name content.category.path Useful for brand safety, routing, and analytics.
domain.categories[].IAB-… content.category.iab_mapped Map to your IAB strategy.

Operational guidance: batching, caching, and error handling

  • Batching at the client: If you have a large list, group domains into batches and call sequentially or with limited concurrency to respect rate limits. Persist progress to resume on failures.
  • Caching: Cache per domain (keyed by the requested URL). Choose a TTL that balances freshness with cost—commonly days to a week for enrichment workflows. Bust the cache if your system sees contradictory data.
  • Retries and timeouts: Use short timeouts and exponential backoff for transient network errors. Avoid infinite retries. Failed or unreachable calls are not billed.
  • Unknown or new domains: If a domain returns incomplete data, queue it for recheck later or allow a “pending enrichment” state in your pipeline. Keep your workflows functional without blocking on enrichment.
  • Normalization: Preserve original API values in raw fields alongside normalized forms. This safeguards you against future changes in bucketing or interpretation.
  • Observability: Log the request domain, status code family, and whether the response included objects.company. Add counters for cache hits/misses and enrichment coverage over time.

Combining company enrichment with categorization

Many teams use revenue and employeesRange for routing and scoring, while relying on categorization and IAB mapping for brand safety, targeting, or inventory analysis. You can retrieve both types of data and store them side by side. The example JSON above illustrates how categories and company objects can co-exist in one response model you can integrate into your pipeline without branching logic.

When mapping categories to your own taxonomy, keep a lookup table keyed on domain.categories[].name or the provided IAB-mapped string and translate to your internal labels. For business logic (block, allow, prioritize), condition on those internal labels to decouple downstream code from external taxonomy changes.

Security, performance, and data care

  • API keys: Store the Bearer token in a secret manager. Never hardcode in source control.
  • Throughput: Use connection pooling (requests.Session in Python) for bulk jobs. Throttle concurrency based on your observed limits.
  • Idempotency: Enrichment is read-only; safe to retry. De-duplicate domains before calling to avoid redundant lookups.
  • Data type hygiene: Treat revenue and employeesRange as categorical. Don’t coerce or transform unless your logic requires it.
  • Dates and time: domain_registration_data fields are ISO-style date strings. Store as strings or parse carefully and keep original values.

Billing and plan notes

  • Starter plan: $39.99/mo with a 7-day trial. Good for initial integrations and small-to-medium jobs.
  • Failed or unreachable calls are not billed, making retries safe when the network is unreliable.
  • Monitor call volume and cache aggressively to keep costs predictable.

Putting it all together in a workflow

  1. Collect domains from your source (signup, CSV import, CRM sync).
  2. De-duplicate and filter out obviously invalid inputs.
  3. For each domain, check your cache; if missing, POST to https://www.klazify.com/api/domain_company with the url payload.
  4. Parse objects.company fields:
    • name, url for identity
    • city, stateCode, countryCode for routing
    • employeesRange, revenue for sizing and priority
    • raised, tags for sales and marketing cues
  5. Optionally map domain.categories to your own taxonomy (IAB-aligned) for brand safety or segmentation.
  6. Write normalized fields and the raw JSON to your warehouse. Emit metrics for coverage and enrichment success rate.

FAQ

How should I interpret revenue?
Treat revenue as a range-like enrichment value used for scoring, routing, and prioritization. Store it as provided and avoid assuming precision or currency conversions unless your process requires it.

What if the API can’t reach a site or returns partial data?
Failed or unreachable calls are not billed. Implement retries with backoff, and if still unavailable, mark the record as “pending enrichment” and re-try later. Keep your pipeline non-blocking.

Can I align categories with my internal labels?
Yes. Maintain a mapping table from domain.categories (or IAB-mapped strings) to your internal taxonomy. Version this mapping and log which version was applied per record.

How can I run this at scale?
Batch domains, limit concurrency, and cache results with a sensible TTL. Use connection pooling and track request outcomes to tune throughput. Monitor coverage and hit rates.

Where do I find field definitions and updates?
Refer to the Documentation and model catalog in the MCP for endpoint shapes and fields.

Ready to enrich your pipeline with company revenue and size using Python? Create your account and get an API key today: Register. Learn more about Klazify at https://www.klazify.com.

Ready to use Klazify?

Start classifying websites, enriching company data, and exploring web intelligence.

Get Started Free