> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Пошук у LinkedIn

> Пошук компаній або людей у LinkedIn

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

export const HeaderAPI = ({noProfileKey, profileKeyRequired}) => <>
    <ParamField header="Authorization" type="string" required>
      <a href="/apis/overview#authorization">API Key</a> of the Primary Profile.
      <br />
      <br />
      Format: <code>Authorization: Bearer API_KEY</code>
    </ParamField>
    {!noProfileKey && (profileKeyRequired ? <ParamField header="Profile-Key" type="string" required>
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField> : <ParamField header="Profile-Key" type="string">
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField>)}
  </>;

<PlansAvailable plans={["business"]} maxPackRequired={false} />

Пошук компаній або людей у LinkedIn на основі пошукового запиту.
Цей endpoint зазвичай використовується для typeahead-доповнення згадок у постах у соціальних мережах.

**Підключений обліковий запис має бути LinkedIn company page для виконання пошуку.** Особисті облікові записи LinkedIn не можна використовувати для пошуку.

1. **Для згадок у постах**: При реалізації @mentions використовуйте цей endpoint з функціональністю typeahead.
2. **Пошук компаній**: Потрібна точна vanity name компанії.
3. **Пошук людей**: Почніть щонайменше з 3 символів імені для найкращих результатів.
4. **Rate limiting**: Цей endpoint дотримується стандартних обмежень API rate limits.

<Note>
  **Обмеження пошуку**

  <ul class="custom-bullets">
    <li>**Компанії**: Ви можете шукати будь-яку сторінку компанії LinkedIn</li>

    <li>
      **Люди**: Ви можете шукати лише людей, які є підписниками вашого облікового запису LinkedIn, і підключений обліковий запис Ayrshare має бути LinkedIn company page для виконання пошуку. Якщо у людини встановлено приватну видимість LinkedIn, її не буде знайдено в результатах пошуку.
    </li>
  </ul>
</Note>

## Параметри заголовків

<HeaderAPI />

## Параметри запиту (Query)

<ParamField query="search" type="string" required>
  Пошуковий запит для пошуку компаній або людей у LinkedIn.

  **Вимоги:**

  {" "}

  <ul class="custom-bullets">
    <li>Мінімальна довжина: 3 символи для людей і 1 символ для компаній.</li>
    <li>Максимальна довжина: 100 символів як для людей, так і для компаній.</li>
  </ul>

  **Поведінка пошуку:**

  <ul class="custom-bullets">
    <li>
      <strong>Для компаній</strong>: Використовуйте vanity name компанії (знаходиться в URL LinkedIn). Повертаються лише **точні збіги vanity name**.

      <ul class="custom-bullets">
        <li>
          Приклад: Для `linkedin.com/company/ayrshare` шукайте "ayrshare".
        </li>

        <li>
          Пошук за частковими іменами, як-от "ayrsh", НЕ поверне результатів.
        </li>
      </ul>
    </li>

    <li>
      <strong>Для людей</strong>: Використовуйте ім'я та/або прізвище. Часткові збіги імен підтримуються.

      <ul class="custom-bullets">
        <li>
          Приклад: "John Smith" знайде людей на ім'я John Smith. Обов'язково закодуйте пробіл у URL.
        </li>

        <li>
          Часткові збіги, як-от "Joh" або "Smi", також повертатимуть результати.
        </li>
      </ul>

      <ul class="custom-bullets">
        <li>
          Пам'ятайте: можна знайти лише ваших підписників LinkedIn, і підключений обліковий запис Ayrshare має бути LinkedIn company page для виконання пошуку
        </li>
      </ul>
    </li>
  </ul>
</ParamField>

<ParamField query="personOnly" type="boolean" default={false}>
  Контролює область пошуку: - `false` (за замовчуванням): Спочатку шукає компанії, потім людей, якщо компаній не знайдено. - `true`: Шукає лише людей (повністю пропускає пошук компаній).
</ParamField>

## Приклади

<RequestExample>
  ```bash Company Search theme={"system"}
  curl \
    -H "Authorization: Bearer API_KEY" \
    -X GET "https://api.ayrshare.com/api/brand/search/linkedin?search=ayrshare"
  ```

  ```bash Person Search Only theme={"system"}
  curl \
    -H "Authorization: Bearer API_KEY" \
    -X GET "https://api.ayrshare.com/api/brand/search/linkedin?search=John%20Smith&personOnly=true"
  ```

  ```javascript JavaScript theme={"system"}
  const API_KEY = "API_KEY";

  // Search for company or person
  fetch("https://api.ayrshare.com/api/brand/search/linkedin?search=ayrshare", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${API_KEY}`
    }
  })
    .then((res) => res.json())
    .then((json) => console.log(json))
    .catch(console.error);

  // Search for person only
  fetch("https://api.ayrshare.com/api/brand/search/linkedin?search=John%20Smith&personOnly=true", {
    method: "GET",
    headers: {
      Authorization: `Bearer ${API_KEY}`
    }
  })
    .then((res) => res.json())
    .then((json) => console.log(json))
    .catch(console.error);
  ```

  ```python Python theme={"system"}
  import requests

  headers = {'Authorization': 'Bearer API_KEY'}

  # Search for company or person
  r = requests.get('https://api.ayrshare.com/api/brand/search/linkedin?search=ayrshare', headers=headers)
  print(r.json())

  # Search for person only
  r = requests.get('https://api.ayrshare.com/api/brand/search/linkedin?search=john&personOnly=true', headers=headers)
  print(r.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Company Search Result theme={"system"}
  {
    "linkedin": [
      {
        "vanityName": "ayrshare",
        "website": "https://www.ayrshare.com",
        "groups": [],
        "description": "Ayrshare's APIs provide the core infrastructure for social media posting, management, and analytics.\n\nThe Ayrshare API takes care of the social media infrastructure so you don't have to. Your team can focus on building your product instead of stitching together and maintaining multiple social media platforms.\n\nPost to Facebook, Twitter, Instagram, LinkedIn, Reddit, Telegram, TikTok, Google My Business, and YouTube.\n",
        "defaultLocale": {
          "country": "US",
          "language": "en"
        },
        "organizationType": "PARTNERSHIP",
        "alternativeNames": [],
        "specialties": [
          "social media",
          "api",
          "saas",
          "social networks",
          "tiktok",
          "facebook",
          "instagram"
        ],
        "staffCountRange": "SIZE_10_TO_100",
        "name": "Ayrshare",
        "primaryOrganizationType": "NONE",
        "locations": [
          {
            "description": {
              "localized": {
                "en_US": "Headquarters"
              },
              "preferredLocale": {
                "country": "US",
                "language": "en"
              }
            },
            "locationType": "HEADQUARTERS",
            "address": {
              "geographicArea": "New York",
              "country": "US",
              "city": "New York",
              "line1": "142 W 57th St",
              "postalCode": "10019"
            },
            "localizedDescription": "Headquarters",
            "streetAddressFieldState": "UNSET_OPT_OUT",
            "geoLocation": "urn:li:geo:103963738"
          }
        ],
        "id": 66755333
      }
    ]
  }
  ```

  ```json Person Search Result theme={"system"}
  {
    "linkedin": [
      {
        "lastName": "Smith",
        "firstName": "John",
        "headline": "CTO at Ayrshare",
        "id": "urn:li:person:WBwF1C23L"
      }
    ]
  }
  ```

  ```json 400: Search query too short theme={"system"}
  {
    "linkedin": {
      "action": "request",
      "status": "error",
      "code": 101,
      "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
      "details": "The search must be a string between 3 and 100 characters."
    }
  }
  ```

  ```json 404: No results found theme={"system"}
  {
    "linkedin": []
  }
  ```
</ResponseExample>
