Crunchbase
The objective of this use case is to identify and retrieve active investors in a specific business sector using the Crunchbase Company API. This process involves gathering information about companies within the sector and identifying their investors through Crunchbase's company and funding rounds APIs.
Your target
Identify and compile a list of companies operating within your target sector. This list should include relevant information such as the company names or their domain names.
Retrieve Company UUIDs
Use the Crunchbase company API to retrieve the UUID for each company:
Send a request with the domain name with a "domain" parameter.
or :
Send a request with the company name with a "query" parameter.
For more information with Crunchbase company API, see the documentation:
Retrieve Investors' UUIDs
For each company UUID obtained, use the Crunchbase Funding Rounds API to find funding rounds related to the company.
Send a request with the uuid
via funded_organization_identifier
parameter.
For more information with the Crunchbase Funding Rounds API, see the documentation:
Find Investor Information
Use the investor UUIDs obtained in the previous step to get detailed information about each investor:
Send a request with the investor uuid
to the Crunchbase Company API via "query" parameters.
Make sure you have the requests
library installed using pip install requests
.
import json
import requests
import concurrent.futures
API_KEY = 'your_api_key'
targets = [
'zocdoc.com',
'babylonhealth.com',
'livongo.com',
]
def get_headers():
return {
'x-api-key': API_KEY
}
def get_company_info(query: str = None, domain: str = None):
response = requests.get(
url='https://piloterr.com/api/v2/crunchbase/company/info',
headers=get_headers(),
params={
'query': query,
'domain': domain
}
)
if response.status_code == 200:
return response.json()
else:
return None
def get_funding_rounds_info(funded_organization_identifier: str = None):
response = requests.get(
url='https://piloterr.com/api/v2/crunchbase/funding_rounds',
headers=get_headers(),
params={
'funded_organization_identifier': funded_organization_identifier
}
)
if response.status_code == 200:
return response.json()
else:
return None
all_data = []
investors_data = {}
with concurrent.futures.ThreadPoolExecutor() as executor:
company_info_futures = {executor.submit(get_company_info, domain=target): target for target in targets}
company_info_results = {future: company_info_futures[future] for future in
concurrent.futures.as_completed(company_info_futures)}
funding_rounds_futures = {}
for future, target in company_info_results.items():
try:
company_info = future.result()
if company_info:
uuid = company_info['uuid']
funding_rounds_futures[executor.submit(get_funding_rounds_info,
funded_organization_identifier=uuid)] = (company_info, uuid)
except Exception as e:
print(f"Error fetching company info for {target}: {e}")
for future in concurrent.futures.as_completed(funding_rounds_futures):
company_info, uuid = funding_rounds_futures[future]
try:
funding_rounds_info = future.result()
if funding_rounds_info:
funding_rounds = funding_rounds_info.get('results', [])
for round_info in funding_rounds:
round_info['company_info'] = company_info
all_data.append(round_info)
except Exception as e:
print(f"Error fetching funding rounds info for {uuid}: {e}")
investor_futures = []
for round_info in all_data:
for investor in round_info.get("investor_identifiers", []):
if investor['entity_def_id'] == 'organization' or investor['entity_def_id'] == 'person':
investor_futures.append((round_info, executor.submit(get_company_info, query=investor["uuid"])))
for round_info, future in investor_futures:
try:
investor_info = future.result()
if investor_info:
investor_uuid = investor_info["uuid"]
if investor_uuid not in investors_data:
investors_data[investor_uuid] = {
"investor_info": investor_info,
"funding_rounds": []
}
round_info_copy = round_info.copy()
round_info_copy.pop('investor_identifiers', None)
round_info_copy.pop('funded_organization_identifier', None)
investors_data[investor_uuid]["funding_rounds"].append(round_info_copy)
except Exception as e:
print(f"Error fetching investor info: {e}")
with open('output.json', 'w') as json_file:
json.dump(investors_data, json_file, indent=4)
Importing library:
json: Used for encoding and decoding JSON data.
requests: Used to make HTTP requests to the Piloterr API.
concurrent.futures: Provides a high-level interface for asynchronously executing callables.
Replace your_api_key
with your Piloterr API key.
Populate the entreprises you want to analyze in the variable targets
.
get_headers: Returns a dictionary containing the HTTP headers required for authentication with the API.
get_company_info: Sends a GET request to retrieve information about a company using either a search query or a domain name. It returns the JSON response if the request is successful (HTTP status code 200) and None
otherwise.
get_funding_rounds_info: Sends a GET request to retrieve funding round details for a specified company using its identifier. Like the previous function, it returns the JSON response if successful and None
otherwise.