Folders API
Organize your links into folders for better management.
Folders are a flat (non-nested) way to group related short links — for example by campaign, client, or channel. The Folders API lets you list, create, rename, and delete folders, and move individual links between them. Folder membership also powers the folderId filter on the Links API.
Deleting a folder never deletes its links — they are simply moved back to uncategorized. Each list response includes a linkCount so you can show folder sizes without a second request.
/api/v1/foldersList all folders with link counts.
links:readRequest
curl https://trimlink.co/api/v1/folders \
-H "Authorization: Bearer tk_live_your_api_key"Response
{
"success": true,
"folders": [
{
"id": "4d3c2b1a-9f8e-4d7c-8b6a-5e4f3d2c1b0a",
"name": "Marketing",
"linkCount": 24,
"createdAt": "2026-01-15T10:00:00Z"
},
{
"id": "8e7d6c5b-4a3f-4e2d-9c1b-0a9f8e7d6c5b",
"name": "Sales",
"linkCount": 12,
"createdAt": "2026-01-20T14:30:00Z"
}
]
}Folder Object Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique folder identifier (UUID). |
name | string | Folder display name. |
linkCount | number | Number of links currently in the folder. |
createdAt | string | ISO 8601 timestamp the folder was created. |
/api/v1/foldersCreate a new folder.
links:writeParameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Folder name (1-50 chars) |
Request
curl -X POST https://trimlink.co/api/v1/folders \
-H "Authorization: Bearer tk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Marketing Campaigns"}'Response
{
"success": true,
"folder": {
"id": "1f2e3d4c-5b6a-4798-8c9d-0e1f2a3b4c5d",
"name": "Marketing Campaigns",
"createdAt": "2026-01-31T12:00:00Z"
}
}/api/v1/folders/:idUpdate a folder name.
links:writeRequest
curl -X PATCH https://trimlink.co/api/v1/folders/1f2e3d4c-5b6a-4798-8c9d-0e1f2a3b4c5d \
-H "Authorization: Bearer tk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Campaigns 2026"}'Response
{
"success": true,
"folder": {
"id": "1f2e3d4c-5b6a-4798-8c9d-0e1f2a3b4c5d",
"name": "Campaigns 2026",
"updatedAt": "2026-01-31T14:00:00Z"
}
}/api/v1/folders/:idDelete a folder. Links in the folder are moved to uncategorized.
links:writeRequest
curl -X DELETE https://trimlink.co/api/v1/folders/1f2e3d4c-5b6a-4798-8c9d-0e1f2a3b4c5d \
-H "Authorization: Bearer tk_live_your_api_key"Response
/api/v1/links/:id/moveMove a link to a different folder.
links:writeParameters
| Name | Type | Description |
|---|---|---|
folderId | string | null | Target folder ID (null to remove) |
Request
curl -X PATCH https://trimlink.co/api/v1/links/9c8b7a6d-5e4f-4a3b-8291-0d1e2f3a4b5c/move \
-H "Authorization: Bearer tk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"folderId": "1f2e3d4c-5b6a-4798-8c9d-0e1f2a3b4c5d"}'Response
{
"success": true,
"data": {
"id": "9c8b7a6d-5e4f-4a3b-8291-0d1e2f3a4b5c",
"folderId": "1f2e3d4c-5b6a-4798-8c9d-0e1f2a3b4c5d"
}
}Errors
These endpoints use the standard error response format. Common folder-specific failures:
| Code | When it happens |
|---|---|
400 | Missing or out-of-range name (1–50 characters). |
403 | Key is missing the links:write scope. |
404 | The folder ID (or the link ID on a move) does not exist or belongs to another account. |
Usage Notes
- Folders are flat — there is no nesting. Model hierarchy in the folder name (e.g.
Q3 / Email) if you need it. - Pass
folderId: nullto the move endpoint to pull a link back out into uncategorized. - Deleting a folder is non-destructive to links; they are reassigned to uncategorized, not deleted.