Integrate the Company Name API in Python

November 21, 2026
Integrate the Company Name API in Python

Your signup form collects email and website URLs, but your ops team still has to look up the company name, location, and size by hand. In this guide, you’ll plug a single API call into your Python stack to enrich each domain with a normalized company name and firmographics, validate the result against content categories when needed, and ship it to downstream systems like your CRM or risk engine.

Why Klazify for company identification and enrichment from a URL

When you’re enriching domains at scale, you need an API that can reliably extract company identity and related signals from just a URL. Klazify analyzes full-site content and structure, which helps it resolve the correct company name and business attributes even when the homepage is sparse or marketing-heavy. That matters for deduping organizations, qualifying leads, and automating approvals.

Illustration: Integrate the Company Name API in Python
  • Accurate company identification using AI: Klazify looks beyond metadata to infer the real business entity behind a domain, which improves the odds of returning a clean company name and useful tags.
  • Global coverage: If your inbound leads are international, multi-language content analysis increases the likelihood of a match for non-English sites.
  • Real-time classification: Fresh crawls and analysis help prevent stale or rebranded company data sneaking into your pipeline.
  • Industry-level categories via IAB: You can add a brand-safety or vertical filter by cross-checking the company against content categories from the same API.
  • Simple REST integration: One POST with a URL input; return payload includes name, location, size range, revenue, funding raised, and tags that you can map to your schemas.
  • Compliance and filtering: Combine identity and IAB-aligned categories to block or approve businesses based on policy.

What you will build

You’ll add a Python function that calls Klazify’s Company endpoint to turn a URL into:

  • Company name (normalized string)
  • Location (city, stateCode, countryCode)
  • Size indicators (employeesRange, revenue, raised)
  • Business tags

We’ll also show how to optionally cross-check a domain’s content categories with the main categorization endpoint response so you can implement allow/block logic.

Endpoint you’ll use

  • Company data: POST https://www.klazify.com/api/domain_company with a JSON body containing the URL. Authenticate using a Bearer token.
  • Website categorization (optional, for content checks or taxonomy mapping): GET or POST https://www.klazify.com/api/categorize to retrieve categories, social presence, logo, tech, and similar domains. See the official sample response below.

To get access keys, create a free account: the Starter plan is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed. Start here: Register. For reference details, see the Documentation.

cURL request: fetch company data from a domain

Send a POST request with a JSON body including the target URL. Replace YOUR_API_KEY with your actual token.

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

On success, you’ll receive a JSON payload containing fields such as name, city, stateCode, countryCode, employeesRange, revenue, raised, and tags. Use these to normalize company records, enrich signups, or score leads.

Python integration: enrich, validate, and ship

The snippet below shows a minimal integration in Python. It posts a domain to the Company endpoint, checks for required fields, and returns a normalized payload that you can forward to your CRM or data warehouse.

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

KLAZIFY_TOKEN = os.getenv("KLAZIFY_TOKEN", "YOUR_API_KEY")
COMPANY_URL = "https://www.klazify.com/api/domain_company"
CATEGORIZE_URL = "https://www.klazify.com/api/categorize"

session = requests.Session()
session.headers.update({
    "Authorization": f"Bearer {KLAZIFY_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json"
})

def get_company_from_domain(url: str, retries: int = 2, backoff: float = 0.8) -> Optional[Dict[str, Any]]:
    payload = {"url": url}
    for attempt in range(retries + 1):
        try:
            resp = session.post(COMPANY_URL, data=json.dumps(payload), timeout=15)
            if resp.status_code == 200:
                data = resp.json()
                # Expected keys include: name, city, stateCode, countryCode, employeesRange, revenue, raised, tags
                return data
            elif 500 <= resp.status_code < 600:
                # transient server error; retry
                pass
            else:
                # client error; do not retry
                print(f"Non-retryable status {resp.status_code}: {resp.text}")
                return None
        except requests.RequestException as e:
            # network issue; retry
            if attempt == retries:
                print(f"Request failed after retries: {e}")
                return None
        time.sleep(backoff * (2 ** attempt))
    return None

def normalize_company_payload(raw: Dict[str, Any]) -> Dict[str, Any]:
    # Normalize to a flat structure your pipeline can ingest
    # Adjust keys based on the exact response shape your account returns
    company = raw.get("company") or raw  # handle either top-level or nested under "company"
    return {
        "name": company.get("name"),
        "city": company.get("city"),
        "stateCode": company.get("stateCode"),
        "countryCode": company.get("countryCode"),
        "employeesRange": company.get("employeesRange"),
        "revenue": company.get("revenue"),
        "raised": company.get("raised"),
        "tags": company.get("tags") or []
    }

def categorize_domain(url: str) -> Optional[Dict[str, Any]]:
    # Optional: cross-check categories for policy, brand safety, or routing decisions
    payload = {"url": url}
    try:
        resp = session.post(CATEGORIZE_URL, data=json.dumps(payload), timeout=15)
        if resp.status_code == 200:
            return resp.json()
        return None
    except requests.RequestException as e:
        print(f"Categorize request failed: {e}")
        return None

def enrich_domain(url: str) -> Dict[str, Any]:
    company_raw = get_company_from_domain(url)
    if not company_raw:
        return {"url": url, "status": "unresolved"}

    company = normalize_company_payload(company_raw)

    # Optional: add categories to support allow/block or routing logic
    cats_raw = categorize_domain(url)
    categories = []
    if cats_raw and cats_raw.get("domain", {}).get("categories"):
        categories = [
            {"name": c.get("name"), "confidence": c.get("confidence")}
            for c in cats_raw["domain"]["categories"]
        ]

    return {
        "url": url,
        "company": company,
        "categories": categories,
        "status": "ok"
    }

if __name__ == "__main__":
    test_url = "https://cbsnews.com"
    enriched = enrich_domain(test_url)
    print(json.dumps(enriched, indent=2))

How to use the returned fields:

  • name: canonical organization name you should use for deduping and CRM matching.
  • city, stateCode, countryCode: location fields for routing (e.g., EMEA vs. NA) or GEO compliance.
  • employeesRange: coarse size signal for scoring; store as-is to avoid false precision.
  • revenue: treat as a range or bounded indicator when provided; use for prioritization tiers.
  • raised: total funding; useful in startup segmentation or GTM plays.
  • tags: fast-path filtering or lead routing (e.g., “B2B” → enterprise SDR queue).

Official example response and how to read it

The categorization endpoint also returns a company object alongside categories, logos, and related data. Below is the official sample. Use it to understand how categories, logos, tech, and similar domains can complement the company identity returned by the Company endpoint.


{
    "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"
    ]
}

Field usage:

  • domain.categories: array of categories with confidence and optional IAB mapping. You can use this to enforce brand safety, segment by industry, or route accounts to specialized playbooks.
  • domain.logo_url: URL to a ready-to-use logo, helpful for UI enrichment in CRMs or internal tools.
  • objects.company: contains the company fields you’ll also consume from the Company endpoint (name, location, employeesRange, revenue, raised, tags) plus a tech list for light technographic hints.
  • domain_registration_data: useful for fraud heuristics or lifecycle stage estimation.
  • similar_domains: handy for competitor mapping or building lookalike outreach lists.

Designing your pipeline for scale

Batching and rate considerations

Batch domains at the job level to simplify retries and caching, but submit individual requests to the API for clearer error handling and backoff. If you need higher sustained throughput, contact support as documented. Incorporate exponential backoff for 5xx responses and short network blips. Avoid parallel spikes so you don’t saturate your own egress or queue workers.

Caching policy

  • Cache by the normalized domain (e.g., effective second-level domain). Store the full company object and any categories you retrieve.
  • Use a reasonable TTL aligned to your business need. Company identity and tags change slower than content; categories may need a shorter TTL.
  • Invalidate on key user actions (e.g., sales marks “incorrect company”) and re-fetch on demand.

Handling unknown or new domains

  • If the API cannot resolve company fields, fall back to user-supplied company name and flag for review.
  • Queue a recrawl attempt later. Persist the last response and timestamp so you don’t loop on the same unresolved domain.
  • Log the exact input URL. Subdomains can map to the same company; consider collapsing to the registrable domain before querying to improve hit rate.

Mapping to your taxonomy

If your product uses custom verticals, maintain a mapping table from IAB-style category names or the business tags to your internal enum. Prefer many-to-one mapping (multiple categories → single internal vertical) to ensure stable routing. Keep the mapper in code with versioning, and treat it as data you can A/B test for lead scoring improvements.

Idempotency and duplicates

Normalize domains (lowercase, no scheme, strip path) before calling the API. Use the returned company name as your display field but keep the input domain as the record key. If your CRM already has a record with the same normalized name and countryCode, prefer updating that record to avoid duplicates.

Implement allow/block and routing decisions

When vetting signups or partners, combine company identity with categories in a simple rule set:

  • Blocklist by tag or category: If tags contain an excluded vertical, reject or require manual review.
  • Brand safety: If domain.categories matches any disallowed IAB categories, suppress ad placements or disable certain features.
  • Routing: employeesRange and revenue determine which SDR or CSM pool gets the account.

Field mapping reference

Use this quick guide to wire fields from Klazify to your own schema.

Klazify Field Type Typical Use Notes
name string Display name, dedupe key Normalize whitespace and case
city, stateCode, countryCode strings Geo routing, compliance Use ISO country codes as-is
employeesRange string range Lead scoring, tiering Treat as categorical (don’t cast)
revenue range or numeric Prioritization, tiering Store as a bounded value; avoid false precision
raised numeric or null Startup segmentation Null-safe parsing
tags string[] Allow/block, routing, search Case-insensitive matching
domain.categories object[] Brand safety, vertical mapping Use confidence thresholds

Error handling and billing notes

  • Do retries with backoff only on 5xx or network errors. Avoid retrying 4xx unless you corrected the input.
  • Failed or unreachable calls are not billed, which makes conservative retry policies straightforward.
  • Log the response body for auditability; store the timestamp so you can reconcile enrichment events later.

Security and compliance

  • Store your API key in a secrets manager or environment variable. Never hardcode it in source control.
  • Mask keys in logs. Consider per-environment keys to isolate workloads.
  • If you expose enrichment via internal services, enforce domain-level rate limits and service-to-service auth.

Operational tips that save time

  • Queue-based enrichment: publish domain inputs to a queue and consume with workers sized to your throughput target.
  • Partial successes: if company data returns but categories time out, persist company data now and backfill categories later.
  • “Cold start” caching: pre-warm your cache with your top inbound domains to keep median latency low.

Where to go next

  • Get your API token and try the POST call above: Register.
  • Explore full response schemas and optional fields in the Documentation.
  • Evaluate model capabilities and programmatic controls in MCP.

FAQ

How should I cache results from the Company endpoint?
Cache by registrable domain for a period aligned to your business freshness needs. Company identity changes infrequently; categories may need more frequent refresh. Invalidate on manual corrections.

What if the API can’t resolve a company for a domain?
Return a fallback record with status=unresolved, keep the user-supplied company name if available, and schedule a later retry. Consider collapsing subdomains to the base domain and trying again.

Can I block signups based on content category?
Yes. Fetch categories from the categorization endpoint and match against your disallowed list using the category name and an optional confidence threshold before approving.

What fields are safe to use for lead scoring?
employeesRange, revenue, raised, countryCode, and tags are reliable starting points. Treat ranges categorically and avoid converting to exact numbers.

How do I handle rate or throughput limits?
Use worker pools with bounded concurrency and exponential backoff on 5xx responses. If you need higher sustained volume, coordinate via the documentation and support channels.

Ready to enrich every signup with a normalized company name and actionable firmographics? Create your account and start integrating in minutes: Register. You can always reference the full API surface in the Documentation.

Ready to use Klazify?

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

Get Started Free