Integrate the Social Profiles API in Python

November 30, 2026
Integrate the Social Profiles API in Python

A signup form captures a company website, but your CRM still lacks the social profiles a sales or support team needs. You can use Klazify’s social profiles endpoint to look up those links from Python, preserve missing profiles as unknowns, and add the results to an enrichment pipeline. This guide covers the request, response handling, and operational choices needed to run that lookup across domains.

Why use domain intelligence for social profile enrichment?

Documentation describes a REST API that accepts a website URL and returns domain intelligence. For social enrichment, the useful starting point is the organization’s own website rather than a name search that may match several unrelated accounts.

Illustration: Integrate the Social Profiles API in Python

The social profiles endpoint covers Facebook, X, Instagram, YouTube, LinkedIn, GitHub, Pinterest, and Medium. A missing profile is represented as null; it should not be treated as a broken link or as proof that the organization has no account.

Klazify also supports website classification and IAB taxonomy mapping. That can complement social enrichment: for example, a lead pipeline can retain profile links for outreach while separately mapping website categories to its own reporting taxonomy. Content analysis can provide more context than a workflow based only on a domain name or page metadata, but category results and profile links still need review appropriate to their use.

For advertising or filtering workflows, classification can support an audit or policy decision; it is not itself a guarantee of safety or compliance. For CRM enrichment, the immediate action is simpler: associate the returned links with the source domain and keep their lookup status visible.

Call the social profiles endpoint

Create an account, obtain an API key, and send a JSON request with a Bearer authorization header. This complete request looks up the supplied website:

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

The request body has one field, url. Keep the API key on the server side; do not put it in browser code or commit it to a repository. The URL in the request is the lookup input, so retain it alongside the response for traceability.

Read the response in Python

The following example uses Python’s standard library. It accepts a website URL as a command-line argument and reads the key from the KLAZIFY_API_KEY environment variable. It prints the response’s scalar values with their paths, including null values, so you can inspect the actual platform fields before mapping them into your own schema.

import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

ENDPOINT = "https://www.klazify.com/api/domain_social_media"


def show_values(value, path="$"):
    if isinstance(value, dict):
        for key, child in value.items():
            show_values(child, f"{path}.{key}")
    elif isinstance(value, list):
        for index, child in enumerate(value):
            show_values(child, f"{path}[{index}]")
    else:
        print(f"{path}: {json.dumps(value, ensure_ascii=False)}")


def main():
    if len(sys.argv) != 2:
        sys.exit("Usage: python social_profiles.py WEBSITE_URL")

    api_key = os.environ.get("KLAZIFY_API_KEY")
    if not api_key:
        sys.exit("Set KLAZIFY_API_KEY before running this script.")

    payload = json.dumps({"url": sys.argv[1]}).encode("utf-8")
    request = Request(
        ENDPOINT,
        data=payload,
        headers={
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json",
        },
        method="POST",
    )

    try:
        with urlopen(request, timeout=30) as response:
            result = json.load(response)
    except HTTPError as exc:
        sys.exit(f"API request failed with HTTP status {exc.code}.")
    except URLError as exc:
        sys.exit(f"Could not reach the API: {exc.reason}")
    except (OSError, ValueError) as exc:
        sys.exit(f"Could not read the response: {exc}")

    show_values(result)


if __name__ == "__main__":
    main()

Save the script as social_profiles.py, set KLAZIFY_API_KEY in your environment, and run it with the website URL as its argument. The timeout is a client-side setting, not a statement about API latency. Adjust it to your application’s tolerance and treat a timeout as an unresolved lookup, not a missing social profile.

The recursive output deliberately preserves the paths returned by the API instead of assuming platform key names. Once you have checked those paths against the documentation and a live response, map the relevant values to your CRM or database fields. Keep null distinct from an empty string, an HTTP error, and a domain that has not yet been checked.

Understand the broader domain response

The following is a documented domain-data example. It illustrates the broader categorization and company fields available in Klazify data; it is not an example response from the social profiles endpoint called 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"
    ]
}

In this example, domain.categories is a list. Each item has a name and confidence; the first also includes the shown IAB mapping. These confidence values are response values for this example, not a published accuracy rate or an automatic policy threshold.

The example’s domain.social_media is null, so there are no social links to use from that field. The broader response also includes a logo URL and company data under objects.company. Treat registration dates, company details, and similar domains as separate enrichment signals rather than substitutes for a verified social profile.

Map categories without losing the source

If your workflow also classifies websites, store the returned category names and any IAB mapping alongside your internal labels. A single website can have multiple categories, so avoid reducing the response to one label before your policy has decided how to handle multiple matches.

For example, an analytics pipeline might map a returned category to an internal reporting group while retaining the original category and confidence for review. A filtering system should define separately what happens when no category is available, when several categories match, or when a result falls below a threshold chosen by the organization. Do not infer that a domain is safe merely because a category or profile is missing.

Run the lookup reliably at scale

Queue and cache by domain

For a signup flow, you can accept the signup immediately and run enrichment asynchronously. Normalize the submitted website into a consistent domain cache key, while retaining the original URL sent to the API. That allows repeated signups from the same domain to share a recent lookup without losing the input needed for an audit.

Store the lookup time, raw response, processing status, and mapped profile values together. Choose a refresh policy based on how quickly your application needs profile changes to appear. Social links can change, so a cached result should not be treated as permanent.

At higher volume, place individual lookups on a queue and control worker concurrency according to your plan’s rate limits. Check the current limits and guidance before deploying; the example above sends one URL per request and does not assume a bulk endpoint. Deduplicate queued work for the same domain to reduce unnecessary calls.

Separate missing data from failures

A null profile is a data result. An unreachable API, a timeout, an invalid response, or an HTTP error is an operational failure. Record those states separately so a temporary failure does not overwrite a previously known profile with an apparent absence.

For transient failures, use bounded retries with backoff and route persistent failures to a review or retry queue. Avoid retrying indefinitely. Failed or unreachable calls are not billed, but your application still needs to monitor errors and prevent a backlog from overwhelming workers.

New or unknown domains may have incomplete results. Mark them for a later refresh or manual review, and decide whether downstream users should see “not found,” “pending,” or another status defined by your product. Do not automatically turn missing social links into a negative assessment of the company.

Protect downstream consumers

Validate that profile values are usable URLs before displaying or exporting them, and retain the original returned value for troubleshooting. If a result will drive outreach, a person or an appropriate review process should confirm that the profile belongs to the intended organization.

Monitor request failures, queue age, cache refreshes, and the share of lookups that return missing values. These measurements help distinguish an integration problem from a dataset that genuinely contains many unknowns. For teams building agent-assisted workflows, Klazify also provides an MCP option; the Python integration above uses the REST endpoint directly.

FAQ

Which social platforms can the endpoint return?

The supported profiles are Facebook, X, Instagram, YouTube, LinkedIn, GitHub, Pinterest, and Medium. Inspect the actual response and documentation when mapping platform fields into your application.

What does a missing profile mean?

A missing profile is null. It means the lookup did not provide a profile value; it does not prove that an account does not exist. Keep this state separate from request failures.

Can I classify the same website as well?

Klazify supports website categorization and IAB taxonomy mapping through its categorization capabilities. Treat category enrichment as a separate workflow from the social endpoint request shown here, and retain the original categories when mapping them to internal labels.

How should I handle repeated domain lookups?

Cache results per normalized domain, record when they were retrieved, and refresh them according to your freshness requirements. Use a queue and plan-aware concurrency controls for larger workloads.

What does the Starter plan cost?

Starter is $39.99 per month with a seven-day trial. Review the current plan details before selecting the limits and refresh schedule for your pipeline.

Ready to enrich website records? Register for a free account, obtain your API key, and test the social profiles request with a domain in your own workflow.

Ready to use Klazify?

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

Get Started Free