Integrate the Category List API in PHP
You need a PHP application to load Klazify’s category taxonomy before your team can map website classifications to a filtering or enrichment policy. By the end of this guide, you can request the category list, inspect it in PHP, and use the returned taxonomy alongside domain classification results without confusing the two responses.
Why start with the category list?
A category-based rule needs a shared vocabulary. For example, an ad-placement audit might flag a classification under /Computers & Electronics/Consumer Electronics, while a CRM pipeline maps that same classification to an internal technology segment. The category-list endpoint helps your team review the taxonomy before creating those mappings.
Documentation covers both the taxonomy and Klazify’s domain intelligence capabilities. Klazify analyzes website content for categorization, including IAB taxonomy mapping, and supports analysis of sites in multiple languages. That content-based approach is useful when a domain name alone does not describe what a site publishes.
The distinction is important: https://www.klazify.com/api/list-category/v2 returns the available category taxonomy. It does not classify a submitted website. The separate https://www.klazify.com/api/categorize endpoint is for website classification and content categorization.
The taxonomy is hierarchical, with broad groups and more specific paths. Klazify describes a system of 621 categories; the list is the reference your application should inspect rather than a set of category strings you maintain by hand. Version 1 is the older list, while this integration uses version 2.
Request the taxonomy
The category-list endpoint accepts GET or POST requests with Bearer authentication. Start with GET to retrieve the list; no website domain is needed for this request.
curl --request GET \
--url 'https://www.klazify.com/api/list-category/v2' \
--header 'Authorization: Bearer YOUR_API_KEY'
Replace YOUR_API_KEY with your key before running the command. The response is the taxonomy, so use it to discover the category values available for mapping—not to decide whether a particular site should be blocked or enriched.
Save a successful response for inspection before writing your mapping code. In particular, review its actual structure and category values before assuming how to traverse it. The domain classification example later in this guide is a different response and should not be used as the schema for the category list.
Load the list in PHP
The following PHP example calls the same GET endpoint, checks the HTTP status, and verifies that the response is valid JSON. It prints the response without assuming undocumented category-list field names or changing its structure.
<?php
$apiKey = getenv('KLAZIFY_API_KEY');
if ($apiKey === false || $apiKey === '') {
fwrite(STDERR, "Set KLAZIFY_API_KEY before running this script.\n");
exit(1);
}
$handle = curl_init('https://www.klazify.com/api/list-category/v2');
curl_setopt_array($handle, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
],
]);
$response = curl_exec($handle);
if ($response === false) {
$message = curl_error($handle);
curl_close($handle);
fwrite(STDERR, "Request failed: " . $message . "\n");
exit(1);
}
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status < 200 || $status >= 300) {
fwrite(STDERR, "Unexpected HTTP status: " . $status . "\n");
exit(1);
}
json_decode($response);
if (json_last_error() !== JSON_ERROR_NONE) {
fwrite(STDERR, "Response was not valid JSON.\n");
exit(1);
}
echo $response, "\n";
Set KLAZIFY_API_KEY in the process environment and run the script with PHP’s cURL extension enabled. In an application, keep the decoded response for processing after inspecting the list’s actual structure. Avoid logging the authorization header or committing the key to source control.
If another part of your pipeline uses Python, this equivalent request reads the JSON and prints it for inspection. The standard library raises an error for unsuccessful HTTP responses, so a production worker should catch request and decoding errors and report them to its job system.
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://www.klazify.com/api/list-category/v2",
headers={"Authorization": "Bearer " + os.environ["KLAZIFY_API_KEY"]},
method="GET",
)
with urlopen(request) as response:
taxonomy = json.load(response)
print(json.dumps(taxonomy, indent=2, ensure_ascii=False))
Both examples read the returned JSON without presuming a particular list schema. Once you have inspected the response, add an adapter that extracts the category values your application needs and validates them against your internal mapping.
Use the taxonomy with a classification result
The category list tells you which categories exist. A classification result tells you which categories were returned for a website. The following example is a domain categorization response, not the response from the category-list request above.
{
"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"
]
}
For a category-driven workflow, first check success, then inspect domain.categories. Each category object in this example has a name and confidence; the first also has an IAB mapping under IAB-632-596. Treat confidence as a signal for your policy, not as a guarantee that a classification is correct.
The response can contain more than one category. An audit should evaluate each returned category against its mapping rather than assuming the first entry is the only relevant one. The IAB value is useful when your advertising workflow uses that vocabulary, but the second category illustrates why consumers should tolerate an absent IAB field.
| Response field | Example use | Handling consideration |
|---|---|---|
domain.categories |
Match category names to filtering, reporting, or enrichment rules. | Process all returned entries; keep unmapped values visible for review. |
confidence |
Route lower-confidence results to review under your own policy. | Choose thresholds through your own validation, rather than treating the value as a guarantee. |
IAB-632-596 |
Connect a returned category to an IAB-oriented ad audit. | Handle the field as optional on individual category objects. |
objects.company |
Enrich a CRM record with available company context. | Keep category policy separate from company attributes and handle missing values. |
social_media and logo_url |
Add optional presentation or enrichment data. | social_media is null in this example; do not assume every field is populated. |
Other fields in the example, such as registration data and similar domains, can provide context for enrichment or investigation. They are not themselves a category decision. Likewise, a category is not proof that a site is malicious or compliant: combine it with the other checks your workflow requires.
Put the mapping into production
Maintain an explicit mapping from Klazify category values to your own labels or actions. For a placement audit, that mapping might produce “review” rather than an automatic block. For CRM enrichment, it might assign an internal segment while preserving the original category and confidence for later inspection.
Review hierarchy deliberately. A rule for a broad path may be intended to include its descendants, but that is a policy decision your application must implement; do not assume every category shares the same depth. Test the mapping with multiple returned categories, optional IAB values, and values your mapping does not yet recognize.
Keep the taxonomy snapshot and mapping version together so you can explain which rules produced a decision. Refresh the list periodically, compare it with the snapshot your application currently uses, and review additions or changes before automatically applying new rules. A list refresh should not silently turn an unknown category into a blocking rule.
Cache and schedule requests
Cache the category list separately from classification results: the list is shared reference data, whereas a classification result is associated with a particular domain or URL. For domain-level enrichment, normalize the domain consistently before using it as a cache key, and record when the result was fetched. If your workflow classifies individual pages, preserve URL-level distinctions rather than reusing a domain result for every page.
Choose a refresh interval that fits your tolerance for stale data. New or changed websites may need another classification attempt later; avoid treating an old cached result as permanent. If a refresh fails, keep the last successful taxonomy snapshot available where appropriate and alert the team instead of replacing it with an empty list.
For large queues, deduplicate repeated domains before calling the classification service. Schedule requests in controlled batches and apply concurrency and retry limits appropriate to your account; batching here means organizing your own work queue, not assuming an undocumented bulk endpoint. Check the documentation and account details for current rate-limit guidance.
Handle unknowns and failures explicitly
An unreachable domain, an unsuccessful call, an empty or missing category, and a category that your mapping does not recognize are different conditions. Record them separately. For a safety-sensitive filter, define whether an unknown result should be allowed, blocked, or sent to review; for CRM enrichment, leave the segment unset rather than assigning a misleading default.
Retry transient failures with backoff and a bounded retry policy. Klazify states that failed or unreachable calls are not billed, but retries still consume operational time and should be monitored. Track request failures, unmapped categories, cache age, and the proportion of results sent to review so you can see when the integration needs attention.
FAQ
Does the category-list endpoint classify a domain?
No. It returns the taxonomy. Use the separate categorization endpoint for website classification, then compare the returned category values with your mapping.
Should I use version 1 or version 2 of the list?
This integration uses version 2. Version 1 is the older list; if you already depend on it, review the version 2 response and your mappings before migrating.
What should I do when a category is missing from my mapping?
Preserve the returned value, mark it as unmapped, and route it for review. Refresh your taxonomy snapshot and update the mapping deliberately rather than guessing an internal category.
How do I explore other integration options?
Alongside the REST integration, see MCP. For this PHP workflow, keep the taxonomy retrieval and the site-classification step separate regardless of how you connect them.
Create a free account through Register to get started. The Starter plan is $39.99 per month with a 7-day trial.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free