Skip to content
ScrapeField

Blog · Guides ·

Enrich a list of companies from LinkedIn

Loop over a list of LinkedIn company pages and get back size, industry, headquarters and followers for each, one line per company, in the order of your list.

ScrapeField

A list of target accounts is worth more with the numbers next to it: how big each company is, what it does, where it sits, and how many people follow it. This guide takes a list of LinkedIn company pages and adds those numbers, one call per company, in a loop of a few lines.

What goes in

Each company is its LinkedIn page: the URL, https://www.linkedin.com/company/acme-inc/, or only the part after /company/, acme-inc. We do not look a company up by its name or its domain, so start from the page.

One company

curl -H "Authorization: Bearer $SCRAPEFIELD_KEY" \
  "https://api.scrapefield.com/v1/linkedin/company?vanity_name=ferrari"

The answer has name, industry, company_size (the band LinkedIn prints, such as “1,001-5,000 employees”), employees_on_linkedin, headquarters with its city and country, founded, website, follower_count and specialties. A field LinkedIn does not show is null. Every field is in the company reference.

Each company costs 3 credits: $2.34 per 1,000 on the smallest pack, $1.32 on the largest. A page that does not exist is answered with profile_not_found and is not charged.

A whole list

Loop over the list, one call per company. Each company prints as one line, in the order of your list. A company we could not find prints why instead, and is not charged:

const headers = { Authorization: `Bearer ${process.env.SCRAPEFIELD_KEY}` };
const pages = ['ferrari', 'https://www.linkedin.com/company/example-co/'];

for (const page of pages) {
  const q = new URLSearchParams(page.startsWith('http') ? { url: page } : { vanity_name: page });
  const res = await fetch(`https://api.scrapefield.com/v1/linkedin/company?${q}`, { headers });
  const body = await res.json();
  if (!res.ok) { console.log(page, body.error.code); continue; }
  const c = body.data;
  console.log([c.name, c.industry, c.company_size, c.headquarters?.country, c.follower_count].join('\t'));
}

For a list of thousands, run several calls side by side, up to your limit of calls at once. A call past the limit is refused with concurrency_limit, costs nothing, and can be sent again. To do the same from a spreadsheet, the Google Sheets guide shows the pattern for one call at a time.