HashTags API Endpoint: Automatically generate hashtags for posts based on the most relevant keywords. Takes into account real-time hashtag popularity.
Hashtag API Endpoints
Generate hashtags for Facebook, Instagram, LinkedIn, Pinterest, TikTok, XTwitter, and YouTube.
Premium or Business Plan required.
❗Click the › in the endpoint to view details.
Auto Hashtags
POSThttps://app.ayrshare.com/api/hashtags/auto
When creating your post, add relevant hashtags by either embedding them within the text or placing them at the end. Our advanced AI system will analyze your content to generate appropriate hashtags based on the subject matter. Although you can use any language for your post, writing in English typically yields the best results for our hashtag generation process.
Headers
Name
Type
Description
Authorization*
string
Format: Authorization: Bearer API _KEY. See Overview for more information.
Request Body
Name
Type
Description
post*
string
Post text to add the hashtags. Max length 1,000 characters.
position
string
Values: "auto" or "end". "end" hashtags at the end of the text, "auto" hashtags anywhere in the text or at the end. Default "auto".
max
number
Integer of max number of Hashtags to add. Max value range 1 to 10. Default 2.
language
string
Specify the language code of the language of the post to assist the hashtag algorithm.
{
"language": "fr"
}
{ post:"Disney’s trouble with Oswald the #LuckyRabbit is a great lesson #ForStartups in a crisis"}
Request Examples
curl \-H "Authorization: Bearer API_Key" \-d '{"post": "Today is a great day!", "max": 3, "position": "auto"}'-XPOSThttps://app.ayrshare.com/api/hashtags/auto
constAPI_KEY="API_KEY";fetch(`https://app.ayrshare.com/api/hashtags/auto`, { method:"POST", headers: {"Authorization":`Bearer ${API_KEY}` }, body:JSON.stringify({ post:"Today is a great day!",// required max:3,// optional, range 1-5 position:"auto"// optional, "auto" or "end" }) }).then((res) =>res.json()).then((json) =>console.log(json)).catch(console.error);
import requestspayload ={'post':'Today is a great day!','max':3,# optional, range 1-5'position':'auto'# optional, 'auto' or 'end'}headers ={'Content-Type':'application/json','Authorization':'Bearer API_KEY'}r = requests.post('https://app.ayrshare.com/api/hashtags/auto', json=payload, headers=headers)print(r.json())
<?phprequire 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client =newGuzzleHttp\Client();$res = $client->request('POST','https://app.ayrshare.com/api/hashtags/auto', ['headers'=> ['Content-Type'=>'application/json','Authorization'=>'Bearer API_KEY' ],'json'=> ['post'=>'Today is a great day!','max'=>3,'position'=>'auto' ] ]);echojson_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Get suggestions for hashtags based on a keyword. Data and view counts are generated from TikTok.
Query Parameters
Name
Type
Description
keyword*
string
A single keyword to get recommended hashtags from TikTok. Spaces in the keyword will be removed.
Headers
Name
Type
Description
Authorization*
string
Format: Authorization: Bearer API _KEY. See Overview for more information.
{"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" } ]}
{"action":"request","status":"error","code":101, "message": "Missing or incorrect parameters. Please verify with the docs. https://docs.ayrshare.com/rest-api/endpoints"
}
A banned hashtag checker to validate if the given hashtag has been banned by Instagram or other social networks.
Headers
Name
Value
Content-Type
application/json
Authorization
Bearer API_KEY
Query
Name
Type
Description
*
string
The hashtag to validate. Format: "hashtag" or "#hashtag"
Response
{"hashtag":"#bikinibody","banned":true}
{"action":"request","status":"error","code":101, "message": "Missing or incorrect parameters. Please verify with the docs. https://docs.ayrshare.com/rest-api/endpoints"
}
import requests# Your API keyAPI_KEY ="Bearer API_KEY"# Headersheaders ={"Authorization": API_KEY}# URLurl ="https://app.ayrshare.com/api/hashtags/banned?hashtag=%23bikinibody"# Making the GET requestresponse = requests.get(url, headers=headers)# Checking if the request was successfulif response.status_code ==200:# Parse JSON response result = response.json()print(result)else:print("Error:", response.status_code)
<?php// Your API key$apiKey ="Bearer API_KEY";// URL$url ="https://app.ayrshare.com/api/hashtags/banned?hashtag=%23bikinibody";// Initialize cURL session$ch =curl_init($url);// Set cURL optionscurl_setopt($ch, CURLOPT_RETURNTRANSFER,true);curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: $apiKey"]);// Execute cURL session$response =curl_exec($ch);// Check if any error occurredif(curl_errno($ch)) {echo'Curl error: '.curl_error($ch);} else {// Decode JSON response $result =json_decode($response,true);echoprint_r($result,true);}// Close cURL sessioncurl_close($ch);?>
usingSystem;usingSystem.Net.Http;usingSystem.Threading.Tasks;namespaceConsoleApp{classProgram {staticasyncTaskMain(string[] args) { // Your API keystring apiKey ="Bearer API_KEY"; // URLstring url ="https://app.ayrshare.com/api/hashtags/banned?hashtag=%23bikinibody";using (var httpClient =newHttpClient()) { // Set the Authorization header with your API keyhttpClient.DefaultRequestHeaders.Add("Authorization", apiKey);try { // Make the GET requestHttpResponseMessage response =awaithttpClient.GetAsync(url);if (response.IsSuccessStatusCode) { // Read the response content as a stringstring result =awaitresponse.Content.ReadAsStringAsync();Console.WriteLine(result); }else {Console.WriteLine($"Error: {response.StatusCode}"); } }catch (HttpRequestException e) {Console.WriteLine($"Request exception: {e.Message}"); } } } }}