Find and retrieve a list of all employees through LinkedIn API

/ proxycurl

How can I retrieve a list of all employees within a company through the LinkedIn API?

Subscribe to our newsletter

Get the latest news from Proxycurl

In this post, we're going to answer a StackOverflow question. You can still view the original question on StackOverflow, but we'll provide the text of the question below also. Or you can skip below to our answer.

Years ago, someone asked...if it were possible to retrieve a list of all employees who work at a company. I can do this through the LinkedIn UI, but I cannot seem to find any mechanism for this using the v2 API. The SO response mentions this used to be possible on the v1 API, but you had to request access through LinkedIn's "Vetted API Access Program." Unfortunately, the link on this response is now obsolete and does not send users to any such program.
How could I apply for this program nowadays? This is a specific situation to me and my company, so I would very much like to discuss this with someone at LinkedIn if some form of this Vetted API Access Program still exists. I do not wish to disclose the details of this request to the open internet.

Our answer

You can get a list of employees of a company in two ways:

  • If you scrape Linkedin profiles exhaustively
  • If you already have an exhaustive dataset of Linkedin profiles.

Each LinkedIn profile contains a list of "experiences," each of which links to a company profile URL. So once you have a data set, the process to create your list consists of two steps:

  1. Parse the profiles into JSON so you can easily filter them
  2. Filter the parsed profiles based on who currently works at a particular company. Now you have your list of current employees!
    • You can instead filter based on "past" experiences (i.e. those with an end date) to find past, or even all, employees)

And that is exactly what we did. We scraped all public LinkedIn profiles based in several countries, including the United States, Singapore, and Canada; and we made an alternative API known as the Proxycurl Employee Listing API, which provides employee listing functionality.

Code sample

There are three prerequisites to run this code (assuming you have Python installed and set up already):

  1. Create a Proxycurl account.
  2. Go to your Proxycurl dashboard and find your API key.
  3. Create an environment variable called PROXYCURL_API_KEY set to your API key.

That's it! Here's the code in which we'll list 3 current employees of Apple. You can run this with your trial credits:

import json, os, requests
api_key = os.environ['PROXYCURL_API_KEY']
headers = {'Authorization': 'Bearer ' + api_key}

api_endpoint = 'https://nubela.co/proxycurl/api/linkedin/company/employees/'
params = {
    'url': 'https://www.linkedin.com/company/apple/',
    'page_size': '3',  # set your page_size as desired
}
response = requests.get(api_endpoint, params=params, headers=headers)
result = response.json()
print(json.dumps(result, indent=2))

Our API will never be as exhaustive as LinkedIn's dataset because not all profiles are made public, but most are - enough to meet your needs, and certainly better than the "nothing at all" that LinkedIn themselves offer. Check it out and see for yourself!

Bonus code sample

Excited about what Proxycurl's Employee Listing Endpoint can do? Make a top-up with some credits now, and we can retrieve a list of employees in order of when they joined.

For up-to-date pricing of the sort_by parameter, please see our documentation, as it is significantly more expensive than the unsorted version. Set the limit accordingly, and optionally include the parameter role_search as well.

import json, os, requests
api_key = os.environ['PROXYCURL_API_KEY']
headers = {'Authorization': 'Bearer ' + api_key}

api_endpoint = 'https://nubela.co/proxycurl/api/linkedin/company/employees/'
params = {
    'url': 'https://www.linkedin.com/company/apple/',
    'sort_by': 'recently-joined',
    'page_size': '3',  # set your page_size as desired
}
response = requests.get(api_endpoint, params=params, headers=headers)
result = response.json()
print(json.dumps(result, indent=2))

Subscribe to our newsletter

Get the latest news from Proxycurl

Latest Articles

Here’s what we’ve been up to recently.