API Documentation
Generate an API key from Admin → API Keys, then use it as shown below.
Authentication
Send your key using either method:
X-API-Key: your_api_key_here
or as a query parameter:
?api_key=your_api_key_here
1. Create a Short Link
POST
/api/shorten.php
Body (JSON)
{
"url": "https://example.com/very/long/link",
"alias": "my-custom-name" // optional
}
Example with cURL
curl -X POST "https://teraboxlinkshort.site/api/shorten.php" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/page"}'
Response
{
"success": true,
"short_code": "aZ9kLm",
"short_url": "https://teraboxlinkshort.site/aZ9kLm",
"original_url": "https://example.com/page"
}
2. Get Link Stats
GET
/api/stats.php?code=SHORT_CODE
Example
curl "https://teraboxlinkshort.site/api/stats.php?code=aZ9kLm" \
-H "X-API-Key: your_api_key_here"
Response
{
"success": true,
"short_code": "aZ9kLm",
"short_url": "https://teraboxlinkshort.site/aZ9kLm",
"original_url": "https://example.com/page",
"total_clicks": 42,
"is_active": true,
"created_at": "2026-07-01 10:00:00",
"by_country": [{"country": "Bangladesh", "clicks": 30}],
"by_browser": [{"browser": "Chrome", "clicks": 25}]
}
Errors
All errors return JSON with "success": false
and an "error" message,
alongside an appropriate HTTP status code.
401 Unauthorized
404 Not Found
409 Conflict
422 Invalid
405 Method Not Allowed