REST API Documentation
Integrate Universal Link Shortener programmatically into your own applications.
Authentication
Every request to the API must include your unique API key. You can find or regenerate your API key in the admin panel or settings page. Pass it through one of the following methods:
Method 1
Authorization: Bearer YOUR_API_KEY
HTTP Request Header (Recommended)
Method 2
X-API-KEY: YOUR_API_KEY
Custom HTTP Header
Method 3
?api_key=YOUR_API_KEY
Query String Parameter
Retrieve a list of shortened links. Results are paginated.
Query Parameters
| Param | Type | Description |
|---|---|---|
| search | string | Filter links by title, slug, alias, or target URL. |
| page | integer | Page number to retrieve (default: 1). |
| limit | integer | Number of items per page (default: 10, max: 100). |
Response Example (200 OK)
{
"status": "success",
"data": {
"links": [
{
"id": 14,
"user_id": 2,
"original_url": "https://google.com",
"short_url": "Ab3KdQ",
"alias": "myproject",
"click_count": 4,
"is_active": 1,
"created_at": "2026-07-13 19:27:00"
}
],
"pagination": {
"total": 1,
"page": 1,
"limit": 10,
"pages": 1
}
}
}
Shorten a new long URL. Requires a JSON payload.
Request Body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| original_url | string | Yes | The destination URL (must start with http/https). |
| alias | string | No | Custom slug. Alphanumeric, dashes, and underscores only. |
| title | string | No | Link title note. |
| redirect_type | integer | No | 301, 302, or 307 (default: 301). |
Response Example (201 Created)
{
"status": "success",
"message": "Link shortened successfully",
"data": {
"id": 15,
"short_url": "https://l.pscl.co.th/Ab3KdQ",
"slug": "Ab3KdQ",
"alias": "",
"original_url": "https://google.com"
}
}
Update parameters of a shortened link. Requires a JSON payload.
Response Example (200 OK)
{
"status": "success",
"message": "Link updated successfully"
}
Delete a shortened link and its associated click records from the database.
Response Example (200 OK)
{
"status": "success",
"message": "Link deleted successfully"
}