GET /v1/tiktok_shop/categories
TikTok Shop categories API: the category tree of a market
Returns the stored TikTok Shop category tree of one market, with each category's id, name, level and children, sorted by name. Send region, and parent_id to get only the subtree under one category. Use the ids as category_id in the TikTok Shop product search API.
- Price
- Free
- Batch
- No
- Failed calls
- Not charged
Example request
curl
curl 'https://api.virev.ai/v1/tiktok_shop/categories?parent_id=601152' \
-H "Authorization: Bearer $VIREV_API_KEY"python
import os
import requests
response = requests.request(
"GET",
"https://api.virev.ai/v1/tiktok_shop/categories",
params={
"parent_id": "601152",
},
headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
timeout=60,
)
response.raise_for_status()
print(response.json())Parameters
| Name | In | Type | Description |
|---|---|---|---|
region | query | string | Market, ISO 3166 alpha-2 in upper case. |
parent_id | query | string | Return only the subtree under this category. |
Example response
The example response of the API reference.
json
{
"data": {
"region": "US",
"categories": [
{
"category_id": "601152",
"parent_id": null,
"level": 1,
"name": "Womenswear & Underwear",
"slug": "womenswear-underwear",
"is_leaf": false,
"children": [
{
"category_id": "842376",
"parent_id": "601152",
"level": 2,
"name": "Women's Bottoms",
"slug": "women-s-bottoms",
"is_leaf": false,
"children": [
{
"category_id": "601276",
"parent_id": "842376",
"level": 3,
"name": "Jeans",
"slug": "jeans",
"is_leaf": true,
"children": []
},
{
"category_id": "601274",
"parent_id": "842376",
"level": 3,
"name": "Leggings",
"slug": "leggings",
"is_leaf": true,
"children": []
}
]
},
{
"category_id": "842504",
"parent_id": "601152",
"level": 2,
"name": "Women's Dresses",
"slug": "women-s-dresses",
"is_leaf": false,
"children": [
{
"category_id": "961672",
"parent_id": "842504",
"level": 3,
"name": "Bridesmaid Dresses",
"slug": "bridesmaid-dresses",
"is_leaf": true,
"children": []
},
{
"category_id": "601281",
"parent_id": "842504",
"level": 3,
"name": "Casual Dresses",
"slug": "casual-dresses",
"is_leaf": true,
"children": []
}
]
}
]
}
]
},
"meta": {
"cost": "$0.0000",
"balance": "$9.9960",
"request_id": "req_8c5a38548a721ac86de7f4577332dd92"
}
}How it works
The stored category tree of a market, children sorted by name. With parent_id, only the subtree under that category. Reference data for the category_id filter, so it is free.
Errors
| Status | When |
|---|---|
400 | The request parameters are invalid. |
401 | Missing, malformed, or revoked API key. |
402 | Balance is too low for this request. |
404 | No stored category has this id in this market. |
429 | Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged. |
502 | The upstream fetch failed. You are not charged. |
503 | Billing could not be confirmed, so no upstream data was returned. |
504 | The upstream request timed out. You are not charged. |