Integrate the Employee Count API in PHP
Your team needs to route inbound signups and partners based on company size, enrich CRM records with employee ranges, and flag mismatched revenue bands before a lead ever reaches sales. By the end of this guide, you will be able to call Klazify’s company endpoint to retrieve employeesRange and related firmographic fields, plug them into your PHP-powered pipeline, and operate reliably at scale with caching, batching, and robust error handling.
Why Klazify for employee count and firmographic enrichment
Employee count data is only useful if it’s fresh, consistent across geographies, and easy to map into your own systems. Klazify brings:
- Accurate website-driven analysis: It analyzes actual site content and signals to infer company attributes like employeesRange, complementing official and public sources.
- Global coverage: Works across multiple languages and locales so you get employeesRange, location, and tags whether the company is in the US, EU, APAC, or LATAM.
- Real-time lookups: No reliance on stale datasets; you can enrich in real time at signup, form submit, or webhook events.
- Industry-level categories via IAB: When needed, align company size with content categories using IAB taxonomy for ad tech, analytics, and brand safety workflows.
- Simple REST integration: A single POST with a URL returns name, location, employeesRange, revenue, raised, and tags that you can route and score immediately.
- Stronger compliance and filtering: Combine employeesRange with tags and IAB data to whitelist/blacklist accounts, filter bots, or enforce product eligibility rules.
If you’re classifying or enriching at scale, Klazify keeps latency predictable and returns the precise fields developers need to automate lead scoring and routing in data pipelines. Learn more about the platform at klazify.com or jump into the Documentation.
What you will build: PHP enrichment that routes by employeesRange
We’ll enrich any domain your PHP application sees (signup email, referrer, CRM domain) with employeesRange and other company fields. The output will inform:
- Lead routing: Assign 1–10 employees to SMB queue, 11–1K to mid-market, 1K+ to enterprise.
- Product gating: Enable enterprise-only features if employeesRange meets threshold.
- Pricing and trial rules: Adjust limits for accounts above a certain employeesRange.
- Analytics: Track funnel conversion by employeesRange and tags.
Even though the example code below is in JavaScript (to satisfy copy/paste for frontend and serverless), the same request and response handling applies to PHP via curl or any HTTP client (e.g., Guzzle). We outline PHP-specific handling tips throughout.
The endpoint to get employee count and firmographics
Use the domain-to-company endpoint to extract core attributes:
- Method: POST
- URL: https://www.klazify.com/api/domain_company
- Auth: Bearer token in the Authorization header
- Body (JSON): {"url":"the domain you want to enrich"}
Returned fields (subset you’ll likely use):
- name
- city, stateCode, countryCode
- employeesRange
- revenue (returned as a range, not an exact audited figure)
- raised
- tags
Tip: Failed or unreachable calls are not billed. The Starter plan is $39.99/mo with a 7-day trial, so you can prototype your enrichment flow safely. Create a free account here: Register.
One-minute test with curl
Run this request to see employeesRange and related data for a real domain. 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"}'
On success, the response includes company fields like employeesRange, revenue, raised, and tags, which you can map to your CRM, CDP, or routing rules.
Official JSON example and where to read employeesRange
Below is an official example response format showing both categorization data and the company object. Use objects.company to read employeesRange and the rest of the firmographics you’ll route on.
{
"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 the fields:
- objects.company.employeesRange: Route or score by size (e.g., SMB, Mid-Market, Enterprise). Store as-is; treat it as a band for rules rather than a precise headcount.
- objects.company.revenue: Use as a range indicator for ICP matching and pricing tiers.
- objects.company.raised: Check for venture-backed companies or prioritize by capital raised.
- objects.company.tags: Auto-populate CRM industries or product interests; combine with employeesRange for nuanced routing.
- objects.company.city/stateCode/countryCode: Regional assignment and compliance routing.
- domain.categories and IAB mapping: Optional but useful when aligning with content policies or ad placement filters.
JavaScript example: read employeesRange and map to queues
This minimal example posts a domain to the endpoint, extracts employeesRange, and assigns a routing label. The same logic applies in PHP: POST, decode JSON, and branch on employeesRange.
async function enrichDomain(domainUrl) {
const res = await fetch("https://www.klazify.com/api/domain_company", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ url: domainUrl })
});
if (!res.ok) {
// Failed or unreachable calls are not billed.
// Log and fall back to a default queue.
return { queue: "unknown", data: null };
}
const data = await res.json();
const co = data?.objects?.company || {};
const employees = co.employeesRange || "unknown";
let queue = "smb";
if (employees.includes("100K+") || employees.includes("50K") || employees.includes("10K")) {
queue = "enterprise";
} else if (employees.includes("1K") || employees.includes("5K") || employees.includes("2K")) {
queue = "midmarket";
}
return {
queue,
data: {
name: co.name,
url: co.url,
employeesRange: employees,
revenue: co.revenue,
raised: co.raised,
location: {
city: co.city,
stateCode: co.stateCode,
countryCode: co.countryCode
},
tags: co.tags || []
}
};
}
// Example usage
enrichDomain("https://cbsnews.com").then(console.log).catch(console.error);
In PHP, call the same endpoint with curl_init, set the Authorization: Bearer header, pass {"url":"..."} as JSON, json_decode the response, then branch on $data->objects->company->employeesRange to assign a queue.
Designing your PHP pipeline
1) Where to call the API
- At signup: Extract the domain from the email (e.g., example.com), call once, and cache the result.
- On import: When ingesting CSVs, batch-look up distinct domains to minimize calls.
- In CRM syncs: Enrich missing employeesRange fields on a schedule or webhook trigger.
2) Caching and idempotency
- Cache by normalized domain (lowercase, punycode). Suggested TTL: days to weeks depending on your freshness needs.
- If a cached result exists, skip network requests to reduce latency and cost.
- Record the timestamp and endpoint version for future audits.
3) Handling unknown or new domains
- Gracefully accept missing employeesRange by routing to a general queue and scheduling a retry.
- Log unknowns for sales research; tags and location may still provide value.
- Use raised and tags when employeesRange is absent to make a best-effort routing decision.
4) Batching strategy
- Deduplicate domains per job before making requests.
- Use a small concurrency pool to balance throughput and response time.
- Backoff on transient errors; failed or unreachable calls are not billed.
5) Rate limits and resilience
- Respect HTTP status codes; implement exponential backoff on 429/5xx.
- Queue enrichments with retries rather than blocking user flows if a dependency is slow.
- Monitor latency and success rates; alert on anomalies.
Mapping employeesRange and revenue to your taxonomy
Most teams already have internal size buckets. Map Klazify’s employeesRange to your canonical tiers. Keep mappings in configuration rather than code so operations teams can adjust without deploys.
| Klazify field | Example value | Your internal bucket | How to use |
|---|---|---|---|
| employeesRange | 1–10, 11–50, 51–200, 201–1K, 1K+, 100K+ | SMB, Mid-Market, Enterprise | Lead routing, trial limits, AE assignment |
| revenue | Range indicator, not an exact audit | Revenue bands (e.g., <$10M, $10–100M, $100M+) | ICP filtering, pricing discussions |
| tags | “E-commerce”, “B2C”, etc. | Industry and playbook tags | Personalization, solution mapping |
| city/stateCode/countryCode | Cupertino, CA, US | Region, territory | Regional routing, compliance |
If you also classify the site for ad tech or brand safety, fetch categories with the main endpoint at klazify.com and align IAB categories to your existing taxonomy. This is handy for ad placement audits and content filtering.
Operational details that save time
- Idempotency: Normalize input URLs (scheme-stripped, lowercase, no path) before requesting. Example: https://www.example.com/page → example.com.
- Country code standardization: countryCode returns ISO-style codes; store two-letter codes consistently across systems.
- Timestamps and timezones: When you store enrichment timestamps, persist in UTC and include the endpoint path/version for auditability.
- Error policy: For non-2xx responses, do not retry immediately in a user flow; enqueue for background retry.
- Security: Keep your API key server-side. For client-side JS, proxy requests through your backend to avoid exposing the key.
Quality controls and auditing
- Sampling: Periodically sample enriched records and spot-check employeesRange against public data to validate routing accuracy.
- Drift alerts: If the distribution of employeesRange bands shifts suddenly, alert ops to investigate source, input parsing, or target segment changes.
- Fallbacks: Define deterministic fallbacks (e.g., tags + countryCode) when employeesRange is missing to keep automation stable.
Cost control and plan awareness
- Starter plan: $39.99/mo with a 7-day trial to validate your integration and logic.
- Not billed for failed/unreachable calls: Safe to retry when the network is unstable.
- Cache hits: Heavily cache popular domains to reduce requests and speed up your flows.
To explore endpoints, parameters, and examples, see the Documentation and manage your account in MCP.
Putting it together in your PHP stack
- Controller or job: Accept domain input; sanitize and normalize.
- Cache layer: Check Redis/memcached for a prior employeesRange result.
- HTTP call: POST to https://www.klazify.com/api/domain_company with Authorization: Bearer YOUR_API_KEY and body {"url":"https://example.com"}.
- Parse: json_decode; read $data->objects->company->employeesRange and allied fields (revenue, raised, tags, city/stateCode/countryCode).
- Route: Map employeesRange to an internal bucket; enqueue for sales or assign to the right rep/queue.
- Persist: Store firmographics on the account/contact object; include an enrichment timestamp.
- Retry: On network or 5xx, backoff and requeue; on 4xx, log and skip.
FAQ
- Can I enrich in bulk? Yes. Deduplicate domains, then POST them sequentially or with controlled concurrency. Cache results so recurring domains don’t incur repeat calls.
- How should I handle missing employeesRange? Route to a default queue, store the record, and retry later. Use tags, countryCode, and raised as secondary signals in the meantime.
- Is revenue exact? Treat revenue as a range indicator for routing and ICP checks, not as an audited financial number.
- Where do I find categories and IAB mapping? Use the main categorization features described in the Documentation. You can combine categories with employeesRange for brand safety or ad placement logic.
- How do I manage my API key and usage? Create and manage keys in your account dashboard and monitor usage in MCP. Keep keys server-side and proxy any public calls.
Ready to enrich signups and route by employee count in minutes? Start your 7-day trial on the Starter plan and ship an end-to-end integration today: Register. For full API details and examples, visit klazify.com.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free