How to Get the Employee Count in PHP
You need to enrich signups or incoming leads with a company’s employee count and basic firmographic details, then push those fields into your PHP backend and data pipeline. By the end of this article, you’ll have a copy‑pasteable curl request, a PHP snippet, and a JavaScript example to pull employeesRange and related fields for any domain, plus practical guidance on caching, batching, and mapping the response to your own schemas.
Why Klazify is the best fit for getting employee counts from domains
When your goal is to grab a reliable employeesRange for a company starting from a URL or domain, being able to analyze real website content and unify data in one response streamlines your build. Klazify uses content intelligence and company enrichment in a single API so you can go from a domain to employeesRange, name, and location with minimal glue code.
- Accurate website categorization using AI: Klazify analyzes page content (not just metadata), which helps it identify the real business behind a domain and return consistent company fields like employeesRange.
- Global coverage: If your signups come from multiple countries and languages, you still get company fields (name, location, employeesRange) from the same endpoint and response shape.
- Real-time classification: You can call the API as users sign up, or during nightly enrichment, and receive up-to-date results without managing your own crawlers.
- Industry-level categories with IAB mapping: If you also need to tag leads or apply brand-safety filters, Klazify maps results to the IAB taxonomy, letting you blend firmographics with content classification in one pass.
- Simple API integration: A single POST with a URL yields the company employeesRange along with name, city, stateCode, countryCode, revenue, raised, and tags—ideal for PHP apps and serverless pipelines.
- Compliance and filtering: With the categorization stack available, you can extract employeesRange for CRM while simultaneously routing ad or content decisions based on IAB categories when needed.
To explore Klazify further, start at the homepage: https://www.klazify.com. If you’re ready to try it, you can also create a free account: Register.
Scenario: enrich a new signup with employeesRange in PHP
Imagine a signup form that only collects an email or website URL. Your team wants to qualify leads automatically by company size and route them to the right sales queue. For this, you’ll call Klazify’s company endpoint, retrieve employeesRange, and store it alongside contact data.
We’ll use this endpoint and method:
- Endpoint: POST https://www.klazify.com/api/domain_company
- Authorization: Bearer token
- Body: JSON with a single url field
From the response, you’ll use these fields under objects.company:
- name
- city
- stateCode
- countryCode
- employeesRange
- revenue
- raised
- tags
Make a live request to get employeesRange
Here’s a complete curl request you can run. Replace YOUR_API_KEY with your 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"}'
Notes:
- Failed or unreachable calls are not billed.
- Starter is $39.99/mo with a 7-day trial, so you can test against your lead flow risk-free.
Official sample JSON (structure and fields to expect)
Below is an official example response format that shows where the company fields appear and how categorization and domain data can be included. Do not rely on these values for a specific company; use them to understand structure and field names for parsing in your code.
{
"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"
]
}
Key fields you will likely use in lead enrichment:
- objects.company.name: Company display name for CRM records.
- objects.company.employeesRange: Use for routing, scoring, or segmentation (e.g., SMB vs. Enterprise).
- objects.company.city, stateCode, countryCode: Location fields to enrich region-based routing.
- objects.company.revenue and raised: Useful context for scoring and segmentation.
- objects.company.tags: Business-oriented labels that help with intent and product mapping.
PHP integration: extract employeesRange and store it
This minimal PHP example calls the same endpoint, parses employeesRange, and shows where to persist it. Use your framework’s HTTP client if preferred.
<?php
$apiKey = 'YOUR_API_KEY';
$payload = json_encode(['url' => 'https://cbsnews.com']);
$ch = curl_init('https://www.klazify.com/api/domain_company');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode >= 200 && $httpCode < 300 && $response) {
$data = json_decode($response, true);
// Defensive checks
$company = $data['objects']['company'] ?? null;
if ($company) {
$employeesRange = $company['employeesRange'] ?? null;
$companyName = $company['name'] ?? null;
$city = $company['city'] ?? null;
$stateCode = $company['stateCode'] ?? null;
$countryCode = $company['countryCode'] ?? null;
$revenue = $company['revenue'] ?? null;
$raised = $company['raised'] ?? null;
$tags = $company['tags'] ?? [];
// Persist in your DB (pseudo-code)
// saveCompanyEnrichment($domain, $companyName, $employeesRange, $city, $stateCode, $countryCode, $revenue, $raised, $tags);
echo "Employees: " . ($employeesRange ?? 'Unknown') . PHP_EOL;
} else {
// No company object returned for this domain
// handleUnknownCompany($domain);
echo "No company data found." . PHP_EOL;
}
} else {
// Log failure. Failed or unreachable calls are not billed.
// retryOrQueue($domain);
echo "Request failed with status: $httpCode" . PHP_EOL;
}
JavaScript example (Node.js) for pipelines and serverless jobs
If parts of your stack are Node-based, this example shows how to fetch and read employeesRange for the same endpoint.
import fetch from 'node-fetch';
const API_KEY = 'YOUR_API_KEY';
const body = { url: 'https://cbsnews.com' };
async function fetchCompany() {
const res = await fetch('https://www.klazify.com/api/domain_company', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(body),
});
if (!res.ok) {
// Failed or unreachable calls are not billed
console.error('HTTP', res.status);
return null;
}
const json = await res.json();
const company = json?.objects?.company;
if (!company) {
console.log('No company data available for this domain.');
return null;
}
const {
name,
employeesRange,
city,
stateCode,
countryCode,
revenue,
raised,
tags = []
} = company;
console.log({ name, employeesRange, city, stateCode, countryCode, revenue, raised, tags });
return company;
}
fetchCompany().catch(console.error);
How to use the returned fields in your product
- Lead routing: Map employeesRange to your sales tiers (e.g., 1–10: SMB, 11–200: Mid‑market, 1000+: Enterprise). Store as a normalized enum in your DB.
- Scoring: Weight employeesRange and revenue higher if you sell to larger orgs; use tags to influence product fit.
- Territory assignment: Use countryCode and stateCode to assign owners or enforce region-based workflows.
- Analytics: Aggregate employeesRange distributions for your inbound signups to spot channel differences.
Operational guidance: batching, retries, caching, and taxonomy mapping
Batching and throughput
- The domain_company endpoint accepts a single url per request. For batch jobs, parallelize requests across workers or queues. Keep concurrency at a level your infrastructure and API plan can support.
- Group domains by popularity or likelihood of duplication to maximize cache hits and minimize redundant calls.
Retries and error handling
- Transient network issues happen. Use exponential backoff and a max retry count. Since failed or unreachable calls are not billed, safe retry policies make sense.
- Log the HTTP status and response body for troubleshooting. If success is false or objects.company is missing, enqueue a delayed retry or mark the domain for manual review.
Caching strategy
- Cache results at the domain level (e.g., example.com → employeesRange + fields). Many domains don’t change frequently, so a TTL of days to weeks is often appropriate.
- Invalidate on key user actions (e.g., lead becomes MQL and is being worked) if you want the freshest employeesRange at that moment.
- Deduplicate within a run: ensure you never call the same domain twice in a batch job.
Handling unknown or new domains
- If objects.company is absent, mark employeesRange as Unknown and let the lead through a fallback path (e.g., SDR research queue).
- Consider scheduling a background refresh a few hours later—some newly seen domains may resolve on a subsequent crawl.
Mapping to your internal taxonomy
- EmployeesRange is a human-readable label. Build a lookup table to convert ranges to your internal bucket IDs.
- Use tags and IAB categories for additional segmentation. If you need to align to internal categories, store both the raw Klazify strings and your mapped IDs for traceability.
Quality control: verifying, monitoring, and auditability
- Sampling: Periodically sample enriched leads and manually verify employeesRange for a subset to ensure it aligns with your sales expectations.
- Versioning: If you transform employeesRange or categories, version your mapper to preserve historical comparability.
- Alerting: Track enrichment failure rates and unknown counts. Sudden spikes may indicate network issues or unexpected input patterns.
Where categorization fits alongside company enrichment
Although you may be laser-focused on employeesRange, the same platform provides categorization at the domain and URL levels. That’s useful when you want to:
- Flag signups from categories you don’t serve.
- Trigger brand-safety rules in ad placements while also logging employeesRange for the advertiser’s domain.
- Feed analytics with both content categories and firmographics without maintaining multiple vendors.
For a deeper look at API capabilities and payload structures, check the Documentation. You can also explore the MCP to manage and control models and usage: MCP. To evaluate fit for your workflow, the Starter plan begins at $39.99/mo with a 7‑day trial.
Visit the homepage to learn more: https://www.klazify.com.
Implementation checklist
- Capture a domain or URL on your signup form.
- POST to https://www.klazify.com/api/domain_company with Authorization: Bearer YOUR_API_KEY and a JSON body containing url.
- Parse objects.company.employeesRange, name, city, stateCode, countryCode, revenue, raised, tags.
- Cache by domain with a reasonable TTL to control latency and cost.
- Map employeesRange to your routing tiers; persist both raw and mapped values.
- Set up retries and dead-letter queues for visibility into failures.
- Add monitoring on enrichment latency and success rate.
Latency, cost, and pipeline considerations
- Latency: For synchronous user flows, call the API server-side after form submission and return quickly—store enrichment asynchronously if needed. For batch ETL, run jobs during off-peak hours with controlled concurrency.
- Cost: Cache aggressively and deduplicate requests. Because failed or unreachable calls aren’t billed, safe retries reduce data gaps without risking overages.
- Data modeling: Store both raw employeesRange and your normalized size bucket. Keep location fields nullable. Keep tags as an array with an index for search.
FAQ
Does the endpoint support multiple domains in one call?
Send one url per POST. For bulk enrichment, parallelize calls or queue them in batches.
What should I do if employeesRange is missing?
Treat it as Unknown, fall back to a manual research queue, and schedule a background retry. Cache negative results with a short TTL to avoid hammering the same domain.
How should I store revenue and raised?
Persist the raw values and avoid over-interpreting them. Use them for scoring and segmentation rather than exact financial reporting.
Can I also use categorization data for filtering?
Yes. The response shape supports categories under domain.categories and IAB mappings, which you can map to your internal filters.
Are failed requests charged?
No. Failed or unreachable calls are not billed.
Ready to enrich signups with employeesRange and related company data? Create your free account and start integrating today: Register.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free