API Docs
v1.0
Links API
Create, read, update, and delete short links.
POST
/api/v1/shortenCreate a new short link
Scope:
links:writeParameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Destination URL to shorten |
customCode | string | No | Custom short code (3-50 chars) |
title | string | No | Title for the link |
description | string | No | Description |
expiresAt | string | No | ISO 8601 expiration date |
folderId | string | No | Folder ID |
Request
curl -X POST https://trimlink.co/api/v1/shorten \
-H "Authorization: Bearer tk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/page",
"customCode": "my-link",
"title": "My Link"
}'Response
201Response
{
"success": true,
"data": {
"id": "clx123abc",
"shortCode": "my-link",
"shortUrl": "https://trimlink.co/my-link",
"destinationUrl": "https://example.com/page",
"createdAt": "2026-01-30T12:00:00Z"
}
}GET
/api/v1/linksList all links for the authenticated user
Scope:
links:readParameters
| Name | Type | Required | Description |
|---|---|---|---|
page | number | No | Page number (default: 1) |
limit | number | No | Items per page (max: 100) |
folderId | string | No | Filter by folder |
Request
curl "https://trimlink.co/api/v1/links?page=1&limit=20" \
-H "Authorization: Bearer tk_live_your_api_key"Response
200Response
{
"success": true,
"data": [
{
"id": "clx123abc",
"shortCode": "my-link",
"shortUrl": "https://trimlink.co/my-link",
"destinationUrl": "https://example.com/page",
"clicks": 142,
"createdAt": "2026-01-30T12:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 45
}
}GET
/api/v1/links/:idGet a single link by ID
Scope:
links:readRequest
curl https://trimlink.co/api/v1/links/clx123abc \
-H "Authorization: Bearer tk_live_your_api_key"Response
200Response
{
"success": true,
"data": {
"id": "clx123abc",
"shortCode": "my-link",
"shortUrl": "https://trimlink.co/my-link",
"destinationUrl": "https://example.com/page",
"title": "My Link",
"clicks": 142,
"createdAt": "2026-01-30T12:00:00Z"
}
}PATCH
/api/v1/links/:idUpdate link metadata
Scope:
links:writeParameters
| Name | Type | Required | Description |
|---|---|---|---|
title | string | No | New title |
description | string | No | New description |
expiresAt | string | No | Expiration date (null to remove) |
Request
curl -X PATCH https://trimlink.co/api/v1/links/clx123abc \
-H "Authorization: Bearer tk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Title",
"expiresAt": "2026-12-31T23:59:59Z"
}'Response
200Response
{
"success": true,
"data": {
"id": "clx123abc",
"shortCode": "my-link",
"title": "Updated Title",
"expiresAt": "2026-12-31T23:59:59Z",
"updatedAt": "2026-01-31T10:00:00Z"
}
}DELETE
/api/v1/links/:idDelete a link (soft delete)
Scope:
links:writeRequest
curl -X DELETE https://trimlink.co/api/v1/links/clx123abc \
-H "Authorization: Bearer tk_live_your_api_key"Response
204 No Content