fetchCompany
This method allows you to retrieve various data about a company: basic information, employees, posts, and decision makers.
try {
const workflowId = await linkedapi.fetchCompany.execute({
companyUrl: "https://www.linkedin.com/company/microsoft",
retrieveEmployees: true,
retrievePosts: true,
retrieveDMs: true,
employeesRetrievalConfig: {
limit: 25,
filter: {
firstName: "John",
lastName: "Smith",
position: "engineer",
locations: ["United States", "Canada"],
industries: ["Software Development"],
currentCompanies: ["Microsoft", "Google"],
previousCompanies: ["Apple", "Amazon"],
schools: ["Stanford University", "MIT"]
}
},
postsRetrievalConfig: {
limit: 10,
since: "2024-01-01T00:00:00Z"
},
dmsRetrievalConfig: {
limit: 5
}
});
const { data, errors } = await linkedapi.fetchCompany.result(workflowId);
// The list of possible execution errors is below
if (errors && errors.length > 0) {
console.warn('Workflow completed with execution errors:');
errors.forEach(error => {
console.warn(` - Type: ${error.type}, Message: ${error.message}`);
});
}
// The structure of the 'data' object is below
if (data) {
console.log('Company name:', data.name);
console.log('Description:', data.description);
console.log('Location:', data.location);
console.log('Industry:', data.industry);
console.log('Employees count:', data.employeesCount);
console.log('Employees:', data.employees);
console.log('Posts:', data.posts);
console.log('Decision makers:', data.dms);
console.log('Workflow completed successfully. Data:', data);
}
} catch (e) {
// A list of all critical errors can be found here:
// https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
if (e instanceof LinkedApiError) {
console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
} else {
console.error('An unexpected, non-API error occurred:', e);
}
}
# Python SDK is coming soon!
#
# You can always use Linked API through HTTP
# https://linkedapi.io/docs/
// Go SDK is coming soon!
//
// You can always use Linked API through HTTP
// https://linkedapi.io/docs/
Params
companyUrl
– public or hashed LinkedIn URL of the company you want to retrieve data for.retrieveEmployees
(optional) – when set totrue
, includes company employees with their profiles in the results.retrieveDMs
(optional) – when set totrue
, includes decision makers and key personnel in the results.retrievePosts
(optional) – when set totrue
, includes recent company posts and updates in the results.employeesRetrievalConfig
(optional) – configuration for retrieving employees. Available only ifretrieveEmployees
istrue
.limit
– (optional) maximum number of employees to retrieve. Defaults to 500, with a maximum value of 500.filter
(optional) – object that specifies filtering criteria for employees. When multiple filter fields are specified, they are combined usingAND
logic.firstName
(optional) – first name of employee.lastName
(optional) – last name of employee.position
(optional) – job position of employee.locations
(optional) – array of free-form strings representing locations. Matches if employee is located in any of the listed locations.industries
(optional) – array of enums representing industries. Matches if employee works in any of the listed industries. Takes specific values available in the LinkedIn interface.schools
(optional) – array of institution names. Matches if employee currently attends or previously attended any of the listed institutions.
dmsRetrievalConfig
(optional) – configuration for retrieving decision makers. Available only ifretrieveDMs
istrue
.limit
– number of decision makers to retrieve. Defaults to 20, with a maximum value of 20. If a company has fewer decision makers than specified, only the available ones will be returned.
postsRetrievalConfig
(optional) – configuration for retrieving posts. Available only ifretrievePosts
istrue
.limit
(optional) – number of posts to retrieve. Defaults to 20, with a maximum value of 20.since
(optional) – timestamp to filter posts published after the specified time.
Data
name
– name of the company.publicUrl
– public LinkedIn URL of the company.description
– description of the company.location
– free-form string representing the company headquarters location.headquarters
– two-character country code (e.g., "US", "UK") representing headquarters location.industry
– enum representing the company industry. Takes specific values available in the LinkedIn interface.specialties
– comma-separated list of company's specialties.website
– company's official website URL.employeesCount
– total number of employees associated with the company.yearFounded
– year the company was established, if available.ventureFinancing
– boolean indicating whether the company has received venture financing.jobsCount
– number of current job vacancies posted by the company.employees
– array of employee profiles (included only ifretrieveEmployees
istrue
).name
– full name of the employee.publicUrl
– public LinkedIn URL of the employee.headline
– headline of the employee.location
– free-form string indicating the employee's location.
dms
– array of decision makers (included only ifretrieveDms
istrue
).name
– full name of the decision-maker.publicUrl
– public LinkedIn URL of the decision-maker.headline
– headline of the decision-maker.location
– free-form string indicating the decision-maker's location.countryCode
– two-character code of the decision-maker's country.
posts
– array of company posts (included only ifretrievePosts
istrue
).url
– URL of the post.time
– timestamp when the post was published.type
– type of the post. Enum with possible values:original
– for original posts.repost
– for reposts.
repostText
– additional text added during repost, if applicable.text
– text content of the post, if available.images
– array of top 3 preview image URLs, if available.hasVideo
– boolean indicating if the post contains a video.hasPoll
– boolean indicating if the post contains a poll.reactionsCount
– number of reactions on the post.commentsCount
– number of comments on the post.repostsCount
– number of reposts on the post.
Errors
companyNotFound
– provided URL is not an existing LinkedIn company.retrievingNotAllowed
– LinkedIn has blocked performing the retrieval due to exceeding limits or other restrictions.