Company Endpoints
Similar to how the Person Enrichment API enriches data on a person, the Company Enrichment API enriches data on a company:
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create a parameters JSON object
QUERY_STRING = {"website":"google.com"}
# Pass the parameters object to the Company Enrichment API
response = CLIENT.company.enrichment(**QUERY_STRING)
# Print the API response
print(response.text)
curl -X GET -G \
'https://api.peopledatalabs.com/v5/company/enrich'\
-H 'X-Api-Key: xxxx'\
--data-urlencode 'website=google.com'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create a parameters JSON object
const queryString = {"website":"google.com"}
// Pass the parameters object to the Company Enrichment API
PDLJSClient.company.enrichment(queryString).then((response) => {
// Print the API response
console.log(response);
}).catch((error) => {
console.log(error);
});
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create a parameters JSON object
QUERY_STRING = {"website":"google.com"}
# Pass the parameters object to the Company Enrichment API
response = Peopledatalabs::Enrichment.company(params: QUERY_STRING)
# Print the API response
puts response
package main
import (
"fmt"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create a parameters JSON object
queryString := pdlmodel.CompanyParams{Website: "google.com"}
params := pdlmodel.EnrichCompanyParams{
CompanyParams: queryString,
}
// Pass the parameters object to the Company Enrichment API
response, err := client.Company.Enrich(context.Background(), params)
// Check for successful response
if err == nil {
// Print the API response
fmt.Println(response)
}
}
import requests
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Company Enrichment API URL
PDL_URL = "https://api.peopledatalabs.com/v5/company/enrich"
# Create a parameters JSON object
QUERY_STRING = {"website":"google.com"}
# Set headers
HEADERS = {
'accept': "application/json",
'content-type': "application/json",
'x-api-key': API_KEY
}
# Pass the parameters object to the Company Enrichment API
response = requests.request("GET", PDL_URL, headers=HEADERS, params=QUERY_STRING)
# Print the API response
print(response.text)
We also provide a Bulk Company Enrichment API, which allows you to enrich 1-100 persons in a single request (recommended for high-volume usage):
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
"params": {
"profile": "https://www.linkedin.com/company/peopledatalabs"
}
},
{
"params": {
"website": "google.com"
}
}
]
}
# Pass the bulk parameters object to the Bulk Person Enrichment API
json_response = CLIENT.company.bulk(**DATA).json()
# Print the API response in JSON format
print(json_response)
curl -X POST "https://api.peopledatalabs.com/v5/company/enrich/bulk" \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: XXXX' \
-d ' {
"requests": [
{
"params": {
"profile": "https://www.linkedin.com/company/walmart"
}
},
{
"params": {
"website": "google.com"
}
}
]
}'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create a list of parameter objects
const bulkEnrichmentRecords = {
requests: [
{
params: {
profile: ['linkedin.com/in/peopledatalabs'],
},
},
{
params: {
profile: ['linkedin.com/in/apple'],
},
},
],
};
// Pass the parameter objects to the Bulk Company Enrichment API
try {
const response = await PDLJSClient.company.bulk.enrichment(bulkEnrichmentRecords);
console.log(response.items);
} catch (error) {
console.log(error);
};
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
"params": {
"profile": ["linkedin.com/in/peopledatalabs"]
}
},
{
"params": {
"profile": ["linkedin.com/in/apple"]
}
}
]
}
# Pass the parameters object to the Company Enrichment API
response = Peopledatalabs::Bulk.company(params: DATA)
# Print the API response in JSON format
puts JSON.dump(json_response)
import requests
import json
# Set your API key
API_KEY = "YOUR API KEY"
# Pass your API key in header
HEADERS = {
'X-Api-Key': API_KEY,
'Content-Type': 'application/json',
}
# Create an array of parameters JSON objects
DATA = {
"requests": [
{
"params": {
"profile": "https://www.linkedin.com/company/walmart"
}
},
{
"params": {
"website": "google.com"
}
}
]
}
# Pass the bulk parameters object to the Bulk Company Enrichment API using POST method
try:
response = requests.post(
'https://api.peopledatalabs.com/v5/company/enrich/bulk',
headers=HEADERS,
json=DATA
)
# Check if the request was successful (status code 200)
if response.status_code == 200:
# Parse the JSON response
json_responses = response.json()
# Iterate through the array of API responses
for response_data in json_responses:
# Check for successful response
if response_data["status"] == 200:
# Print selected fields
print(
response_data['size'],
response_data['employee_count'],
response_data['industry'],
response_data['location']
)
print(f"Successfully enriched profile with PDL data.")
# Save enrichment data to JSON file (append mode)
with open(f"my_pdl_enrichment.{response_data['linkedin_slug']}.jsonl", "a") as out:
out.write(json.dumps(response_data) + "\n")
else:
print("Enrichment unsuccessful. See error and try again.")
print("error:", response_data)
else:
print(f"Request failed with status code {response.status_code}")
except requests.exceptions.RequestException as e:
print(f"An error occurred during the request: {e}")
Similar to how the Person Search API allows you to write queries that retrieve records on persons matching a criteria, the Company Search API allows you to write queries that retrieve records on companies matching a criteria:
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create an Elasticsearch query
ES_QUERY = {
"query": {
"bool": {
"must": [
{"term": {"website": "google.com"}},
]
}
}
}
# Create a parameters JSON object
PARAMS = {
'query': ES_QUERY,
'size': 10,
'pretty': True
}
# Pass the parameters object to the Company Search API
response = CLIENT.company.search(**PARAMS).json()
# Check for successful response
if response["status"] == 200:
data = response['data']
# Write out each profile found to file
with open("my_pdl_search.jsonl", "w") as out:
for record in data:
out.write(json.dumps(record) + "\n")
print(f"Successfully grabbed {len(data)} records from PDL.")
print(f"{response['total']} total PDL records exist matching this query.")
else:
print("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
print("Error:", response)
import json
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying your API key
CLIENT = PDLPY(
api_key="YOUR API KEY",
)
# Create an SQL query
SQL_QUERY = \
"""
SELECT * FROM company
WHERE website='google.com';
"""
# Create a parameters JSON object
PARAMS = {
'sql': SQL_QUERY,
'size': 10,
'pretty': True
}
# Pass the parameters object to the Company Search API
response = CLIENT.company.search(**PARAMS).json()
# Check for successful response
if response["status"] == 200:
data = response['data']
# Write out each profile found to file
with open("my_pdl_search.jsonl", "w") as out:
for record in data:
out.write(json.dumps(record) + "\n")
print(f"Successfully grabbed {len(data)} records from PDL.")
print(f"{response['total']} total PDL records exist matching this query.")
else:
print("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
print("Error:", response)
# Elasticsearch
curl -X GET 'https://api.peopledatalabs.com/v5/company/search' \
-H 'X-Api-Key: xxxx' \
--data-raw '{
"size": 10,
"query": {
"bool": {
"must": [
{"term": {"website": "google.com"}},
]
}
}
}'
# SQL
curl -X GET \
'https://api.peopledatalabs.com/v5/company/search' \
-H 'X-Api-Key: xxxx' \
--data-raw '{
"size": 10,
"sql": "SELECT * FROM company WHERE website='\''google.com'\'';"
}'
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
import fs from 'fs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create an Elasticsearch query
const esQuery = {
query: {
bool: {
must:[
{"term": {"website": "google.com"}}
]
}
}
}
// Create a parameters JSON object
const params = {
searchQuery: esQuery,
size: 10,
pretty: true
}
// Pass the parameters object to the Company Search API
PDLJSClient.company.search.elastic(params).then((data) => {
// Write out all profiles found to file
fs.writeFile("my_pdl_search.jsonl", Buffer.from(JSON.stringify(data.data)), (err) => {
if (err) throw err;
});
console.log(`Successfully grabbed ${data.data.length} records from PDL.`);
console.log(`${data["total"]} total PDL records exist matching this query.`)
}).catch((error) => {
console.log("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
console.log(error);
});
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
import fs from 'fs';
// Create a client, specifying your API key
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
// Create an SQL query
const sqlQuery = `SELECT * FROM company
WHERE website='google.com';`;
// Create a parameters JSON object
const params = {
searchQuery: sqlQuery,
size: 10,
pretty: true
}
// Pass the parameters object to the Company Search API
PDLJSClient.company.search.sql(params).then((data) => {
// Write out all profiles found to file
fs.writeFile("my_pdl_search.jsonl", Buffer.from(JSON.stringify(data.data)), (err) => {
if (err) throw err;
});
console.log(`Successfully grabbed ${data.data.length} records from PDL.`);
console.log(`${data["total"]} total PDL records exist matching this query.`)
}).catch((error) => {
console.log("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
console.log(error);
});
require 'json'
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create an Elasticsearch query
ES_QUERY = {
"query": {
"bool": {
"must": [
{"term": {"website": "google.com"}},
]
}
}
}
# Pass parameters to the Company Search API
response = Peopledatalabs::Search.company(searchType: 'elastic', query: ES_QUERY, size: 10, pretty: true)
# Check for successful response
if response['status'] == 200
data = response['data']
# Write out each profile found to file
File.open("my_pdl_search.jsonl", "w") do |out|
data.each { |record| out.write(JSON.dump(record) + "\n") }
end
puts "Successfully grabbed #{data.length()} records from PDL."
puts "#{response['total']} total PDL records exist matching this query."
else
puts "NOTE: The carrier pigeons lost motivation in flight. See error and try again."
puts "Error: #{response}"
end
require 'json'
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
# Set your API key
Peopledatalabs.api_key = 'YOUR API KEY'
# Create an SQL query
SQL_QUERY = \
"""
SELECT * FROM company
WHERE website='google.com';
"""
# Pass parameters to the Company Search API
response = Peopledatalabs::Search.company(searchType: 'sql', query: SQL_QUERY, size: 10, pretty: true)
# Check for successful response
if response['status'] == 200
data = response['data']
# Write out each profile found to file
File.open("my_pdl_search.jsonl", "w") do |out|
data.each { |record| out.write(JSON.dump(record) + "\n") }
end
puts "Successfully grabbed #{data.length()} records from PDL."
puts "#{response['total']} total PDL records exist matching this query."
else
puts "NOTE: The carrier pigeons lost motivation in flight. See error and try again."
puts "Error: #{response}"
end
package main
import (
"fmt"
"os"
"encoding/json"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create an Elasticsearch query
elasticSearchQuery := map[string]interface{} {
"query": map[string]interface{} {
"bool": map[string]interface{} {
"must": []map[string]interface{} {
{"term": map[string]interface{}{"website": "google.com"}},
},
},
},
}
// Create a parameters JSON object
params := pdlmodel.SearchParams {
BaseParams: pdlmodel.BaseParams {
Size: 10,
Pretty: true,
},
SearchBaseParams: pdlmodel.SearchBaseParams {
Query: elasticSearchQuery,
},
}
// Pass the parameters object to the Company Search API
response, err := client.Company.Search(context.Background(), params)
// Check for successful response
if err == nil {
data := response.Data
// Create file
out, outErr := os.Create("my_pdl_search.jsonl")
defer out.Close()
if (outErr == nil) {
for i := range data {
// Convert each profile found to JSON
record, jsonErr := json.Marshal(data[i])
// Write out each profile to file
if (jsonErr == nil) {
out.WriteString(string(record) + "\n")
}
}
out.Sync()
}
fmt.Printf("Successfully grabbed %d records from PDL.\n", len(data))
fmt.Printf("%d total PDL records exist matching this query.\n", response.Total)
} else {
fmt.Println("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
fmt.Println("Error:", err)
}
}
package main
import (
"fmt"
"os"
"encoding/json"
"context"
)
// See https://github.com/peopledatalabs/peopledatalabs-go
import (
pdl "github.com/peopledatalabs/peopledatalabs-go"
pdlmodel "github.com/peopledatalabs/peopledatalabs-go/model"
)
func main() {
// Set your API key
apiKey := "YOUR API KEY"
// Set API key as environmental variable
// apiKey := os.Getenv("API_KEY")
// Create a client, specifying your API key
client := pdl.New(apiKey)
// Create an SQL query
sqlQuery := "SELECT * FROM company" +
" WHERE website='google.com';"
// Create a parameters JSON object
params := pdlmodel.SearchParams {
BaseParams: pdlmodel.BaseParams {
Size: 10,
Pretty: true,
},
SearchBaseParams: pdlmodel.SearchBaseParams {
SQL: sqlQuery,
},
}
// Pass the parameters object to the Company Search API
response, err := client.Company.Search(context.Background(), params)
// Check for successful response
if err == nil {
data := response.Data
// Create file
out, outErr := os.Create("my_pdl_search.jsonl")
defer out.Close()
if (outErr == nil) {
for i := range data {
// Convert each profile found to JSON
record, jsonErr := json.Marshal(data[i])
// Write out each profile to file
if (jsonErr == nil) {
out.WriteString(string(record) + "\n")
}
}
out.Sync()
}
fmt.Printf("Successfully grabbed %d records from PDL.\n", len(data))
fmt.Printf("%d total PDL records exist matching this query.\n", response.Total)
} else {
fmt.Println("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
fmt.Println("Error:", err)
}
}
import requests, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Company Search API URL
PDL_URL = "https://api.peopledatalabs.com/v5/company/search"
# Set headers
HEADERS = {
'Content-Type': "application/json",
'X-api-key': API_KEY
}
# Create an Elasticsearch query
ES_QUERY = {
"query": {
"bool": {
"must": [
{"term": {"website": "google.com"}},
]
}
}
}
# Create a parameters JSON object
PARAMS = {
'query': json.dumps(ES_QUERY),
'size': 10,
'pretty': True
}
# Pass the parameters object to the Company Search API
response = requests.get(
PDL_URL,
headers=HEADERS,
params=PARAMS
).json()
# Check for successful response
if response["status"] == 200:
data = response['data']
# Write out each profile found to file
with open("my_pdl_search.jsonl", "w") as out:
for record in data:
out.write(json.dumps(record) + "\n")
print(f"Successfully grabbed {len(data)} records from PDL.")
print(f"{response['total']} total PDL records exist matching this query.")
else:
print("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
print("Error:", response)
import requests, json
# Set your API key
API_KEY = "YOUR API KEY"
# Set the Company Search API URL
PDL_URL = "https://api.peopledatalabs.com/v5/company/search"
# Set headers
HEADERS = {
'Content-Type': "application/json",
'X-api-key': API_KEY
}
# Create an SQL query
SQL_QUERY = \
"""
SELECT * FROM company
WHERE website='google.com';
"""
# Create a parameters JSON object
PARAMS = {
'sql': SQL_QUERY,
'size': 10,
'pretty': True
}
# Pass the parameters object to the Company Search API
response = requests.get(
PDL_URL,
headers=HEADERS,
params=PARAMS
).json()
# Check for successful response
if response["status"] == 200:
data = response['data']
# Write out each profile found to file
with open("my_pdl_search.jsonl", "w") as out:
for record in data:
out.write(json.dumps(record) + "\n")
print(f"Successfully grabbed {len(data)} records from PDL.")
print(f"{response['total']} total PDL records exist matching this query.")
else:
print("NOTE: The carrier pigeons lost motivation in flight. See error and try again.")
print("error:", response)
Updated about 2 months ago