Search for targeting hashtags
Use this endpoint to search for targeting hashtags based on seed keywords.
The returned hashtag (keyword_id) can be passed on to the action_category_ids field in /adgroup/create/ to target users who watched TikTok videos with the hashtag. You need to set action_scene to HASHTAG_RELATED simultaneously.
> Note
> We recommend that you use the Consolidated Interest and Behavior API (/targeting/search/) to search for or list targeting categories and hashtags for interests and behaviors. This API provides a consolidated and efficient approach to access the necessary targeting information.
Request
Endpoint
Authentication & shop
| Name | In | Type | Sample | Description |
|---|---|---|---|---|
| Authorization | header | header | Bearer q360_live_ab12cd34_… | Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand. |
| platform_shop_id | query | string | 7000000000000000001 | Tài sản TikTok Business đã kết nối — "Mã tài sản" ở trang Nền tảng hoặc GET /v1/platforms (tài khoản quảng cáo cho Marketing API, tài khoản TikTok cho Organic / Messaging). Có thể bỏ khi chỉ kết nối một tài sản. |
Request parameters
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| keywords | query | string[] | Yes | Keywords that you want to get recommended hashtags for.
If you specify multiple unrelated keywords and set operator to AND, it is possible that no recommended hashtags are returned.
Max size: 10. | |
| operator | query | string | No | The operator to be used between the keywords.
Enum values:
- AND: Recommended hashtags will be generated based on all the keywords specified in keywords.
- OR: Recommended hashtags will be generated separately for each individual keyword in keywords.
Default value: AND. |
Request examples
curl -s "https://partner.quantri360.com/v1/tiktok_business/tool/hashtag/recommend/?keywords=%5B%5D" \ -H "Authorization: Bearer $KEY"
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.get(
"https://partner.quantri360.com/v1/tiktok_business/tool/hashtag/recommend/",
params={
"keywords": []
},
headers={"Authorization": f"Bearer {KEY}"},
timeout=60,
)
print(r.status_code)
print(r.json())Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/tiktok_business/tool/hashtag/recommend/');
for (const [k, v] of Object.entries({"keywords":[]})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
method: 'GET',
headers: { Authorization: `Bearer ${KEY}` },
});
console.log(r.status, await r.json());PHP
<?php $key = 'q360_live_...'; // khóa API của brand $url = 'https://partner.quantri360.com/v1/tiktok_business/tool/hashtag/recommend/' . '?' . http_build_query(['keywords' => '[]']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]); $res = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status, "\n", $res;
Response
Response fields (as returned by TikTok Business)
| Name | Type | Sample | Description |
|---|---|---|---|
| code | number | Response code. For the complete list of error codes and descriptions, see Appendix - Return Codes. | |
| message | string | Response message. For details, see Appendix - Return Codes. | |
| request_id | string | The log ID of a request, which uniquely identifies the request. | |
| data | object | Returned data. | |
| recommend_keywords | object[] | Recommend hashtags. | |
| input_keyword | string | Returned only when `operator` is set to `OR` and more than one keyword is specified in `keywords` in the request. The specific keyword for which the recommended hashtag is generated. For instance, if the hashtag "#gametime" is recommended for the keyword "game", the returned `input_keyword` will be `"game"`, and `keyword` will be `"#gametime"`. | |
| keyword | string | Recommended hashtag. | |
| keyword_id | string | Hashtag keyword ID. It can be passed to the `action_category_ids` field when creating an ad group using /adgroup/create/. You need to set `action_scene` to `HASHTAG_RELATED` simultaneously to target users who watched TikTok videos with the hashtag. | |
| keyword_status | string | Keyword status. Enum values: `ONLINE` (available for use), `OFFLINE` (not available for use). |
Response sample
HTTPS/1.1 200 OK
{
"code": 0,
"message": "OK",
"request_id": "1234",
"data": {
"recommend_keywords": [
{
"keyword": "#gameroom",
"keyword_id": "3568527772311",
"keyword_status": "ONLINE"
},
{
"keyword": "#gametime",
"keyword_id": "3391154394694",
"keyword_status": "ONLINE"
}
]
}
}
(/code);
Get started
- Sign up for Partner
- Enable a data type of the Ads (Marketing API) group on the platform page
- Create an API key (tick the TikTok Business channel)
- Call it as in the examples above