Company Location API: Get a Company's City and Country
You need to enrich domains with accurate company location so your systems can route leads, comply with geography-based policies, or audit where ads run. By the end of this guide, you will call a single API to get a company’s city and country from a domain, parse the response in code, and plug it into your enrichment, filtering, or analytics pipeline with caching and retry strategies that work at scale.
Why Klazify is a strong fit for company location data
When your workflow depends on knowing where a company operates (for routing, compliance, or analytics), the first problem is resolving a domain into a reliable company record. Klazify specializes in analyzing website content and metadata to derive company attributes, including location, so you can get to city, stateCode, and countryCode with fewer misses.
- Accurate website categorization using AI: Klazify’s models analyze full site content to link domains to the right company and context. That same content understanding stabilizes company resolution before extracting fields like city and countryCode.
- Global coverage: Many signups and traffic sources are non‑English. Klazify’s multilingual content analysis helps match domains to companies worldwide so you get standardized countryCode values consistently.
- Real-time classification: Because the analysis isn’t frozen in old snapshots, newly launched or rebranded domains can still resolve to actionable company data, including location.
- Industry-level categories (IAB): If you need location and safe-context gating in one pass, you can combine location fields from the company endpoint with IAB categories from the categorization endpoint for precise policy decisions.
- Simple API integration: A straightforward REST POST returning JSON fields like city, stateCode, and countryCode integrates cleanly into existing enrichment jobs, webhooks, or stream processors.
- Compliance and filtering: You can gate flows by countryCode or stateCode, enrich signups with city for sales territory assignment, and audit campaigns by region as part of the same domain intelligence toolchain.
Explore more capabilities on the Klazify homepage, and follow the steps below to ship a working integration.
What you will implement
This guide focuses on extracting a company’s location from a domain using a dedicated endpoint, and then optionally combining it with content categorization for advanced filtering.
- Company Location and Profile endpoint: POST https://www.klazify.com/api/domain_company
- Primary input: a JSON body with {"url": "
"} and Bearer authentication - Primary fields you’ll consume: name, city, stateCode, countryCode; optionally employeesRange, revenue (a range, not an exact figure), raised, tags
- Optional categorization: Enrich with IAB taxonomy and related signals via https://www.klazify.com/api/categorize
Make your first request to get city and country
Use the following cURL to call the company endpoint and resolve the organization behind a domain. The example domain is included only in the cURL as required:
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:
- Authentication: Bearer token in the Authorization header. Replace YOUR_API_KEY with your actual key.
- POST body: a JSON object with the url of the website you want to resolve.
- Timeouts and retries: Set reasonable client timeouts and apply a retry policy for transient network errors. Failed or unreachable calls are not billed.
Parse the response in Python
The code below demonstrates how to invoke the same endpoint from Python, read location fields, and normalize them for downstream use.
import os
import requests
API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")
ENDPOINT = "https://www.klazify.com/api/domain_company"
def get_company_location(url):
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json"
}
payload = {"url": url}
resp = requests.post(ENDPOINT, headers=headers, json=payload, timeout=15)
resp.raise_for_status()
data = resp.json()
# Depending on your parsing strategy, access the object that contains
# the company fields you need (name, city, stateCode, countryCode, etc.)
company = None
if isinstance(data, dict):
# If the response follows the documented structure:
company = (data.get("objects") or {}).get("company") or data.get("company") or data
if not company:
return None
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 []
}
if __name__ == "__main__":
result = get_company_location("https://cbsnews.com")
if result:
print("Resolved company location:")
print(f"- name: {result['name']}")
print(f"- city: {result['city']}")
print(f"- stateCode: {result['stateCode']}")
print(f"- countryCode: {result['countryCode']}")
print(f"- employeesRange: {result['employeesRange']}")
print(f"- revenue: {result['revenue']}")
print(f"- raised: {result['raised']}")
print(f"- tags: {', '.join(result['tags']) if result['tags'] else '(none)'}")
else:
print("No company data returned for the given URL.")
Implementation tips:
- Null and missing fields: Not all companies have every attribute; always get keys with defaults.
- Caching: Cache results per domain for hours or days based on your data freshness needs to reduce latency and cost.
- Normalization: Keep countryCode and stateCode in uppercase (they are delivered standardized) and trim whitespace on city.
Official categorization JSON example and how to use it with location
Many teams pair company location with website categorization for brand safety, analytics, or policy enforcement. Below is the official JSON example you can use as a reference when calling the categorization endpoint (https://www.klazify.com/api/categorize). Use this exact block as-is:
{
"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 teams combine this with location:
- Country gating: Use company.countryCode and company.stateCode for region checks. If a site is categorized under sensitive IAB categories, you can add an extra layer of policy by region.
- Lead routing: Enrich CRM accounts with company.city and company.countryCode, then map domain.categories to your product lines for specialized sales motions.
- Brand safety: Use domain.categories for allow/deny while also verifying the company profile belongs to target geographies before allowing ad spend.
Company endpoint example responses you can test against
The following examples demonstrate the specific company fields (including location) you’ll parse. Values below are copied from the official sample so you can test your extraction and mapping logic with stable fixtures.
Example 1 — Full company object with location
{
"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"
]
}
}
}
Usage:
- city, stateCode, countryCode: Primary location dimensions for routing, compliance, and geo-analytics.
- employeesRange: Size band you can use for scoring and segmentation.
- revenue: A range or aggregate figure; treat it as non-exact for tiering or dashboards.
- tags: General descriptors for quick bucketing or search indexes.
Example 2 — Same structure for parser validation
{
"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"
]
}
}
}
Why include a duplicate? Many teams keep multiple fixtures to confirm idempotent parsing, JSON schema validation, and to test cache keying (different inputs, same normalized company location keys).
Example 3 — Categorization reference (reused for integration tests)
{
"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"
]
}
Use this to validate category extraction and your mapping to internal risk, content filters, or ad-targeting taxonomies.
How to wire location and categories into real workflows
The following patterns are common among teams enriching or filtering domains at scale. Adapt based on your data flows.
Signup enrichment
- On form submit, resolve the user’s email domain or website to a company record.
- Persist name, city, stateCode, countryCode to your CRM or identity store.
- Optionally map employeesRange and tags into lead scoring attributes.
- Cache by domain to avoid repeated calls for the same company.
Brand safety and compliance
- Call categorization for a destination domain to get domain.categories.
- If the categories require regional checks, pull company.countryCode and stateCode.
- Apply allow/deny rules by category and geography; log decisions for audits.
Traffic analytics and segmentation
- Batch-resolve top domains in your analytics to attach city/state/country dimensions.
- Use employeesRange as a proxy for account size in dashboards.
- Group by tags for quick industry overviews; map IAB categories to your BI taxonomy.
Field reference you’ll actually use
- name: Canonical company name for deduplication in CRM or CDP.
- city: Primary locality string for routing and dashboards.
- stateCode: Region/state code (where applicable) for territory alignment.
- countryCode: ISO-style uppercase code for compliance gates and rollups.
- employeesRange: Size band for prioritization, segmentation, or ABM tiers.
- revenue: Treat as a range or non-exact figure when building filters or tiers.
- raised: Funding-related field if available; null otherwise.
- tags: Business descriptors for coarse grouping or quick filters.
Operational guidance: scale, caching, and unknowns
- Batching: If you enrich many domains, spread requests over time and reuse results across jobs via a shared cache. Respect rate limits documented in your plan; if unsure, consult the Documentation.
- Caching: Key by the registrable domain (e.g., example.com) and apply a TTL appropriate to your workflow. Many users choose hours to a few days since company location and size change infrequently.
- Retries: Network and transient errors happen. Use exponential backoff for 5xx. Failed or unreachable calls are not billed.
- Unknown or new domains: If location fields are missing, store a null-safe record and queue a delayed retry. You can fall back to country-level decisions if countryCode is present but city/stateCode are not.
- Normalization: Persist uppercase for stateCode and countryCode. Trim city and validate against your internal picklists when possible.
- Auditing: Log input domain, timestamp (UTC), and resulting location fields for traceability in compliance workflows.
Mapping categories and tags to your internal taxonomy
Many teams maintain their own category sets for policy and analytics. Use Klazify’s categories and tags to build stable mappings without manual site lists.
- IAB mapping: Use the category name and any IAB code present to map to your internal policy codes.
- Tags: Map common tags to broader funnels (e.g., “Consumer Electronics” → “Hardware”).
- Conflicts: If multiple categories exist, pick the top one by confidence or maintain a multi-label mapping, depending on your policy tolerance.
| Objective | Primary Fields | Decision Outputs | Notes |
|---|---|---|---|
| Lead Routing by Territory | city, stateCode, countryCode | Owner assignment, SLA path | Fallback to countryCode if city is absent |
| Brand Safety Filtering | domain.categories (+ countryCode) | Allow/Deny/Review | Apply region-sensitive rules when needed |
| Account Scoring | employeesRange, revenue, tags | Priority tier | Treat revenue as non-exact |
| Geo Analytics | city, stateCode, countryCode | Aggregations, dashboards | Normalize codes and dedupe domains |
Instrumenting quality, latency, and costs
- Latency budget: Cache frequently seen domains. Parallelize requests within your rate limits. Include timeouts at the HTTP client layer.
- Quality checks: Keep unit tests with the JSON fixtures above to verify your parser and mappings. Consider alarms for sudden spikes in “no result” rates.
- Cost control: Batch non-urgent enrichments and deduplicate inputs before calling the API. Failed or unreachable calls are not billed.
Get started and explore the platform
Create a free account and start testing the endpoints. The Starter plan is $39.99/mo with a 7‑day trial, so you can implement and validate your pipeline with real data.
Visit the Klazify homepage to see additional features you can stitch into your workflow alongside company location.
FAQ
- What fields should I store if I only need geography? Store city, stateCode, and countryCode. Keep name for deduplication and auditing. Caching by domain significantly reduces repeated lookups.
- How do I handle domains with missing city or state? Use countryCode as a fallback for policy and routing. Queue a retry later; if the company is newly formed or the site is sparse, fields may populate over time.
- Can I use categorization and location together? Yes. Call categorization for IAB categories and company endpoint for city/state/country. Many teams evaluate category-based policies first, then apply geography rules.
- How should I approach batching and rate limits? Deduplicate domains, run batches with controlled concurrency, and cache results. For current limits and headers, refer to the Documentation.
- Are failed calls billed? Failed or unreachable calls are not billed.
Ready to enrich domains with precise company location and ship your integration? Create your account and start testing today: Register.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free