How to Get a Company's Social Profiles in Python

November 17, 2026
How to Get a Company's Social Profiles in Python

Your product team needs to enrich signups and company records with verified social profiles, so your CRM, analytics, and ad ops have a single source of truth. By the end of this guide, you’ll call a single API from Python to fetch a company’s Facebook, X, Instagram, YouTube, LinkedIn, GitHub, Pinterest, and Medium profiles, handle nulls when a profile doesn’t exist, and plug the data into your pipeline with sane caching and retry logic.

Why Klazify for pulling verified company social profiles

When your goal is to get accurate, up-to-date social handles from a company’s domain and wire them directly into Python jobs, Klazify provides a clean, developer-focused path:

Illustration: How to Get a Company's Social Profiles in Python
  • Accurate website categorization using AI: The same analysis that powers categorization also underpins social link detection, scanning real site content rather than guessing from whois or stale directories.
  • Global coverage: Whether the site is in English, Spanish, or Japanese, Klazify analyzes content to discover official social URLs embedded across pages.
  • Real-time classification: Lookups happen at request time instead of relying exclusively on static caches, keeping social links fresh.
  • Industry-level categories (IAB): When you also need brand safety or audience alignment, the API maps content to industry-standard IAB taxonomy—useful for ad tech and content filtering.
  • Simple API integration: A single JSON POST with a domain or URL returns social links for Facebook, X, Instagram, YouTube, LinkedIn, GitHub, Pinterest, and Medium. Missing profiles return null.
  • Compliance and filtering: Pair social profile detection with categorization and brand safety checks to audit where your ads run, filter prohibited content, or enforce signup rules.

If you’re building domain enrichment at scale, Klazify’s REST endpoints let you combine social discovery with categories, logo URLs, and company data for a cleaner downstream model. Explore the platform at klazify.com and get started with a free 7-day trial on the Starter plan ($39.99/mo). Failed or unreachable calls are not billed.

What we’ll build: enrich a domain with social handles in Python

We’ll call the dedicated social endpoint to retrieve official profiles and then normalize and store them. You’ll learn to:

  • Authenticate with a Bearer token and POST a JSON payload containing a URL.
  • Parse the response and handle nulls when a profile is unavailable.
  • Cache results per domain to avoid repeated lookups.
  • Batch lookups safely and implement retries without overloading the endpoint.

We’ll also show the main categorization response format so that, if needed, you can augment social handles with IAB categories, logo URLs, and company information.

Endpoint and authentication

Klazify exposes a dedicated endpoint to retrieve social media URLs for a domain or URL:

  • HTTP method: POST
  • Endpoint: https://www.klazify.com/api/domain_social_media
  • Auth: Bearer token via Authorization header
  • Body: JSON with a single url field

Example JSON body: {"url":"https://cbsnews.com"}

Missing profiles are returned as null. That makes it straightforward to store results without guessing or web-scraping.

If you don’t have an API key yet, create a free account: Register. You can also browse the endpoint reference in the Documentation and learn about the platform’s managed compute at MCP. Platform overview: klazify.com.

Copy-pasteable curl to fetch a company’s social profiles

This request uses a Bearer token and a JSON body with the site URL. Replace YOUR_API_KEY with your token.

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

On success, the API returns the set of discovered profile URLs for these platforms: Facebook, X, Instagram, YouTube, LinkedIn, GitHub, Pinterest, and Medium. Any platform not found will be null.

Python example: request, parse, and store social profiles

This Python example posts a domain to the social endpoint, parses the JSON, and normalizes the values, leaving nulls intact for downstream processing.

import os
import time
import json
import requests
from urllib.parse import urlparse

API_KEY = os.getenv("KLAZIFY_API_KEY", "YOUR_API_KEY")
SOCIAL_ENDPOINT = "https://www.klazify.com/api/domain_social_media"
HEADERS = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}",
}

def normalize_domain(raw_url: str) -> str:
    """
    Normalize to registrable domain for caching keys.
    Assumes input is an absolute URL or bare domain.
    """
    if "://" not in raw_url:
        raw_url = "https://" + raw_url
    host = urlparse(raw_url).hostname or raw_url
    return host.lower()

def get_social_profiles(url: str, retries: int = 3, backoff: float = 0.8) -> dict:
    """
    Call Klazify social endpoint and return JSON.
    Missing social profiles are null in the response.
    Retries on transient network/server issues.
    """
    payload = {"url": url}
    for attempt in range(1, retries + 1):
        try:
            resp = requests.post(SOCIAL_ENDPOINT, headers=HEADERS, json=payload, timeout=20)
            if resp.status_code == 200:
                return resp.json()
            # 4xx/5xx handling: log and retry on 5xx, break on definite 4xx
            if 500 <= resp.status_code < 600 and attempt < retries:
                time.sleep(backoff * attempt)
                continue
            # Non-2xx: return structured error for caller to handle
            return {
                "success": False,
                "status_code": resp.status_code,
                "error": resp.text
            }
        except requests.RequestException as e:
            if attempt < retries:
                time.sleep(backoff * attempt)
                continue
            return {"success": False, "error": str(e)}

def flatten_socials(data: dict) -> dict:
    """
    Example flattener that extracts standard fields if present.
    Any missing platform remains None for consistent storage.
    """
    # Exact field names depend on the endpoint's response keys.
    # Here we defensively access typical social keys and keep None if missing.
    platforms = ["facebook", "x", "instagram", "youtube", "linkedin", "github", "pinterest", "medium"]
    out = {}
    for p in platforms:
        out[p] = None
    # Merge in any keys returned by the API while preserving our canonical set
    if isinstance(data, dict):
        for k, v in data.items():
            if k in out:
                out[k] = v
            # If the API nests results (e.g., under "social" or "profiles"), handle it here:
            if isinstance(v, dict):
                for kk, vv in v.items():
                    if kk in out:
                        out[kk] = vv
    return out

if __name__ == "__main__":
    domain = "https://cbsnews.com"
    raw = get_social_profiles(domain)
    socials = flatten_socials(raw if isinstance(raw, dict) else {})
    # Example: print, then persist to your datastore of choice
    print(json.dumps({"domain": normalize_domain(domain), "socials": socials}, indent=2))

Notes for production:

  • Caching: Cache results per registrable domain to reduce latency and cost. Re-check on a schedule appropriate for your data freshness needs.
  • Retries: The example uses exponential backoff. Klazify does not bill for failed or unreachable calls.
  • Null vs empty: The endpoint returns null for missing platforms—store null as-is to avoid ambiguity.

Understanding the core categorization payload (for full enrichment)

Many teams pair social profiles with categories, logo URLs, and company attributes. The main categorization endpoint returns a rich object containing IAB categories, a logo URL, company data, domain registration fields, and similar domains. Below is the official sample you can expect from the categorize endpoint.


{
    "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 alongside social profiles:

  • domain.categories: Use the IAB mapping to drive brand safety and content filtering rules while still enriching with social handles.
  • domain.logo_url: Store a logo to surface brand context when your CRM shows social links.
  • objects.company: Derive descriptive metadata (name, location, employeesRange, revenue) to improve scoring and routing when social profiles are found.
  • domain_registration_data: Prioritize outreach based on domain age or monitor expiring domains you actively track.
  • similar_domains: Expand account mapping or deduplicate by linking related properties that may share social profiles or brand identity.

Field mapping: from API output to your data model

For most enrichment pipelines, you’ll want a consistent set of fields whether or not the site has every social handle. Keep missing profiles as null to clearly indicate “not found.”

Platform Expected value Downstream field Notes
Facebook Official Facebook Page URL or null social.facebook_url Use for social widgets or page-scrape stats.
X Official X (Twitter) profile URL or null social.x_url Store canonical handle separately if needed.
Instagram Official Instagram URL or null social.instagram_url Feed embedding or brand monitoring.
YouTube Channel/Profile URL or null social.youtube_url Use channel ID extraction if required.
LinkedIn Company Page URL or null social.linkedin_url Map to CRM companies if your connector supports it.
GitHub Organization URL or null social.github_url Useful for developer tools and OSS footprint analysis.
Pinterest Profile/Board URL or null social.pinterest_url Retail and lifestyle verticals.
Medium Publication/User URL or null social.medium_url Content marketing footprint.

Operational details that save time

Batching and concurrency

  • Batching: Drive lookups in small concurrent batches (e.g., worker pools) and apply a per-domain cache to avoid duplicate requests.
  • Retries: Use exponential backoff for transient failures. Klazify does not bill for failed or unreachable calls.
  • Monitoring: Track non-2xx response rates and timeouts to tune concurrency and backoff.

Caching strategy

  • Key by registrable domain (e.g., example.com). If you enrich sub-brands on subdomains, consider a two-level cache: exact host and parent domain.
  • Set a TTL appropriate to your freshness needs. Social profiles don’t change daily for most domains; weekly or monthly updates are typical.
  • Cold start: For domains not in cache, call the API; store nulls explicitly to avoid repeated failed lookups.

Handling unknown or new domains

  • Unknown or empty: If no social profiles are found, the platform returns null for those platforms. Persist null and schedule a recheck later.
  • Unreachable domains: Network errors or unreachable sites are possible; implement retries and circuit breaking to preserve throughput.

Mapping to your taxonomy

  • If you maintain internal categories, store the IAB path(s) alongside your own mapping table. Use the main categorization endpoint to populate and refresh this mapping.
  • For brand safety, keep both the IAB category and confidence score to support deterministic or threshold-based rules.

Complete JSON responses for integration reference

Below are complete JSON response examples you can use to validate your parser and unit tests. The categorization sample is included exactly as provided for fidelity.


{
    "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"
    ]
}

{
    "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"
    ]
}

{
    "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"
    ]
}

Plugging results into your pipeline

  • Data warehouse: Upsert each domain row with social.facebook_url, social.x_url, etc. Preserve nulls. Maintain a last_checked timestamp.
  • CRM enrichment: On company creation, fetch social URLs; map LinkedIn and X handles to contact enrichment rules if you have separate connectors.
  • Ad ops and brand safety: Combine IAB category fields with official social channels to audit placements and validate partner brand presence.
  • Analytics: Use discovery rates by platform to measure coverage across your portfolio and drive retries or manual verification for high-value domains.

Cost, reliability, and rollout tips

  • Plan: Starter is $39.99/mo with a 7-day trial. It’s a safe way to validate coverage on your domain list before scaling.
  • Failed call policy: Failed or unreachable calls are not billed, so you can implement retries confidently.
  • Progressive rollout: Start with a daily job that enriches newly added domains; then backfill existing records in controlled batches while monitoring error rates.

Common patterns and safeguards

  • De-duplication: Normalize and lowercase domains. If you track multiple URLs per brand, pin a primary domain for caching.
  • Change detection: If a previously present profile becomes null, queue a manual review before overwriting the prior value.
  • Backoff policy: Use exponential backoff on 5xx or network failures. For 4xx (e.g., invalid input), fix and re-queue.

FAQ

Which social platforms are covered?
Facebook, X, Instagram, YouTube, LinkedIn, GitHub, Pinterest, and Medium. If a platform isn’t found, it returns null.

What input should I send: domain or full URL?
Send a URL in the JSON body as {"url":"https://example.com"}. The API accepts a URL or domain; using a canonical homepage URL is a good default.

How often should I refresh?
Most teams refresh weekly or monthly. Profiles don’t change frequently; use a cache with a TTL that matches your freshness requirements.

Can I combine social handles with IAB categories and company info?
Yes. Use the main categorization endpoint to retrieve categories, logo URL, company metadata, and registration fields, and store them alongside social URLs.

How do I get started?
Create your account and get an API key. Starter is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed.

Start enriching your domains with verified social profiles in minutes. Create your free trial account now: Register. Explore the Documentation and learn more about the platform at klazify.com.

Ready to use Klazify?

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

Get Started Free