Integrate the Company Logo API in PHP

November 05, 2026
Integrate the Company Logo API in PHP

You need to display accurate company logos in your product—on signup forms, in CRM records, or in analytics dashboards—and you want a solution you can plug into your PHP backend that returns a stable, hosted logo URL for any domain. By the end of this guide you’ll have a working PHP integration using Klazify’s Company Logo API, plus patterns for caching, error handling, and how to use the additional fields (like categories and company data) when you also call the categorization endpoint.

Why Klazify is the best fit for company logo enrichment at scale

Logos aren’t just nice-to-have visuals; they drive recognition, reduce manual data entry, and improve the quality of enriched signups and B2B data. Klazify’s domain intelligence is built to solve this at scale, with logo discovery tied to the same models that categorize and understand websites.

Illustration: Integrate the Company Logo API in PHP
  • Accurate website categorization using AI: Klazify analyzes full site content rather than just metadata. This helps disambiguate similarly named companies and align the correct logo with the correct domain.
  • Global coverage: Multi-language analysis means you can enrich logos for domains across markets and geographies—useful for international signup funnels or global CRM data.
  • Real-time classification: Because classification is computed from current content, you avoid stale logo associations that come from static databases.
  • Industry-level categories: Results map to IAB taxonomy, letting you pair the right logo with brand-safety and targeting contexts in ad tech or content filtering.
  • Simple API integration: A single REST POST with the domain returns a hosted logo URL. You can also call the categorization endpoint to get categories, social links, and company info alongside the logo.
  • Compliance and filtering: Combine logo enrichment with IAB categories to whitelist or flag domains while maintaining consistent brand presentation in your UI.

If you’re standardizing logos in a signup enrichment flow, populating CRM accounts, or auditing where ads run, the same response fields will fit your pipeline without custom scraping or manual curation.

What you will build

We’ll build a PHP service that takes a user-entered domain, calls the Company Logo API, and stores the returned hosted logo URL for reuse. You’ll also see how to handle timeouts and unknown domains gracefully, plus how to optionally enrich with categories using the categorization endpoint for downstream brand safety or segmentation.

  • Input: A domain or full URL from your app (e.g., user signup).
  • Call: POST https://www.klazify.com/api/domain_logo with a JSON body containing the URL.
  • Output: A hosted logo URL in the JSON response you can render in your UI or store in your database.
  • Optional: Call the categorization endpoint to retrieve IAB categories, company profile, and the same logo URL if you need richer enrichment.

Create a free account to get your API key and start testing: Register. You can also find the full API reference here: Documentation.

Quickstart: cURL request for a company logo

The Company Logo API accepts a POST with a JSON payload that includes the website URL. Authentication uses a Bearer token. Here’s a copy-pasteable example:

curl -X POST "https://www.klazify.com/api/domain_logo" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://cbsnews.com"}'

On success, the response JSON includes a hosted logo URL that you can store and reuse. Failed or unreachable calls are not billed, so it’s safe to implement retries with backoff without cost surprises.

PHP integration: fetch and cache the logo URL

This PHP example posts the user’s domain to the Company Logo API, reads the hosted logo URL field from the JSON response, and caches it by domain. You can store the URL and a timestamp in your database to avoid repeated network calls.

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

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

    $response = curl_exec($ch);
    $err = curl_error($ch);
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($err) {
        // Network error: implement retry with backoff in your app layer
        return null;
    }
    if ($status < 200 || $status >= 300) {
        // Non-2xx: log the body for diagnostics
        return null;
    }

    $data = json_decode($response, true);
    // The logo is returned as a hosted URL in the JSON. Read that value.
    // When you also use the categorization endpoint, the logo is found under domain.logo_url.
    // Here, extract the URL field returned by the logo endpoint.
    if (isset($data["domain"]["logo_url"])) {
        return $data["domain"]["logo_url"];
    }

    // If your response packs the hosted logo URL at a top-level field, read it here instead:
    if (isset($data["logo_url"])) {
        return $data["logo_url"];
    }

    return null;
}

// Example usage:
$apiKey = "YOUR_API_KEY";
$inputUrl = "https://example.com";

// Check your cache first (e.g., database table keyed by domain)
// If not cached or stale, fetch from Klazify:
$logoUrl = getCompanyLogoUrl($inputUrl, $apiKey);

if ($logoUrl) {
    // Persist for reuse (domain, logo_url, fetched_at)
    // Render in HTML templates or return via your API
    echo "Logo URL: " . htmlspecialchars($logoUrl, ENT_QUOTES);
} else {
    // Fallback: show a neutral placeholder image hosted by you
    echo "No logo found for " . htmlspecialchars($inputUrl, ENT_QUOTES);
}

Notes:

  • Cache by domain to reduce latency and API calls. A common pattern is to refresh logos every few weeks, or on a 404 image check.
  • Timeouts: a 10s timeout is a safe starting point; adjust for your SLA.
  • Retries: implement limited retries for transient network issues. Failed or unreachable calls are not billed.

JavaScript example: read the hosted logo URL

If you prefer JavaScript (for a Node.js job or a small utility), here’s how to call the same endpoint and extract the hosted logo URL:

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

  // Non-2xx handling
  if (!res.ok) {
    // Log res.status/res.text() for diagnostics
    return null;
  }

  const data = await res.json();

  // When using the categorization endpoint, logo lives in data.domain.logo_url.
  // The logo endpoint returns a hosted logo URL in its JSON; read it accordingly:
  if (data?.domain?.logo_url) return data.domain.logo_url;
  if (data?.logo_url) return data.logo_url;

  return null;
}

// Example usage
(async () => {
  const apiKey = "YOUR_API_KEY";
  const url = "https://example.org";
  const logo = await fetchLogoUrl(url, apiKey);
  console.log("Logo URL:", logo);
})();

Using categorization data alongside logos

When you also call the categorization endpoint, you get website categories, a logo URL inside the domain object, and detailed company information from the URL. This is valuable for workflows that combine brand visuals (logo) with targeting, filtering, or analytics.

Here is the official example response. Use it as your reference for fields and structure:


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

  • domain.logo_url: a hosted URL to the logo. Store this and render directly in your UI.
  • domain.categories: hierarchical categories plus optional IAB taxonomy code mapping. Use to filter or segment traffic, or to enforce brand-safety policies.
  • objects.company: company URL, name, location, employeesRange, revenue, tags, and tech stack. Useful for lead enrichment, routing, and sales qualification.
  • domain_registration_data: dates and days-left fields you can use to flag very new or soon-to-expire domains for review.
  • similar_domains: related domains to expand discovery or suggest deduplication checks in your CRM.

If your use case only needs logos, call the Company Logo API for minimal payload and fast responses. If you need both logos and categorization, call the categorization endpoint and read domain.logo_url from the same response.

Batching, rate limits, and caching strategy

For large-scale enrichment, your design should minimize duplicate calls, respect rate limits, and keep latency low for end users. Here’s a high-level approach:

  • Batching: When processing backfills or large imports, group calls in parallel workers, each with a small concurrency limit (e.g., 5–10 in flight). Space out batches with a short delay to avoid burst-related throttling.
  • Rate limits: Handle 429 or similar throttling responses by backing off and retrying with jitter. Keep a moving window counter per service instance to stay under your negotiated throughput.
  • Caching per domain: Store the hosted logo URL, the source domain, and fetched_at. Refresh on a schedule (e.g., every few weeks) or when you receive repeated failures from your CDN/image proxy.
  • Idempotency: For the same input domain, always look up the cache first to reduce latency and spend.
  • Unknown or new domains: If no logo is returned, store a null result with a short TTL (for example, 24–72 hours) to avoid hammering the endpoint; try again later in case the site launches assets.

Mapping categories to your own taxonomy

If you also use categories with your logos—for example, to tint logos differently by industry or to apply brand-safety rules—you can map the returned categories to your internal labels. Klazify returns a hierarchical path in domain.categories.name and can include IAB taxonomy mapping codes.

Common approaches for mapping:

Approach What you map When to use Pros Cons
Direct IAB usage Use the IAB mapping from the category object as-is Ad tech and brand safety Standards-aligned, interoperable May be too granular for simple UIs
Path-to-tier mapping Map the category path (e.g., “/A/B/C”) to 3–10 internal buckets Product UIs, CRM enrichment Simple, easy to understand Loses some granularity
Hybrid Retain IAB under the hood, expose simplified tiers in the UI Mixed stakeholders (ad ops + product) Best of both worlds Requires a small mapping layer

Store both the raw IAB-mapped value and your simplified bucket in your database. That way, you can pivot later without reprocessing domains.

Operational details that save time

  • Retries and billing: Implement retry with exponential backoff on transient failures; failed or unreachable calls are not billed.
  • Image delivery: The returned logo URL is already hosted; you can serve it directly or proxy through your CDN. If you proxy, set a reasonable TTL (e.g., days to weeks) and purge on domain changes.
  • Security: Keep your Bearer token server-side. Make logo fetches from your backend rather than exposing your API key in client code.
  • Testing: Start with a small set of known domains, verify the hosted URL is stable across deployments, then move to batch backfill for your existing accounts table.
  • Pricing: A Starter plan is available at $39.99/mo with a 7-day trial so you can validate your integration before committing.
  • Change management: If you notice many cache misses or null logos, queue domains for a periodic recheck. Newly launched sites often add logos after initial setup.

Putting it all together: end-to-end enrichment flow

Signup or import step

  • Normalize input: Lowercase domain, strip query strings and fragments, handle common subdomains.
  • Cache lookup: If you have a cached logo URL for the domain and it’s fresh, return it immediately.
  • Fetch: Call the Company Logo API and store the hosted logo URL on success.
  • Optional enrich: If you also want IAB categories or company data, call the categorization endpoint and use domain.logo_url from that same response.

Render and monitor

  • Render: Use the stored hosted URL in your UI components. Consider a lazy-load image strategy for list views.
  • Fallback: If the image returns 404s later, temporarily switch to your neutral placeholder and schedule a refresh call.
  • Audit: Maintain a dashboard of recent fetches, response times, and failure rates to spot integration issues early.

API references and platform tooling

Explore the full endpoint reference, request/response formats, and additional capabilities beyond logos (categorization, company data, technology detection) here: Documentation.

If you manage multiple keys, environments, or need higher-level controls, review the management and control panel: MCP.

Common pitfalls and how to avoid them

  • Calling from the frontend: Do not embed your API key in browser code. Route requests through your server to protect credentials.
  • Skipping normalization: Treat http/https and “www.” as the same for caching. Always normalize before cache lookups.
  • No backoff on errors: Add exponential backoff and jitter for transient failures to avoid thundering herds.
  • Infinite retries on unknown domains: Cache null results with a short TTL to avoid repeated failed lookups.
  • Over-enrichment on hot paths: If you need categories too, consider performing categorization in a background job after immediately returning the logo URL to the user interface.

FAQ

  • Does the logo URL change over time?
    The returned URL is a hosted asset. It can change if the source logo changes or is reprocessed. Cache the URL and refresh it periodically or upon image failures.
  • What happens if a domain has no detectable logo?
    You’ll receive no usable logo URL. Cache a null result with a short TTL and retry later. Provide a neutral fallback image in your UI.
  • How do I get both the logo and categories in one flow?
    Call the categorization endpoint and read domain.logo_url from the response. You’ll also receive categories (including IAB mapping) and company data in the same payload.
  • Can I process thousands of domains quickly?
    Yes. Use parallel workers with controlled concurrency, implement backoff on throttling, and cache results per domain. Space batches to respect rate limits.
  • How do billing and retries work?
    Failed or unreachable calls are not billed, so implementing safe retries for transient errors won’t increase costs unexpectedly.

Ready to ship your integration? Start your 7-day trial and get your API key here: Register. Explore more capabilities—categorization, company profiles, and technology detection—on https://www.klazify.com and the Documentation.

Ready to use Klazify?

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

Get Started Free