Integrate the Company Revenue API in PHP

November 09, 2026
Integrate the Company Revenue API in PHP

Your team needs reliable company revenue ranges and firmographic data for every domain that hits your pipeline, so you can enrich signups, score leads, and gate access. In this guide, you’ll wire up Klazify’s company revenue endpoint in a PHP service, validate results with a real curl request, and learn how to operationalize caching, batching, and category mapping so the integration scales cleanly.

Why Klazify is the right API when your stack depends on company revenue

Company revenue is hard to maintain accurately across millions of domains, especially when you operate globally and need consistent, normalized ranges. Klazify brings the same strengths it uses for web classification to firmographic enrichment:

Illustration: Integrate the Company Revenue API in PHP
  • Accurate website categorization using AI: Full-site analysis improves identification of what the company actually does, which stabilizes revenue and employee size inference for long-tail domains you’ll encounter during signups.
  • Global coverage: Domains across regions and languages are analyzed, keeping your enrichment logic consistent for international leads.
  • Real-time classification: Fresh domain analysis reduces the risk of stale categories and business tags, an important signal to reconcile with revenue ranges.
  • Industry-level categories: IAB taxonomy alignment lets you bind revenue ranges to ad targeting and brand safety filters without building a custom mapping layer from scratch.
  • Simple API integration: A single POST request with a URL yields company data fields—including city, stateCode, countryCode, employeesRange, revenue (a range), raised, and tags—that drop straight into your PHP models.
  • Compliance and filtering: Combine IAB categories with revenue and employee size to enforce internal policies (e.g., “only accept self-serve from SMB in permitted categories”).

If you’re classifying domains for ad placement, gating product features, or enriching CRM records, Klazify’s combined categorization and company data approach reduces the number of vendors and joins you need in your pipeline. Create a free account to test the endpoint against your own domain list: Register.

What you’ll build

We’ll implement a small PHP function that accepts a domain or URL and returns normalized company fields you can persist in your database: name, location, employeesRange, revenue (as a range), raised, and tags. We’ll also add a JavaScript example if you prefer to prototype from Node or the browser.

By the end, you will:

  • Call the Klazify company endpoint with POST and a Bearer token.
  • Parse and store firmographic fields that slot into your CRM or risk models.
  • Cache and reuse results per domain to reduce API calls and latency.
  • Handle unknown or new domains gracefully without blocking user flows.

Endpoint and authentication

Use the company enrichment endpoint to fetch revenue and related company details from a URL or domain:

  • HTTP method: POST
  • Endpoint: https://www.klazify.com/api/domain_company
  • Auth: Authorization: Bearer YOUR_API_KEY
  • Body (JSON): {"url":"https://example.com"}

Notes:

  • Send a full URL or bare domain; Klazify will normalize it.
  • Revenue is returned as a range rather than an exact figure.
  • Failed or unreachable calls are not billed.

For overall capabilities, see the Documentation. To explore model change policies and platform guarantees, visit the MCP.

Test the endpoint with curl

Run this request to verify your API key and inspect a realistic payload. 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"}'

You’ll receive company attributes such as name, city, stateCode, countryCode, employeesRange, revenue (range), raised, and tags. Keep these fields as first-class columns or JSONB in your data store so they can be used for scoring and segmentation.

PHP integration: enrich and store company revenue

The following PHP snippet posts a domain to Klazify and extracts key fields you can upsert into your CRM or user table. It includes simple error checks so you can fail open on enrichment without breaking signups.

<?php
function fetchCompanyData(string $url, string $apiKey): array {
    $endpoint = "https://www.klazify.com/api/domain_company";
    $payload = json_encode(["url" => $url]);

    $ch = curl_init($endpoint);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Authorization: Bearer " . $apiKey,
        "Content-Type: application/json"
    ]);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $curlErr  = curl_error($ch);
    curl_close($ch);

    if ($curlErr) {
        // Network failure: do not block user flow.
        return ["ok" => false, "error" => "transport_error", "detail" => $curlErr];
    }
    if ($httpCode < 200 || $httpCode >= 300) {
        // API returned an error (not billed for unreachable/failed calls).
        return ["ok" => false, "error" => "http_" . $httpCode, "detail" => $response];
    }

    $json = json_decode($response, true);
    if (!is_array($json)) {
        return ["ok" => false, "error" => "invalid_json", "detail" => $response];
    }

    // These keys are provided by the domain_company endpoint.
    $company = $json["objects"]["company"] ?? null;
    if (!$company) {
        return ["ok" => true, "company" => null]; // Unknown/new domain or insufficient data.
    }

    // Normalize and return the fields you’ll store.
    return [
        "ok" => true,
        "company" => [
            "name"           => $company["name"] ?? null,
            "city"           => $company["city"] ?? null,
            "stateCode"      => $company["stateCode"] ?? null,
            "countryCode"    => $company["countryCode"] ?? null,
            "employeesRange" => $company["employeesRange"] ?? null,
            "revenue"        => $company["revenue"] ?? null, // A range, not an exact figure
            "raised"         => $company["raised"] ?? null,
            "tags"           => $company["tags"] ?? [],
        ]
    ];
}

// Example usage:
$apiKey = getenv("KLAZIFY_API_KEY");
$result = fetchCompanyData("https://cbsnews.com", $apiKey);
if ($result["ok"] && $result["company"]) {
    // Upsert $result["company"] into your DB, keyed by normalized domain.
    // ...
}
?>

Store the domain as your cache key and persist the returned fields to avoid re-calling the API for known domains. A 24–72 hour TTL works well for most pipelines; shorten it if you require frequent refreshes for dynamic sites.

Alternative: JavaScript example

If you prototype from Node or a serverless function, use fetch to call the same endpoint:

import fetch from "node-fetch";

async function getCompany(url, apiKey) {
  const res = await fetch("https://www.klazify.com/api/domain_company", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${apiKey}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ url })
  });

  if (!res.ok) {
    // Not billed for failed/unreachable calls, but handle gracefully
    return { ok: false, status: res.status, body: await res.text() };
  }

  const json = await res.json();
  const company = json?.objects?.company ?? null;
  if (!company) return { ok: true, company: null };

  return {
    ok: true,
    company: {
      name: company.name ?? null,
      city: company.city ?? null,
      stateCode: company.stateCode ?? null,
      countryCode: company.countryCode ?? null,
      employeesRange: company.employeesRange ?? null,
      revenue: company.revenue ?? null, // Range
      raised: company.raised ?? null,
      tags: company.tags ?? []
    }
  };
}

// Example
// const apiKey = process.env.KLAZIFY_API_KEY;
// getCompany("https://cbsnews.com", apiKey).then(console.log);

Official response example and how to use it

Below is an official example JSON from Klazify that illustrates the structure and fields you’ll work with. It contains categorization, logo, and company objects you can combine for downstream tasks like brand safety, lead scoring, and firmographic enrichment. Copy it as a reference when mapping to your own schema.


{
    "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 to consume:

  • objects.company.name, city, stateCode, countryCode: Normalize locale data to ISO codes already provided (stateCode, countryCode).
  • objects.company.employeesRange: Size brackets for sales routing or risk policies.
  • objects.company.revenue: Use as a range to bucket accounts and compute ACV tiers.
  • objects.company.raised: Funding signal for lead scoring and prioritization.
  • objects.company.tags: Use for enrichment and feature flags (e.g., “B2C”, “E-commerce”).
  • domain.categories[].name: Page/domain topical category; leverage IAB mappings where provided for ad and brand safety rules.
  • domain.logo_url: Display in your admin or CRM to help ops teams verify the entity.
  • similar_domains: Seed lookalike discovery or competitive analysis pipelines.

How to act on revenue and categories in your pipeline

  • Enrich a signup: On new account creation, call the endpoint, map revenue and employeesRange to your internal tiers, and auto-assign plans or sales routes.
  • CRM/lead enrichment: Backfill company revenue ranges and tags for domains in your leads table, cached per domain with a controlled refresh interval.
  • Brand safety and auditing: Use domain.categories with IAB taxonomy to whitelist or exclude types of content, while revenue helps you enforce minimum spend or eligibility rules.

For taxonomy alignment, keep a simple mapping table that ties Klazify category names (and any IAB codes included) to your internal segments. That way, when Klazify refreshes a domain’s classification, your rules remain deterministic.

Operational details that save time in production

Caching and TTLs

Cache responses by normalized domain (e.g., example.com). A 24–72 hour TTL balances freshness with cost and latency. Consider a background refresher for high-traffic domains so signups always benefit from warm cache hits.

Batch processing strategies

  • Queue domains from your signups and events into a worker that processes them steadily to honor your plan throughput.
  • Use idempotent storage keyed by domain to avoid duplicate calls during spikes.
  • Parallelize moderately to reduce total wall time, then throttle if your error rate rises.

Unknown or new domains

  • If objects.company is null or missing fields, mark the record as “pending enrichment” and reattempt after a backoff window.
  • Never block the core user flow; treat enrichment as asynchronous and additive.

Error handling and billing

  • Network and unreachable errors happen. Log them and continue—failed or unreachable calls are not billed.
  • Persist the raw response for troubleshooting when you detect unexpected nulls.

Data modeling tips

  • Store revenue as a structured range type or two columns (min, max) to support numeric filters and reporting. If returned as a labeled range, also store the label verbatim.
  • Keep employeesRange and tags as-is for traceability, with optional derived columns for routing rules (e.g., is_enterprise boolean).
  • Track last_enriched_at and source_version to manage refreshes and audits.

Comparing which fields to store for your use case

Use case Must-have fields Nice-to-have fields Action
Signup enrichment name, countryCode, employeesRange, revenue raised, tags Auto-assign plan and route to sales based on tiers
Ad tech brand safety domain.categories, IAB mappings, logo_url similar_domains, tags Whitelist/blacklist and audit placements
Lead scoring revenue, employeesRange raised, city/stateCode/countryCode Compute score and prioritize follow-up
Security/IT policy domain.categories tags Block or allow categories at the edge

How categorization supports revenue use cases

Even when your primary goal is revenue enrichment, categories and IAB mappings add context you can use to tighten rules:

  • Block risky signups: If a domain falls into an excluded category, require manual review regardless of revenue range.
  • Accelerate enterprise paths: Combine employeesRange with a business-relevant IAB category to trigger a tailored onboarding.
  • Audit spend: Ensure ads run on categories aligned with your ICP, taking revenue tiers into account for partner prioritization.

Pricing and getting access

Starter is $39.99/mo with a 7-day trial, enough to wire this endpoint into your sandbox and push a first batch through your staging pipeline. Spin up an account now: Register. You can review implementation details in the Documentation and platform guidance in the MCP.

Validation checklist before you ship

  • Authentication works (Bearer YOUR_API_KEY) and you’ve secured the key in your secrets manager.
  • For each domain, you persist: name, location (city/stateCode/countryCode), employeesRange, revenue (range), raised, tags, and last_enriched_at.
  • Cache keyed by domain with a documented TTL and a background refresher.
  • Graceful handling when company data is absent; user flows never block.
  • Category-to-policy mapping documented for your ad safety or signup filters.

FAQ

Does the API return exact revenue?
No. Treat revenue as a range suitable for bucketing and routing, not as a precise financial statement.

How should I handle rate limits?
Implement a queued worker that processes domains steadily and caches responses. Back off and retry with jitter on non-2xx responses. For plan specifics, see the Documentation.

Can I classify a single URL instead of a domain?
Yes. Provide either a full URL or a domain in the request body. Klazify will normalize and analyze accordingly.

What happens if the site is down?
If the call fails or is unreachable, it isn’t billed. Log the event and retry later; continue your user flow without blocking.

How do I map Klazify categories to my own taxonomy?
Maintain a small mapping table keyed by domain.categories[].name (and any included IAB codes) to your internal segments. Apply the mapping after each enrichment so policy checks remain deterministic.

Ready to enrich your signups and leads with reliable revenue ranges and firmographics? Create a free account and test the endpoint against your own domain list today: Register. If you need field-by-field details or want to explore adjacent endpoints like categorization and logos, head to the Documentation and the MCP.

Ready to use Klazify?

Start classifying websites, enriching company data, and exploring web intelligence.

Get Started Free