All API requests must include an API key in the request headers:
X-API-Key: your_api_keyAuthorization: Bearer your_api_keyYou can view and manage your API keys in User Center
Base URL: https://www.tkhao.vip/api
Response Format: JSON
Encoding: UTF-8
/goods
Get products list with pagination and filtering
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
integer | query | Optional | Product Group ID |
type |
integer | query | Optional | Product Type |
search |
string | query | Optional | Search Keywords |
per_page |
integer | query | Optional |
Items per page, max 100
Default Value: 15 |
page |
integer | query | Optional |
Page Number
Default Value: 1 |
{
"success": true,
"message": "Operation Successful",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"picture": "https:\/\/example.com\/picture.jpg",
"price": 99,
"sales_volume": "api.example_data.total_100",
"type": 1,
"type_name": "Specification Name",
"subs": [
{
"id": 1,
"name": "Specification Name",
"price": 99,
"stock": "api.example_data.total_100"
}
]
}
],
"total": "api.example_data.total_100",
"per_page": 15
}
}
curl -X GET "https://www.tkhao.vip/api/goods" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.tkhao.vip/api/goods");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: your_api_key",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
response = requests.get(
"https://www.tkhao.vip/api/goods",
headers=headers
)
fetch("https://www.tkhao.vip/api/goods", {
method: "GET",
headers: {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => );
/goods/{id}
Get detailed product information by product ID
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
id |
integer | path | Required | Product ID |
{
"success": true,
"message": "Operation Successful",
"data": {
"id": 1,
"name": "Product Name",
"description": "Product Description",
"detail": "Product Detail Content",
"usage_instructions": "Usage Instructions",
"picture": "https:\/\/example.com\/picture.jpg",
"price": 99,
"sales_volume": "api.example_data.total_100",
"type": 1,
"type_name": "Specification Name",
"require_login": false,
"subs": []
}
}
curl -X GET "https://www.tkhao.vip/api/goods/{id}" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.tkhao.vip/api/goods/{id}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: your_api_key",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
response = requests.get(
"https://www.tkhao.vip/api/goods/{id}",
headers=headers
)
fetch("https://www.tkhao.vip/api/goods/{id}", {
method: "GET",
headers: {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => );
/goods/{id}/stock
Get stock information for each product specification
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
id |
integer | path | Required | Product ID |
{
"success": true,
"message": "Operation Successful",
"data": {
"goods_id": 1,
"goods_name": "Product Name",
"subs": [
{
"sub_id": 1,
"sub_name": "Specification Name",
"stock": "api.example_data.total_100",
"price": 99
}
]
}
}
curl -X GET "https://www.tkhao.vip/api/goods/{id}/stock" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.tkhao.vip/api/goods/{id}/stock");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: your_api_key",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
response = requests.get(
"https://www.tkhao.vip/api/goods/{id}/stock",
headers=headers
)
fetch("https://www.tkhao.vip/api/goods/{id}/stock", {
method: "GET",
headers: {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => );
/balance
Get balance information for the current user
{
"success": true,
"message": "Operation Successful",
"data": {
"balance": 1000,
"total_spent": 5000,
"level_name": "Silver Member"
}
}
curl -X GET "https://www.tkhao.vip/api/balance" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.tkhao.vip/api/balance");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: your_api_key",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
response = requests.get(
"https://www.tkhao.vip/api/balance",
headers=headers
)
fetch("https://www.tkhao.vip/api/balance", {
method: "GET",
headers: {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => );
/purchase
Create an order and purchase a product
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
goods_id |
integer | query | Required | Product ID |
sub_id |
integer | query | Required | Product Specification ID |
quantity |
integer | query | Required |
Purchase Quantity
Minimum Value: 1 |
email |
string | query | Optional | Contact Email |
payway |
string | query | Required | Payment Method ID or "balance" (balance payment) |
search_pwd |
string | query | Optional | Search Password |
{
"success": true,
"message": "Order Created Successfully",
"data": {
"order_sn": "Order Number",
"status": 4,
"total_price": 99,
"actual_price": 94.05,
"balance_used": 0
}
}
curl -X POST "https://www.tkhao.vip/api/purchase" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.tkhao.vip/api/purchase");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: your_api_key",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
response = requests.post(
"https://www.tkhao.vip/api/purchase",
headers=headers
)
fetch("https://www.tkhao.vip/api/purchase", {
method: "POST",
headers: {
"X-API-Key": "your_api_key",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => );