# fetchCompany

This method allows you to retrieve various data about a company: basic information, employees, posts, and decision makers.

```typescript
try {
  const workflow = 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(
    workflow.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
from linkedapi import FetchCompanyParams, LinkedApiError

try:
    workflow = linkedapi.fetch_company.execute(
        FetchCompanyParams(
            company_url="https://www.linkedin.com/company/microsoft",
            retrieve_employees=True,
            retrieve_posts=True,
            retrieve_dms=True,
            employees_retrieval_config={
                "limit": 25,
                "filter": {
                    "first_name": "John",
                    "last_name": "Smith",
                    "position": "engineer",
                    "locations": ["United States", "Canada"],
                    "industries": ["Software Development"],
                    "schools": ["Stanford University", "MIT"],
                },
            },
            posts_retrieval_config={"limit": 10, "since": "2024-01-01T00:00:00Z"},
            dms_retrieval_config={"limit": 5},
        )
    )

    result = linkedapi.fetch_company.result(workflow.workflow_id)
    data = result.data
    errors = result.errors

    # The list of possible execution errors is below
    if errors:
        print("Workflow completed with execution errors:")
        for error in errors:
            print(f" - Type: {error.type}, Message: {error.message}")

    # The structure of the 'data' object is below
    if data:
        print("Company name:", data.name)
        print("Description:", data.description)
        print("Location:", data.location)
        print("Industry:", data.industry)
        print("Employees count:", data.employees_count)
        print("Employees:", data.employees)
        print("Posts:", data.posts)
        print("Decision makers:", data.dms)
        print("Workflow completed successfully. Data:", data)
except LinkedApiError as e:
    # A list of all critical errors can be found here:
    # https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

## Params

- `companyUrl` – [public or hashed](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the company you want to retrieve data for.
- `retrieveEmployees` (optional) – when set to `true`, includes company employees with their profiles in the results.
- `retrieveDMs` (optional) – when set to `true`, includes decision makers and key personnel in the results.
- `retrievePosts` (optional) – when set to `true`, includes recent company posts and updates in the results.
- `employeesRetrievalConfig` (optional) – configuration for retrieving employees. Available only if `retrieveEmployees` is `true`.
  - `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 using `AND` 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 if `retrieveDMs` is `true`.
  - `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 if `retrievePosts` is `true`.
  - `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](/faq/what-are-hashed-url-and-public-url) 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.
- `logoUrl` – URL of the company's logo, or `null` if the company has no logo.
- `employees` – array of employee profiles (included only if `retrieveEmployees` is `true`).
  - `name` – full name of the employee.
  - `publicUrl` – [public](/faq/what-are-hashed-url-and-public-url) 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 if `retrieveDMs` is `true`).
  - `name` – full name of the decision-maker.
  - `publicUrl` – [public](/faq/what-are-hashed-url-and-public-url) 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 if `retrievePosts` is `true`).
  - `url` – URL of the post.
  - `activityUrn` – LinkedIn activity or UGC URN of the post, if available.
  - `time` – timestamp when the post was published.
  - `type` – type of the post. Enum with possible values:
    - `original` – for original posts.
    - `repost` – for reposts.
  - `author` – original content creator. Can be `null` if the actor cannot be parsed.
    - For person authors: `type`, `name`, `profileUrl`, `headline`.
    - For company authors: `type`, `name`, `companyUrl`.
  - `reposter` – person or company that reshared the post. Non-null only when `type` is `repost`.
    - For person reposters: `type`, `name`, `profileUrl`, `headline`.
    - For company reposters: `type`, `name`, `companyUrl`.
  - `text` – original author's post text, if available.
  - `repostText` – text added by the reposter on a repost with comment, if available.
  - `hashtags` – array of hashtags found in the post text, without leading `#`.
  - `mentions` – array of person and company profile URLs found in the post text.
  - `externalLinks` – array of outbound URLs found in the post text.
  - `images` – array of up to 3 preview image URLs, if available.
  - `documentSlides` – array of carousel or document slide image URLs, if available.
  - `hasVideo` – boolean indicating if the post contains a video.
  - `videoThumbnail` – URL of the video thumbnail, if available.
  - `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.
