Integrate the Company Industry API in PHP
Your team needs to enrich signups and inbound leads with reliable company industry data inside a PHP backend. By the end of this guide, you’ll have a production-ready integration that takes a domain from a form (or a webhook), calls Klazify’s Company Industry API, and persists fields like name, location, employee range, revenue range, funding raised, and tags to your database—ready to power routing rules, scoring, and reporting.
Why Klazify is the right choice for company industry enrichment in a PHP stack
When your PHP services need consistent, low-latency company enrichment by domain, Klazify provides the domain intelligence backbone to classify and enrich at scale. Here’s how it aligns with this use case:
- Accurate website categorization using AI: Klazify analyzes the full website content rather than relying only on metadata. This helps surface the most relevant industry signals linked to a domain so your enrichment logic can identify company focus precisely.
- Global coverage: If your signups include domains from multiple regions and languages, Klazify evaluates content across locales, improving match quality for international leads.
- Real-time classification: For new or rapidly changing websites, Klazify’s real-time analysis avoids stale results and reduces false positives in your routing or qualification rules.
- Industry-level categories via IAB taxonomy: If you extend enrichment into advertising, audience, or brand-safety workflows, Klazify’s IAB taxonomy mapping helps align company/website signals with ad operations.
- Simple API integration: It’s a straightforward REST API, easy to embed in PHP services or middleware with standard HTTP libraries.
- Compliance and filtering: Strong categorization helps you quickly filter or whitelist business-relevant sites—for instance, restricting certain categories from self-serve signups while fast-tracking your ICP.
Upgrade or start quickly with the Starter plan ($39.99/mo with a 7-day trial). Failed or unreachable calls are not billed, which helps you test safely as you move toward production. Learn more on the Documentation or get your API key from Register.
What you’ll build: a PHP endpoint to enrich a domain
We’ll implement a server-side PHP function that:
- Accepts a domain or URL (e.g., from a signup form or webhook)
- Calls the Klazify Company Industry endpoint
- Extracts fields including name, city, stateCode, countryCode, employeesRange, revenue, raised, and tags
- Persists these fields in your database and surfaces them to downstream systems (CRM, CDP, analytics)
Along the way, we’ll discuss batching strategies, retries/timeouts, caching, and what to do with unknown or new domains.
API endpoint and request format
Use the Company Industry endpoint to retrieve company and industry data directly from a URL or domain:
- Method: POST
- URL: https://www.klazify.com/api/domain_company
- Auth: Bearer token in Authorization header
- Body (JSON): {"url":"domain-or-url"}
cURL example (copy-paste ready)
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"}'
Replace YOUR_API_KEY with your token from Register. The response includes the company profile fields you’ll map to your data model: name, location (city, stateCode, countryCode), employeesRange, revenue (returned as a range in this endpoint), raised, and tags.
PHP integration: step-by-step
1) Write a small PHP client
This example uses native cURL. You can adapt it to Guzzle or any HTTP client used in your PHP framework.
<?php
function fetchCompanyByDomain(string $domainOrUrl, string $apiKey): array {
$endpoint = "https://www.klazify.com/api/domain_company";
$payload = json_encode(["url" => $domainOrUrl]);
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer {$apiKey}",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_TIMEOUT => 10
]);
$raw = curl_exec($ch);
$errno = curl_errno($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($errno !== 0) {
// Network error, safe to retry; failed or unreachable calls are not billed.
throw new RuntimeException("Network error calling Klazify: {$errno}");
}
if ($httpCode < 200 || $httpCode >= 300) {
// Application error; log and handle gracefully.
throw new RuntimeException("Klazify returned HTTP {$httpCode}: {$raw}");
}
$json = json_decode($raw, true);
if (!is_array($json)) {
throw new RuntimeException("Invalid JSON received from Klazify");
}
return $json;
}
// Example usage:
try {
$apiKey = getenv("KLAZIFY_API_KEY");
$data = fetchCompanyByDomain("https://cbsnews.com", $apiKey);
// Typical fields to extract; adjust to your response structure
$company = $data["objects"]["company"] ?? [];
$profile = [
"name" => $company["name"] ?? null,
"city" => $company["city"] ?? null,
"stateCode" => $company["stateCode"] ?? null,
"countryCode" => $company["countryCode"] ?? null,
"employeesRange" => $company["employeesRange"] ?? null,
"revenue" => $company["revenue"] ?? null, // In domain_company, this is a range
"raised" => $company["raised"] ?? null,
"tags" => $company["tags"] ?? []
];
// Upsert into your database here (pseudo-code):
// upsertCompanyByDomain("cbsnews.com", $profile);
} catch (Throwable $e) {
// Centralized error handling
error_log($e->getMessage());
}
2) Add caching per domain
Cache results for each domain to minimize repeat calls and latency. A 24–72 hour TTL works well for company metadata that doesn’t change frequently. Store the normalized domain (e.g., example.com) as the cache key. When the cache is cold or expired, call Klazify again. This also helps you stay within rate limits in high-traffic systems.
3) Handle unknown or new domains
- Null or partial fields: If name or location is missing, queue the record for a retry later. Many teams retry on a backoff schedule (e.g., 1h, 6h, 24h) while keeping the original submission flowing.
- Redirect chains: Always resolve and pass the final landing URL if you have it; otherwise, pass the domain as collected. Either approach is acceptable.
- Not found responses: Skip strict validation on first pass; enrich downstream when data becomes available.
End-to-end example JSON and field usage
The following official example shows a comprehensive response structure, including domain categorization, logo URL, and company details. This helps you understand how company and domain signals arrive in Klazify’s payloads and which fields to persist:
{
"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.*: Core enrichment fields to store in your CRM or lead database. In the Company Industry endpoint, employeesRange, revenue (a range), raised, and tags are the main signals you’ll apply to routing, scoring, and segmentation.
- domain.categories[]: Useful when you also need IAB-aligned categorizations for brand safety, content filtering, or contextual workflows.
- domain.logo_url: Handy for UI in admin tools and CRMs that show company avatars.
- domain_registration_data and similar_domains: Optional signals to aid fraud checks, dedupe logic, or competitive analysis.
Mapping company fields to your data schema
Use the table below as a starting point to map Klazify fields to your own schema and business logic:
| Klazify field | Example content | Suggested storage | How to use it |
|---|---|---|---|
| name | Company legal or trade name | companies.name (string) | Display in CRM; normalize for deduplication. |
| city, stateCode, countryCode | Cupertino, CA, US | companies.location_* (strings) | Geo routing, territory assignment, compliance checks. |
| employeesRange | e.g., 1–10, 11–50, 100K+ | companies.emp_range (string) | ICP checks; assign to SMB/MM/ENT tiers. |
| revenue | Range (endpoint-dependent) | companies.revenue_range (string) | Lead scoring and pricing eligibility. |
| raised | Total funding (nullable) | companies.raised_total (numeric/string) | Prioritize funded startups, tailor outreach. |
| tags | Business tags from content | company_tags (array/table) | Segmentation, personalization, and search facets. |
Python example for pipelines and data engineering
Many teams run enrichment from Airflow, serverless tasks, or data services. Here’s a Python example that calls the same endpoint, extracts fields, and prints a normalized record for storage.
import os
import json
import requests
from urllib.parse import urlparse
API_URL = "https://www.klazify.com/api/domain_company"
API_KEY = os.getenv("KLAZIFY_API_KEY")
def normalize_domain(url_or_domain: str) -> str:
# Ensure consistent cache keys (strip scheme, path)
parsed = urlparse(url_or_domain if "://" in url_or_domain else f"https://{url_or_domain}")
return parsed.netloc.lower()
def fetch_company(domain_or_url: str) -> dict:
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
resp = requests.post(API_URL, headers=headers, json={"url": domain_or_url}, timeout=10)
resp.raise_for_status()
return resp.json()
def project_company_record(payload: dict) -> dict:
company = payload.get("objects", {}).get("company", {})
return {
"name": company.get("name"),
"city": company.get("city"),
"stateCode": company.get("stateCode"),
"countryCode": company.get("countryCode"),
"employeesRange": company.get("employeesRange"),
# In domain_company, revenue is a range string; store as-is
"revenueRange": company.get("revenue"),
"raised": company.get("raised"),
"tags": company.get("tags", []),
}
if __name__ == "__main__":
domain = "https://cbsnews.com"
key = normalize_domain(domain)
try:
payload = fetch_company(domain)
record = project_company_record(payload)
# Example storage step (replace with a DB upsert)
print(json.dumps({"key": key, "company": record}, indent=2))
except requests.RequestException as e:
# Not billed for failed or unreachable calls; implement retry/backoff
print(f"Request failed: {e}")
How to use the returned data in your pipeline
- Lead routing and scoring: Use employeesRange and revenue range as primary size indicators. Combine with tags to identify ICPs, deprioritize out-of-scope segments, and auto-assign owners.
- Operational analytics: Aggregate by countryCode or employeesRange for growth dashboards. Track signups by tags (e.g., “B2C”, “E-commerce”).
- Brand safety and filtering: If you also call categorization, use domain.categories to flag or block sensitive categories or to route reviews.
- UI and admin tools: Display company name and logo_url (if available via categorization) for better internal visibility and faster review.
Performance, batching, and reliability
Practical guidelines for running this at scale:
- Batching: Enrich domains in small, controlled batches (e.g., queues of 50–200 per worker) to maintain predictable load and avoid bursty traffic. If you collect many duplicates, de-duplicate by domain before enqueuing.
- Rate limits: Treat limits as variable and back off on 429 or gateway errors. Stagger jobs and implement exponential backoff with jitter.
- Caching: Cache by normalized domain. A 24–72 hour TTL is a strong baseline; set shorter TTLs for high-priority accounts where rapid change is likely.
- Timeouts: Set client timeouts around 10 seconds and retry idempotently on network errors. Failed or unreachable calls are not billed.
- Observability: Log response times, error rates, and the presence/absence of key fields to tune your retry and fallback logic.
Handling unknowns, taxonomy mapping, and fallbacks
- Unknown or minimal profiles: If some fields are null (e.g., raised), don’t block the user flow. Store partial results and refresh in the background.
- Custom taxonomy mapping: Use tags and, if using categorization, IAB category names to map into your internal industry codes. Persist the mapping table in your data warehouse and keep it versioned. This makes downstream analytics deterministic even if upstream categories evolve.
- Normalization: Standardize fields like stateCode and countryCode to your global country/state tables to avoid join mismatches in BI tools.
Security and data hygiene
- Secure storage of API keys: Use environment variables or your secrets manager. Rotate keys periodically.
- Input validation: Strip tracking parameters from user-submitted URLs and coerce to a domain when possible to ensure consistent cache keys.
- PII minimization: Store only the fields you need. Company enrichment rarely requires user PII; keep payloads small.
When to also use categorization
If your workflow extends beyond company sizing to brand safety, contextual targeting, or content filtering, call the main categorization endpoint to retrieve domain.categories and IAB taxonomy mapping. This helps you:
- Block or allow signups by category when necessary
- Classify partner or publisher sites for ad operations
- Augment lead and account intelligence with content context
Explore endpoints and examples in the Documentation. For control over how categories are consumed across your organization, review configuration options in the MCP.
Deployment checklist
- Obtain API key from Register
- Implement POST https://www.klazify.com/api/domain_company with Authorization: Bearer
- Parse and store: name, city, stateCode, countryCode, employeesRange, revenue (range), raised, tags
- Add caching and idempotent retries with exponential backoff
- Monitor latency, success rates, and field coverage
- Map tags/categories to your internal taxonomy where needed
FAQ
Q: Which endpoint should I use to get company industry data by domain?
A: Use POST https://www.klazify.com/api/domain_company with a JSON body containing {"url":"<domain-or-url>"} and a Bearer token.
Q: What fields are the most important for lead enrichment?
A: name, location (city, stateCode, countryCode), employeesRange, revenue (range), raised, and tags. These are sufficient to route, score, and segment signups in most stacks.
Q: How should I cache results?
A: Cache by normalized domain (e.g., example.com) with a TTL between 24 and 72 hours. Invalidate earlier for high-priority accounts or when you detect material changes.
Q: How do I handle timeouts or unreachable calls?
A: Set client timeouts (~10s) and retry with exponential backoff. Failed or unreachable calls are not billed, so configuring robust retries is safe.
Q: Can I align results with my own industry taxonomy?
A: Yes. Persist a mapping layer from Klazify tags (and IAB categories if you also use categorization) to your internal taxonomy, and reference it in your ETL/ELT jobs.
Ready to enrich your signups and leads with reliable company industry data in PHP? Create a free account to get your API key and start building: Register. Explore more features and options in the Documentation and MCP.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free