Are you looking to integrate LinkedIn company search results into your workflow without manual effort? In this guide, I’ll show you how to leverage our API to automate company searches from LinkedIn Sales Navigator—without requiring a LinkedIn account, cookies, or browser extensions. Simply define your search criteria and let the API do the rest.

Code Demonstration

Let’s say you want to build a list of companies that meet the following criteria:

  • Company Size: Between 1,001–10,000 employees.
  • Headquarters: United States.
  • Hiring on LinkedIn: No.

Here’s how you can achieve this step-by-step using Python.

1

Initiate the Search

import requests

API_KEY = 'your_api_key_here'
SEARCH_URL = "https://fresh-linkedin-profile-data.p.rapidapi.com/search-companies"

def search_companies():
    payload = {
        "company_headcounts": ["1001-5000", "5001-10000"],
        "headquarters_location": [103644278],  # United States
        "hiring_on_linkedin": "false",
        "limit": 100
    }
    headers = {
        "x-rapidapi-key": API_KEY,
        "Content-Type": "application/json"
    }

    response = requests.post(SEARCH_URL, json=payload, headers=headers)
    return response.json().get('request_id')
2

Monitor Search Progress

STATUS_URL = "https://fresh-linkedin-profile-data.p.rapidapi.com/check-search-companies-status"

def check_search_status(request_id):
    querystring = {"request_id": request_id}
    headers = {
        "x-rapidapi-key": API_KEY
    }

    response = requests.get(STATUS_URL, headers=headers, params=querystring)
    return response.json()['status'] # pending ==> processing ==> done
3

Retrieve Search Results

RESULTS_URL = "https://fresh-linkedin-profile-data.p.rapidapi.com/get-search-companies-results"

def get_search_results(request_id):
    headers = {
        "x-rapidapi-key": API_KEY
    }

    all_results = []
    page = 1

    while True:
        querystring = {"request_id": request_id, "page": page}
        response = requests.get(RESULTS_URL, headers=headers, params=querystring)
        data = response.json()

        if data.get("data"):
            all_results.extend(data["data"])
            page += 1
        else:
            break

    return all_results
4

Full Workflow

import time

def main():
    request_id = search_companies()
    if not request_id:
        print("Error initiating search.")
        return

    while True:
        status = check_search_status(request_id)
        print("Search Status:", status)
        if status == "done":
            results = get_search_results(request_id)
            print(f"Total Results Fetched: {len(results)}")
            print("Search Results:", results)
            break
        time.sleep(60)  # wait for 1 minute before checking again

if __name__ == "__main__":
    main()

Prerequisites

Before running the code, ensure you have the following:

  1. A PRO plan to access the search endpoint.
  2. Python installed on your machine.
  3. Install the required Python library using:
pip install requests

Pricing

The API usage cost is broken into three stages:

  1. Search initiation: 25 credits per request.
  2. Search status checks: Free of charge.
  3. Result fetching: 0.3 credits per company.

For example, if your search returns 100 companies, the total credit cost would be:

25 credits + (0.3 × 100) = 55 credits.

This guide demonstrates how you can use the API to automate LinkedIn company searches efficiently and integrate them seamlessly into your workflow. Start leveraging this solution to scale your business insights effortlessly.