Integrate the Company Location API in PHP
You need to enrich signups and vendor domains with company location data so you can route leads by territory, apply region-based compliance rules, and power analytics. By the end of this guide you’ll be able to call a single API to resolve a domain to company name, city, stateCode, countryCode, size, revenue range, funding and tags, then plug those fields into your pipeline with caching and retry logic.
Why Klazify is the best fit for company location enrichment
When your goal is to turn a raw URL or domain into actionable company location and firmographic data, you need accurate classification and rich business context. Klazify combines domain intelligence with company data so you can enrich records and enforce policies with a single call.
- Accurate website categorization using AI: Klazify analyzes full site content instead of just metadata. For location-driven workflows (e.g., routing EMEA vs. US leads, or blocking signups from unsupported regions), this reduces misclassification that would otherwise send contacts to the wrong team.
- Global coverage: Company location fields include city, stateCode and countryCode, helping you standardize across multiple languages and address formats in global pipelines.
- Real-time classification: Fresh crawls surface up-to-date company and category context, useful when domains pivot or move headquarters.
- Industry-level categories (IAB): Alongside location, Klazify returns IAB taxonomy categories, which you can combine with geography for policy decisions (e.g., allow Finance content in US only).
- Simple API integration: A single REST call returns company name, location, size, revenue information, funding and tags from a URL. This keeps your enrichment step compact and maintainable.
- Compliance and filtering: Category and tag signals help you detect domains to filter or review while location data drives routing and data sovereignty rules.
What you will build: a reliable company-location enrichment step
We’ll integrate the company endpoint to resolve a domain into company details, focusing on:
- Location fields: city, stateCode, countryCode
- Firmographic fields: name, employeesRange, revenue, raised, tags
- Complementary signals you can use: IAB categories and logo URL
If you are starting from scratch, create a free account first and get an API key. Starter is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed. You can sign up here: Register. Refer to the full API reference any time: Documentation. For MCP integration resources, see MCP.
Endpoints you will use
- POST https://www.klazify.com/api/domain_company — Resolve a domain/URL to company data including location (name, city, stateCode, countryCode, employeesRange, revenue, raised, tags).
- POST/GET https://www.klazify.com/api/categorize — Website classification and content categorization. The response also includes company information within objects.company and domain signals such as categories and logo_url.
In many pipelines, you’ll call the company endpoint for fast enrichment and optionally the categorize endpoint when you also need IAB categories and content signals. The company object structure is consistent across responses.
Quickstart: cURL request for company location
Send the domain in JSON payload as url, include your Bearer token, and parse the company fields. The following request demonstrates the pattern (the example domain is illustrative and appears only in this sample request):
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 object containing company fields including name, city, stateCode, countryCode, employeesRange, revenue, raised and tags. Use these to populate your CRM or apply region-based logic.
JavaScript example: enrich a batch and cache results
This example shows how to send one domain at a time to the same endpoint, parse the relevant fields, add light caching to avoid re-calling known domains, and map the result into a normalized record. You can adapt the pattern to your queue or ETL step.
import fetch from "node-fetch";
const API_URL = "https://www.klazify.com/api/domain_company";
const API_KEY = process.env.KLAZIFY_API_KEY;
// Simple in-memory cache by registrable domain
const cache = new Map();
async function enrichDomainCompany(url) {
const domainKey = new URL(url).hostname.replace(/^www\./, "");
if (cache.has(domainKey)) {
return cache.get(domainKey);
}
const res = await fetch(API_URL, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ url })
});
// Network or HTTP errors are not billed when the call fails or is unreachable
if (!res.ok) {
// Consider exponential backoff and a dead-letter queue for persistent failures
throw new Error(`Klazify error ${res.status}`);
}
const data = await res.json();
// Defensive parsing: handle missing objects or nulls for new/unknown domains
const company = data?.objects?.company || {};
const record = {
sourceUrl: url,
name: company.name || null,
city: company.city || null,
stateCode: company.stateCode || null,
countryCode: company.countryCode || null,
employeesRange: company.employeesRange || null,
revenue: company.revenue ?? null, // treat as range in your UI if applicable
raised: company.raised ?? null,
tags: Array.isArray(company.tags) ? company.tags : []
};
cache.set(domainKey, record);
return record;
}
// Example usage
(async () => {
const inputs = [
"https://cbsnews.com",
"https://example.org"
];
for (const u of inputs) {
try {
const rec = await enrichDomainCompany(u);
console.log(`Enriched: ${u}`, rec);
} catch (e) {
console.error(`Failed to enrich ${u}`, e.message);
}
}
})();
Understanding the response fields you’ll use
The categorize endpoint returns a full payload with company details, website categories, and other signals. This official sample demonstrates the structure and the exact field names you will read in your code. Note: Do not alter field names when parsing.
{
"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:
- objects.company.name, city, stateCode, countryCode — Populate your CRM fields or lead router. Use countryCode for ISO-based rules, and stateCode for US subdivision routing.
- objects.company.employeesRange — Size segmentation for territory rules (e.g., SMB vs. Enterprise).
- objects.company.revenue — Treat as an enrichment signal. If your UI expects a range, map numerics into buckets on ingestion.
- objects.company.raised — Funding signal for scoring.
- objects.company.tags — Quick industry and business model context.
- domain.categories — IAB-aligned classifications for brand safety and content-based filtering. You can combine with location for region-specific allow/deny rules.
- domain.logo_url — Useful for CRM or admin UI.
- domain_registration_data — Additional hygiene signals for fraud checks.
- similar_domains — Seed lists for competitive or discovery workflows.
Integrating this in PHP
To integrate the company location API in PHP:
- Use PHP’s curl functions (curl_init, curl_setopt with CURLOPT_HTTPHEADER for Authorization: Bearer YOUR_API_KEY and Content-Type: application/json, CURLOPT_POSTFIELDS with a JSON-encoded body).
- Send POST to https://www.klazify.com/api/domain_company with {"url":"https://your-domain"}.
- Decode the JSON with json_decode($response, true) and read objects.company.name, city, stateCode, countryCode, employeesRange, revenue, raised, tags.
- Normalize and store the result keyed by the registrable domain (e.g., example.com) in your cache or database to prevent duplicate calls.
- Wrap the request in a retry mechanism with exponential backoff and circuit breaking for transient errors. Unreachable calls are not billed.
This approach mirrors the JavaScript sample and fits easily into a Laravel job, a Symfony Messenger worker, or a simple queue consumer.
Field-to-pipeline mapping
Use the following mapping to make the response directly actionable in your systems:
| Response Field | Type | Typical Use in Your Pipeline |
|---|---|---|
| objects.company.name | string | Display and CRM Account Name; override only if confident |
| objects.company.city | string | Territory assignment and timezone heuristics |
| objects.company.stateCode | string | US regional routing and tax compliance |
| objects.company.countryCode | string (ISO) | Geo-based rules, data residency, privacy compliance |
| objects.company.employeesRange | string range | Segmentation (SMB/Mid/Enterprise) for SDR assignment |
| objects.company.revenue | number or bucket | Scoring and prioritization; map to your own revenue buckets |
| objects.company.raised | number or null | ICP fit signal; sales prioritization |
| objects.company.tags | array | Industry/topic filters for outreach or allow/deny logic |
| domain.categories[].name | string | Brand safety, content filtering, ad placement controls |
| domain.logo_url | string (URL) | Enriched UI, CRM visuals |
Operational guidance that saves time
Batching and throughput
- Batch externally: If you have a large list of domains, run them through a queue or worker pool that caps concurrency to a safe level for your infrastructure.
- Idempotency: De-duplicate domains before enqueueing so each registrable domain is called once per refresh cycle.
Caching strategy
- Cache key: Use the registrable domain (e.g., example.com) as your key. Normalize by lowercasing and stripping www.
- TTL: Choose a TTL that matches your SLA for freshness. Many teams refresh monthly; shorten for high-value accounts.
- Cold start: If a domain is not in cache, call the API and write-through the result.
Error handling and retries
- Retries: Use exponential backoff on temporary failures. Keep a dead-letter queue to inspect persistent failures.
- Billing note: Failed or unreachable calls are not billed, which simplifies retry policies.
Unknown or new domains
- Null-safe parsing: Treat missing company fields as null and continue processing. Log and recheck on the next refresh cycle.
- User input hygiene: When a user submits a URL, normalize it and attempt enrichment even if it lacks scheme or has tracking params.
Mapping to your taxonomy
- IAB categories: Use domain.categories and any IAB-mapped keys to anchor your internal category system. Maintain a translation table from IAB paths to your internal labels.
- Fallback tags: If the category set is broad, tags provide additional precision for routing and filtering.
Data governance and consistency
- Canonical fields: Store countryCode (ISO) and stateCode (standard abbreviations) as your source of truth for geo rules.
- Revenue handling: If your UI expects ranges, map numeric values into bands during ingestion and store both the raw value and the band label.
Putting it together: a typical pipeline pattern
- Ingest: Capture a user-submitted URL at signup or import domains from a CSV.
- Normalize: Extract registrable domains, lowercase, strip www.
- Cache lookup: Skip API call if fresh cache exists.
- Enrich: POST to https://www.klazify.com/api/domain_company with the normalized URL.
- Complement (optional): Call https://www.klazify.com/api/categorize to obtain IAB categories and logo_url.
- Map: Transform objects.company fields into your CRM schema. Map categories to internal taxonomy.
- Route: Assign owner based on countryCode/stateCode and employeesRange.
- Persist: Store the payload and a timestamp for auditing and refresh logic.
Testing and QA
- Golden set: Create a known-good list of domains with validated company and location info. Run nightly regression checks.
- Schema drift: Keep JSON schema validation at the ingestion boundary to catch unexpected shapes early.
- Alerting: Monitor error rates and timeouts. Add alerts when enrichment falls back to null for more than a threshold percentage.
Account and setup
Create an account to get your API key and start making requests. The Starter plan is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed. Get started here: Register. Keep the Documentation handy for field references, and review MCP resources if you plan to integrate via a control plane.
FAQ
- Which endpoint should I call to get company location data? Use POST https://www.klazify.com/api/domain_company with a JSON body containing the url. If you also need IAB categories and logo_url, you can call https://www.klazify.com/api/categorize.
- How should I handle domains that return partial or null fields? Parse null-safe, store nulls, and schedule a refresh. For routing, fall back to countryCode if stateCode or city are unavailable.
- Can I cache results to reduce calls? Yes. Cache by registrable domain with a TTL that matches your freshness requirements. Invalidate or refresh when business rules change.
- How do I map Klazify categories to my internal taxonomy? Maintain a translation table from IAB category paths (domain.categories[].name and IAB keys) to your internal labels. Keep tests to verify mappings on updates.
- Are failed requests billed? Failed or unreachable calls are not billed, which makes retries and backoff straightforward to implement.
Ready to enrich domains with company location and firmographics? Create your account and get your API key, then implement the POST call in your PHP worker today: Register. Keep the Documentation open as you wire fields into your CRM and routing logic.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free