How to Get a Company Name in Python

November 08, 2026
How to Get a Company Name in Python

You need to turn a raw URL into a company name in Python so you can enrich signups, segment leads, or gate access based on who’s behind a domain. By the end of this guide you’ll POST a URL to the Klazify Domain Company endpoint, extract the company name and related firmographics in Python, and know how to operate this at scale with caching, batching, and fallback strategies.

Why Klazify is a great fit for pulling company names from URLs in Python

When your workflow starts with “I have a URL and I need to know the company behind it,” precision and coverage matter. Klazify analyzes live website content, detects social and business signals, and returns normalized company records you can use immediately in code.

Illustration: How to Get a Company Name in Python
  • Accurate company identification using content and signals: Klazify’s models analyze full site content and signals rather than just whois or headers. This increases the chance that the returned company name matches the actual entity operating the domain.
  • Global coverage: Many signups and inbound links come from non-English websites. Klazify’s multilingual content analysis helps resolve names and locations worldwide.
  • Real-time results: Instead of relying on an old snapshot, Klazify inspects current content so you can resolve new or recently updated domains.
  • Industry-level categories (IAB): If you also need to classify the site for routing, brand safety, or filtering, Klazify maps content to IAB categories you can act on.
  • Simple API integration: A single POST with a URL gives you the company object. The response is JSON and easy to parse in Python for pipelines and microservices.
  • Compliance and filtering: With categories and firmographics in the same toolkit, you can both identify the company and decide whether to allow, block, or treat the traffic differently.

What you will build: get a company name from a URL

We’ll call the Domain Company endpoint to resolve a URL to a company record and extract the fields you’ll typically need:

  • name
  • city, stateCode, countryCode
  • employeesRange
  • revenue (returned as a range for this endpoint)
  • raised
  • tags

We’ll also cover how to cache domain lookups, handle unknown or brand-new domains, and optionally add IAB categories using the categorization endpoint.

Authentication and endpoint you’ll use

Authentication: Bearer token in the Authorization header.

Endpoint: POST https://www.klazify.com/api/domain_company

Body: JSON with a single key “url”.

Try it with curl

Use the following request to resolve a company from a URL. Replace YOUR_API_KEY with your token. This request uses an example URL for demonstration.

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:

  • HTTP method is POST.
  • Content-Type must be application/json.
  • Failed or unreachable calls are not billed.

If you need an API key, you can create a free account and start a 7-day trial on the Starter plan ($39.99/mo) here: Register.

Python: extract the company name and firmographics

This snippet posts a URL, checks for a successful response, and prints the company name with a few other useful fields. Structure your code to be resilient to missing fields.

import json
import os
import time
import requests

API_URL = "https://www.klazify.com/api/domain_company"
API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")

def get_company_from_url(url, timeout=12):
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }
    payload = {"url": url}

    r = requests.post(API_URL, headers=headers, data=json.dumps(payload), timeout=timeout)
    r.raise_for_status()
    data = r.json()

    # Depending on availability, company info will be under objects.company
    company = None
    if isinstance(data, dict):
        # Some responses return data under "objects" > "company"
        objects = data.get("objects") or {}
        company = objects.get("company")

    # Defensive checks
    if not company:
        return None

    # Pull the fields we care about; handle nulls gracefully
    result = {
        "name": company.get("name"),
        "city": company.get("city"),
        "stateCode": company.get("stateCode"),
        "countryCode": company.get("countryCode"),
        "employeesRange": company.get("employeesRange"),
        # For domain_company, revenue is a range representation
        "revenue": company.get("revenue"),
        "raised": company.get("raised"),
        "tags": company.get("tags") or []
    }
    return result

if __name__ == "__main__":
    test_url = "https://cbsnews.com"
    info = get_company_from_url(test_url)
    if not info:
        print("No company info available for this URL.")
    else:
        print("Company:", info["name"])
        print("Location:", ", ".join([v for v in [info["city"], info["stateCode"], info["countryCode"]] if v]))
        print("Employees:", info["employeesRange"])
        print("Revenue (range):", info["revenue"])
        print("Raised:", info["raised"])
        print("Tags:", ", ".join(info["tags"]))

How to use this in your flow:

  • Signup enrichment: when a user enters a work email or a company URL, resolve the domain and attach the company name to your CRM lead record.
  • Access gating: identify the company behind a domain and set feature flags, trials, or discounts based on employeesRange or tags.
  • Operations: cache domain → company mappings and refresh them in the background to minimize latency.

Understanding the response and categories you can add

When you also need categories, logos, and similar domains, Klazify’s categorization endpoint returns a comprehensive payload with IAB mapping. Below is the official example. Use categories to decide whether to block, allow, or route content differently.


{
    "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 commonly use:

  • objects.company.name: The normalized company name you can store in your database.
  • objects.company.city/stateCode/countryCode: Useful for territory routing and compliance.
  • objects.company.employeesRange: Drive go-to-market rules or pricing tiers.
  • objects.company.revenue: Company revenue information. For the categorization example above it is a numeric value; when using the domain_company endpoint, expect a revenue range.
  • objects.company.tags: High-level business descriptors that can aid segmentation.
  • domain.categories: IAB-mapped categories for filtering, targeting, or brand safety.
  • domain.logo_url: Quick way to show a company logo in your product UI.
  • similar_domains: Enrichment opportunities (find sibling properties or related brands).

Mapping the result into your pipeline

Post-ingestion, standardize how you store and act on the data. Recommended fields in your CRM or data warehouse table:

  • domain: the domain you queried
  • company_name: from objects.company.name
  • company_location_city/state_code/country_code
  • employees_range
  • revenue_range
  • raised
  • tags (array or comma-delimited)
  • iab_category_primary, iab_category_secondary (if you also call the categorization endpoint)
  • logo_url
  • fetched_at (UTC timestamp for cache freshness checks)

Batching, performance, and operations

Batching strategy

If you have a large queue of domains, batch them client-side and send requests concurrently within your service’s limits. A simple approach is to use a worker pool (e.g., Python concurrent.futures with a fixed max_workers). Keep a deduplicated set per batch to avoid redundant calls on repeated domains.

Caching recommendations

  • Cache key: domain (e.g., example.com).
  • Suggested TTL: 7–30 days depending on how dynamic your data needs are. Company names rarely change, but tags or categories may.
  • Stale-while-revalidate: serve cached data immediately and refresh asynchronously in the background.
  • Write-through: on a cache miss, call Klazify, store the result, and return it downstream.

Handling unknown or new domains

  • Graceful null-handling: treat missing name/location/tags as optional fields and surface a “Unknown company” placeholder in UI.
  • Retry/backoff: transient network issues happen; use exponential backoff and circuit breaking in your client.
  • Background re-check: enqueue a lightweight job to retry domains that returned limited data. Many new domains become classifiable after content is published.

Rate limits and resiliency

  • Throughput: design for steady concurrency with backpressure (queue + worker pool). If you see rate-limit responses, slow down and retry after a short delay.
  • Timeouts: set a per-request timeout (e.g., 10–15 seconds) and handle timeouts as non-fatal with retries.
  • Circuit breaker: if a series of consecutive failures occurs, pause calls briefly to avoid compounding issues.

When to combine company data with content categorization

Often you’ll want both the company identity and the site’s content categories. Examples:

  • Brand safety: resolve the company operating a property, but enforce ad placement by categories from the categorization endpoint.
  • Compliance: detect finance/healthcare categories for specific routing, while retaining the company name for auditing.
  • Lead scoring: enrich contact domains with company size and tags, then prioritize by IAB categories that fit your ICP.

See the API details here: Documentation. If you work with model-control or custom evaluation, also check: MCP.

Comparing approaches to get a company name for a URL

Approach What you get Latency and ops Best for
Klazify Domain Company (POST /api/domain_company) Company name, location (city/stateCode/countryCode), employeesRange, revenue (range), raised, tags Single POST per domain; add client-side caching; handle retries Signup enrichment, CRM ingestion, access gating, analytics
Klazify Categorization (GET/POST /api/categorize) IAB categories, logo URL, similar domains, and company info object in the same payload Use when you also need categories or logo; cache for UI and policy checks Brand safety, filtering, contextual targeting, audit logs
Internal cache only (no external call) Whatever you’ve previously stored for the domain Near-zero latency; requires background jobs to refresh High-traffic apps needing consistent sub-10ms lookups

Pipeline integration blueprint

Event-driven enrichment

  • Trigger: user submits a domain or a signup occurs with a website field.
  • Check cache: if hit and not expired, use cached company_name.
  • On miss: POST to /api/domain_company, parse objects.company.name and other fields.
  • Store: write to your warehouse (e.g., domain_dim), index in your CRM, and publish to a Kafka topic for downstream consumers.
  • Optional: also call /api/categorize to enrich categories and logo_url for UI and policy.

Operational safeguards

  • Idempotency: hash the domain and use it as a key to deduplicate in-flight requests.
  • Monitoring: track success ratio, P95 latency, and cache hit-rate. Alert on sustained drops in success or coverage.
  • Fallback UX: display a minimal card with domain only if company name is unavailable; refresh in background.

Working with revenue and employees ranges

For the Domain Company endpoint, revenue is provided as a range and employees as a range (e.g., “employeesRange”). Build rules that don’t assume an exact number:

  • Segmentation: map employeesRange to internal tiers (e.g., SMB, Mid-market, Enterprise).
  • Pricing: if revenue range is above your “enterprise” threshold, flag the account for sales review.
  • Analytics: store ranges as categorical dimensions rather than forcing them into numeric fields.

Mapping IAB categories to your taxonomy

If your product uses a custom taxonomy, keep a mapping table between IAB categories returned by Klazify and your internal categories.

  • One-to-many: a single IAB path may map to multiple internal segments for different teams (e.g., security vs. ads).
  • Confidence thresholds: use the confidence field; only accept categories above a threshold for automated decisions, queue the rest for review.
  • Versioning: store the mapping version alongside the record so you can re-run analyses if your taxonomy changes.

Security, privacy, and compliance notes

  • PII: the company data returned is organization-level. Avoid combining with user PII unless your policies allow it.
  • Data residency: store only the fields you need, and set retention consistent with your compliance posture.
  • Auditability: log the raw JSON response and timestamp for compliance audits, especially when categories drive blocking/allowing decisions.

End-to-end example flow

  1. User signs up with website field set to example.com.
  2. Your service parses the domain (normalize to lowercase, strip protocol).
  3. Check your cache. On miss, POST to /api/domain_company with {"url": "https://example.com"}.
  4. Parse objects.company.name for display and CRM; store city/stateCode/countryCode and employeesRange for routing.
  5. Optionally call /api/categorize to get IAB categories and logo_url for UI and filtering.
  6. Publish an enrichment event with all fields for downstream analytics.
  7. Schedule a revalidation after 14 days to refresh categories/tags if needed.

Testing and validation tips

  • Golden set: maintain a small set of domains with known expected company names; run them in CI to catch regressions.
  • Null coverage: test behavior when name or location is missing; ensure no hard failures.
  • Timeout path: simulate network timeouts and confirm retries and fallbacks behave as designed.
  • Schema drift guard: validate presence of objects.company before field access; use get() with defaults.

Cost control and rollout

  • Trial: Starter is $39.99/mo with a 7-day trial—use the trial to size your cache window and concurrency.
  • De-duplication: always normalize domains and dedupe before calling to avoid unnecessary requests.
  • Backfill jobs: spread large historical backfills over time with rate-aware worker pools.
  • Unbilled failures: failed or unreachable calls are not billed—handle and log them distinctly.

FAQ

Q: Where in the response is the company name?
A: Access it at objects.company.name. In Python, that’s typically data["objects"]["company"]["name"] if those keys exist.

Q: Do I need both /api/domain_company and /api/categorize?
A: Use /api/domain_company when you primarily need company fields like name and firmographics. Add /api/categorize when you also need IAB categories, logo_url, and related domain context.

Q: What do I store for caching?
A: Cache the normalized domain as the key and store the entire company object plus fetched_at. Use a TTL (e.g., 7–30 days) and refresh in the background.

Q: How should I handle missing fields?
A: Treat name as required for your use case but handle nulls gracefully for city/stateCode/countryCode, employeesRange, revenue, raised, and tags. Don’t fail the request path; retry later if needed.

Q: How do I map categories to my own taxonomy?
A: Maintain a lookup table from IAB category paths (and optional confidence thresholds) to your internal categories. Version your mapping and store the applied version with each record.

Ready to resolve company names from URLs in your Python pipeline? Create your free account to get an API key and start integrating today: Register. For full reference and more response fields, see the Documentation, and explore integration options in MCP.

Ready to use Klazify?

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

Get Started Free