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

# Recommend Hashtags

> Get suggestions for hashtags based on a keyword

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "basic") {
      displayPlans = ["Basic", "Premium", "Business", "Enterprise"];
    } else if (lowerCasePlan === "business") {
      displayPlans = ["Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "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={["premium"]} maxPackRequired={false} />

Get suggestions for hashtags based on a keyword. Data and view counts are generated from TikTok.

## Header Parameters

<HeaderAPI noProfileKey />

## Query Parameters

<ParamField query="keyword" type="string" required>
  A single keyword to get recommended hashtags from TikTok. Spaces in the keyword will be removed.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -X GET https://api.ayrshare.com/api/hashtags/recommend?keyword=apple
  ```

  ```javascript JavaScript theme={"system"}
  const API_KEY = "API_KEY";
  fetch("https://api.ayrshare.com/api/hashtags/recommend?keyword=apple", {
        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'}

  r = requests.get('https://api.ayrshare.com/api/hashtags/recommend?keyword=apple', headers=headers)

  print(r.json())
  ```

  ```php PHP theme={"system"}
  <?php
  require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html

  $client = new GuzzleHttp\Client();
  $res = $client->request(
      'GET',
      'https://api.ayrshare.com/api/hashtags/recommend?keyword=apple',
      [
          'headers' => [
              'Content-Type'      => 'application/json',
              'Authorization'     => 'Bearer API_KEY'
          ]
      ]
  );

  echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
  ```

  ```csharp C# theme={"system"}
  using System;
  using System.Net.Http;
  using System.Threading.Tasks;

  namespace HashtagsRecommendGETRequest_csharp
  {
      class HashtagsRecommend
      {
          static async Task Main(string[] args)
          {
              string API_KEY = "API_KEY";
              string url = "https://api.ayrshare.com/api/hashtags/recommend?keyword=apple";

              using (var client = new HttpClient())
              {
                  client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
                  
                  try
                  {
                      var response = await client.GetStringAsync(url);
                      Console.WriteLine(response);
                  }
                  catch (HttpRequestException ex)
                  {
                      Console.WriteLine($"Error: {ex.Message}");
                  }
              }
          }
      }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Success theme={"system"}
  {
      "keyword": "apple",
      "recommendations": [
          {
              "viewCount": 71950998550, // The number of views that the recommended hashtag has received.
              "name": "apple"           // Suggested hashtag
          },
          {
              "viewCount": 6318280101,
              "name": "applewatch"
          },
          {
              "viewCount": 2486358394,
              "name": "applepencil"
          },
          {
              "viewCount": 2142842131,
              "name": "applemusic"
          },
          {
              "viewCount": 1506224079,
              "name": "applesquad"
          },
          {
              "viewCount": 1307287255,
              "name": "apples"
          },
          {
              "viewCount": 1008293028,
              "name": "applepie"
          },
          {
              "viewCount": 788388838,
              "name": "applejuice"
          },
          {
              "viewCount": 1024901638,
              "name": "appletv"
          },
          {
              "viewCount": 679033194,
              "name": "applechallenge"
          }
      ]
  }
  ```

  ```json 400: Bad Request Missing keyword theme={"system"}
  {
    "action": "request",
    "status": "error",
    "code": 101,
    "message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
  }
  ```
</ResponseExample>
