LinkedIn Company Research API Tutorial | SandBase

Use a LinkedIn company URL to request profile data and research company posts with Python. Covers affiliated pages and pagination limits.

Dark cinematic render of a LinkedIn company profile resolving into a feed of company posts, feeding an agent core

If you do B2B research or competitive intelligence, a known LinkedIn company URL gives you two distinct research tasks: inspect company details or read page updates. This LinkedIn Company Research API tutorial uses two SandBase endpoints — read the company profile, then request its posts — with a historical Python reader for the observed results. It builds on the LinkedIn public data API hub; read that first for the big picture.

This workflow covers public, read-only company data and requires a SandBase API key. Use the current reference for documented inputs and response guidance, not an always-present field guarantee. The current profile README documents fields and a trimmed example; the payload field names in the historical readers below come from calls I ran (tested on 2026-09-28, UTC) and remain illustrative, observed-only. Editorial update: 2026-11-06. This repair reviewed documentation and ran offline tests, not new API calls; it does not redate the historical test.

Key takeaway

  • Two endpoints serve different tasks: company-profile (company details) → company-posts (public page updates).
  • Each call is POST /v1/api/linkedin/web-v2/<path> with a company url and SANDBASE_API_KEY.
  • Both endpoints take the same company url; the readers below retain the 2026-09-28 observations.
  • Public, read-only data only — no posting, no private/account-only data.

SandBase vs. the official LinkedIn API

Your needUse
Public, read-only company profiles and postsSandBase LinkedIn public-data API
Manage a page, post, or use Marketing/partner APIsLinkedIn’s official APIs
Private or member-only dataNeither public workflow

The workflow at a glance

  1. Read the profile with linkedin/web-v2/company-profile using a company url.
  2. Pull the posts with linkedin/web-v2/company-posts using the same url.

The historical examples use id, status, model, and outputs[0].data; the current profile README also documents that payload path.

SandBase LinkedIn API page with the endpoints used in this workflow Retained historical catalog screenshot — company-profile and company-posts are the two endpoints used here, not evidence of a new 2026-11-06 run.

One company URL, two research actions

For a LinkedIn company profile API by URL, send the full https:// company URL to company-profile. The current profile README documents company details including company_size, headquarters, followers, affiliated, and similar. Retrieved on 2026-11-06, it labels its nonempty Microsoft response as a real, trimmed sample, with lists and strings shortened. That is dated reference material, not a response obtained in this repair or a guarantee of complete fields on every call.

Use affiliated as a lead to associated pages, which may include subsidiaries or showcase pages, not proof of legal ownership or a complete corporate tree. similar is a separate list of peer pages, not affiliated organizations. An employee size range, employees shown on LinkedIn, and followers measure different things. Missing values or lists stay unknown; do not turn them into zero or proof of no relationships. The README’s limited employee and update samples are not complete inventories.

For a LinkedIn company posts API by company URL, use company-posts with the same URL to research page updates rather than profile fields. The current README describes recent and top ordering; neither establishes real-time coverage. Its optional types conflict with the FAQ, so the requests here omit those options.

How to get LinkedIn company data with Python

Use Model API POST, not catalog GET, with a key in the server environment. Check the company-profile request reference before running this unexecuted, request-only example. It checks HTTP and JSON decoding, not application completion. The decoded JSON stays opaque; it is not a new business-field parser or a new response fixture.

Python
import os
import requests

key = os.environ.get("SANDBASE_API_KEY")
if not key:
    raise RuntimeError("Set SANDBASE_API_KEY in the server environment")

resp = requests.post(
    "https://api.sandbase.ai/v1/api/linkedin/web-v2/company-profile",
    headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
    json={"url": "https://www.linkedin.com/company/microsoft/"},
    timeout=70,
)
resp.raise_for_status()
response = resp.json()  # Opaque JSON; no field or envelope parser.
# Keep the response opaque; do not log the full payload by default.

Before adding company-post pagination

The company-posts reference describes start offsets and a pagination_token from prior paging. These are parameter descriptions, not tested second-page instructions. As retrieved on 2026-11-06, the README calls start, sort_by, and pagination_token strings while the FAQ calls them any. No posts response sample was shown there. Do not infer a token subfield, assume offset-plus-token behavior, or treat the documented offset step as a fixed number of posts.

Second-page code requires product approval of the formal input types and both pagination modes, plus two redacted real pages from the same company and ordering. Those records must confirm the token location and binding, safe logging, and terminal or non-advancing behavior. Until then, no continuation example or complete-history promise belongs here.

Step 0: one helper for every call

The following helper is for the retained historical readers. Its dict requirement serves those readers, not a general claim about the current posts schema. It checks completion and reads only the documented outputs[0].data; missing or invalid data raises an error, while a genuine empty dictionary remains valid. Failure messages do not echo upstream error contents.

Python
import os
import requests

API = "https://api.sandbase.ai/v1/api"
HEADERS = {
    "Authorization": f"Bearer {os.environ['SANDBASE_API_KEY']}",
    "Content-Type": "application/json",
}

def call(path: str, payload: dict) -> dict:
    resp = requests.post(f"{API}/{path}", headers=HEADERS, json=payload, timeout=70)
    resp.raise_for_status()
    body = resp.json()
    if not isinstance(body, dict):
        raise RuntimeError("SandBase response must be a JSON object")
    if body.get("status") != "completed":
        error = body.get("error")
        if isinstance(error, dict):
            error = error.get("message")
        detail = "error reported" if isinstance(error, str) and error else "no error message"
        raise RuntimeError(f"SandBase call did not complete ({detail})")
    outputs = body.get("outputs")
    if not isinstance(outputs, list) or not outputs or not isinstance(outputs[0], dict):
        raise RuntimeError("SandBase response is missing valid outputs[0].data")
    if "data" not in outputs[0] or not isinstance(outputs[0]["data"], dict):
        raise RuntimeError("SandBase outputs[0].data must be a JSON object for this historical reader")
    return outputs[0]["data"]

Step 1: read the company profile

Python
url = "https://www.linkedin.com/company/openai"
profile = call("linkedin/web-v2/company-profile", {"url": url})
print(profile.get("company_size"), "|", profile.get("followers"), "followers")
print("HQ:", profile.get("headquarters"))

In the response I captured (company-profile run id 79201745-d83f-4b1f-bee3-ba676cd1a1f0, tested on 2026-09-28, UTC), the payload carried about, description, company_size, followers, employees, and headquarters — illustrative, observed-only fields. Read each with .get() and confirm against a live response.

SandBase API reference for the LinkedIn company-profile endpoint Retained historical company-profile reference screenshot — not the current README field inventory or evidence of a new test.

Step 2: pull the company posts

Check the separate company-posts request reference for page updates. This code retains the historical business reader; feed.get("data", []) is an observed inner list path, not a new general payload parser.

Python
feed = call("linkedin/web-v2/company-posts", {"url": url})
posts = feed.get("data", [])
paging = feed.get("paging")
for p in posts[:5]:
    print(p.get("num_likes"), "likes,", p.get("num_comments"), "comments -", p.get("posted"))

In my 2026-09-28 UTC run (company-posts run id acda947a-5c3e-4114-a762-b1474e333bff), the payload carried a data list of posts (each with num_likes, num_comments, num_reposts, posted, and poster) plus a paging object. This is a dated observation, not confirmation of a usable token path or a second page. Apply the pagination prerequisites above before implementing continuation.

SandBase API reference for the LinkedIn company-posts endpoint Retained historical company-posts reference screenshot — the request uses the same company URL; the continuation mechanism remains unverified here.

Putting it together

Python
def research(company_url: str):
    profile = call("linkedin/web-v2/company-profile", {"url": company_url})
    feed = call("linkedin/web-v2/company-posts", {"url": company_url})
    posts = feed.get("data", [])
    engagement = [
        {"posted": p.get("posted"), "likes": p.get("num_likes"), "comments": p.get("num_comments")}
        for p in posts if isinstance(p, dict)
    ]
    return {
        "company_size": profile.get("company_size"),
        "followers": profile.get("followers"),
        "recent_posts": engagement,
    }

Both endpoints take the same company url, keeping the historical loop flat. The .get() paths in research() belong to the 2026-09-28 observations, not a current general schema. Missing company or engagement counts remain None, not fabricated zeroes; an empty local post list does not prove there were no posts.

Common use cases

These uses refer to the historical fields above; check availability before comparing records.

Competitive intelligence

Read a competitor’s company_size, followers, and headquarters, then pull recent posts to see what they promote and how it lands (likes, comments, reposts). Input: a company url. Output: firmographics plus a post-engagement sample. Endpoints: company-profile, company-posts.

Lead and account research

Enrich a target-account list with company_size and followers from company-profile to prioritize outreach. Input: company urls. Output: comparable firmographics. Endpoint: company-profile.

Content and messaging analysis

Pull a company’s posts and analyze poster, cadence, and engagement to understand their content strategy. Input: a company url. Output: a post feed with engagement. Endpoint: company-posts.

Hiring and growth signals

A company’s company_size and followers over successive reads, combined with themes in its posts, may offer directional signals, not proof of growth. If you collect comparable snapshots, keep missing values unknown and record their dates. Field availability and ordering can vary. Input: a company url. Output: bounded company and posting observations over time. Endpoints: company-profile, company-posts.

Practical notes

  • Read the documented path. Use outputs[0].data; fail if missing or invalid, without an output fallback.
  • Pagination is gated. Wait for approved input types and two redacted real pages; an old paging observation is not a continuation recipe.
  • Separate documents from observations. Profile fields are now described in the README; the retained readers still use historical observations, not guaranteed complete responses.
  • Public, read-only data only. No posting, no member-only data. Authenticate with a SandBase API key.
  • Be a good client. Back off on transient HTTP 429 errors; do not log full payloads or tokens by default. These snippets do not implement retries.

FAQ

Do I need a LinkedIn developer app or login? You authenticate to SandBase with your SANDBASE_API_KEY; the current profile reference says separate LinkedIn API access is not required. This tutorial does not cover LinkedIn page management or private data.

What identifies a company? A full company page url, including https://. Both endpoints take the same url.

How do I page through more posts? The current README describes pagination inputs, but their types conflict with the FAQ. Product approval and two redacted real pages must establish token location, binding, and stop behavior before publishing continuation code. Neither full history nor a fixed page size is established here.

Can I read member profiles or private data? This tutorial covers company endpoints. Private and member-only data are out of scope.

Wrap up

One company url, two research tasks — company details and page updates — with the original business readers clearly dated. For the full endpoint catalog, see the LinkedIn public data API hub. When you are ready:

Found this useful? Share it