> ## 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.

# Tìm kiếm LinkedIn

> Tìm kiếm các công ty hoặc người dùng 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} />

Tìm kiếm các công ty hoặc người dùng LinkedIn dựa trên truy vấn tìm kiếm.
Endpoint này thường được sử dụng để tự động hoàn thành đề cập (typeahead mention completion) trong các bài đăng mạng xã hội.

**Tài khoản đã liên kết phải là một LinkedIn company page để có thể tìm kiếm.** Các tài khoản LinkedIn cá nhân không thể được sử dụng để thực hiện tìm kiếm.

1. **Đối với đề cập trong bài đăng**: Khi triển khai @mentions, hãy sử dụng endpoint này với chức năng typeahead.
2. **Tìm kiếm công ty**: Cần có tên vanity chính xác của công ty.
3. **Tìm kiếm người**: Bắt đầu với ít nhất 3 ký tự của tên để có kết quả tốt nhất.
4. **Giới hạn tốc độ**: Endpoint này tuân theo các giới hạn tốc độ API tiêu chuẩn.

<Note>
  **Giới hạn Tìm kiếm**

  <ul class="custom-bullets">
    <li>**Công ty**: Bạn có thể tìm kiếm bất kỳ LinkedIn company page nào</li>

    <li>
      **Người**: Bạn chỉ có thể tìm kiếm những người là người theo dõi tài khoản LinkedIn của bạn và
      tài khoản Ayrshare đã liên kết phải là một LinkedIn company page để thực hiện tìm kiếm. Nếu một người
      đặt chế độ hiển thị LinkedIn của họ ở riêng tư, họ sẽ không được tìm thấy trong kết quả tìm kiếm.
    </li>
  </ul>
</Note>

## Tham số Header

<HeaderAPI />

## Tham số Query

<ParamField query="search" type="string" required>
  Truy vấn tìm kiếm để tìm các công ty hoặc người dùng LinkedIn.

  **Yêu cầu:**

  {" "}

  <ul class="custom-bullets">
    <li>Độ dài tối thiểu: 3 ký tự đối với người và 1 ký tự đối với công ty.</li>
    <li>Độ dài tối đa: 100 ký tự đối với cả người và công ty.</li>
  </ul>

  **Hành vi tìm kiếm:**

  <ul class="custom-bullets">
    <li>
      <strong>Đối với công ty</strong>: Sử dụng tên vanity của công ty (được tìm thấy trong URL LinkedIn). Chỉ **các kết quả khớp chính xác với tên vanity** mới được trả về.

      <ul class="custom-bullets">
        <li>
          Ví dụ: Với `linkedin.com/company/ayrshare`, hãy tìm kiếm "ayrshare".
        </li>

        <li>
          Tìm kiếm các tên một phần như "ayrsh" sẽ KHÔNG trả về kết quả.
        </li>
      </ul>
    </li>

    <li>
      <strong>Đối với người</strong>: Sử dụng tên và/hoặc họ. Hỗ trợ khớp một phần tên.

      <ul class="custom-bullets">
        <li>
          Ví dụ: "John Smith" sẽ tìm các người có tên là John Smith. Hãy nhớ mã hóa URL cho khoảng trắng.
        </li>

        <li>
          Các kết quả khớp một phần như "Joh" hoặc "Smi" cũng sẽ trả về kết quả.
        </li>
      </ul>

      <ul class="custom-bullets">
        <li>
          Lưu ý: Chỉ những người theo dõi LinkedIn của bạn mới có thể được tìm thấy và tài khoản Ayrshare đã liên kết phải là một LinkedIn company page để thực hiện tìm kiếm
        </li>
      </ul>
    </li>
  </ul>
</ParamField>

<ParamField query="personOnly" type="boolean" default={false}>
  Kiểm soát phạm vi tìm kiếm: - `false` (mặc định): Tìm kiếm công ty trước, sau đó tìm người nếu không
  tìm thấy công ty nào. - `true`: Chỉ tìm kiếm người (bỏ qua hoàn toàn tìm kiếm công ty).
</ParamField>

## Ví dụ

<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";

  // Tìm kiếm công ty hoặc người
  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);

  // Chỉ tìm kiếm người
  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'}

  # Tìm kiếm công ty hoặc người
  r = requests.get('https://api.ayrshare.com/api/brand/search/linkedin?search=ayrshare', headers=headers)
  print(r.json())

  # Chỉ tìm kiếm người
  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>
