Back to Docs

Link Management

Everything you need to create, organize, and manage links at scale.

Creating Links

Create a short link via the API or CLI. The only required field is the destination URL.

# API
POST /api/v1/links
{
  "url": "https://example.com/my-long-page"
}

# CLI
linksnap create https://example.com/my-long-page

Custom Slugs

Choose a memorable slug for your link. Slugs must be unique, URL-safe, and between 3-50 characters. If omitted, a random slug is generated.

POST /api/v1/links
{
  "url": "https://example.com/launch",
  "slug": "launch-2026"
}

# CLI
linksnap create https://example.com/launch --slug launch-2026

Expiry Dates

Set an expiration date after which the link stops redirecting and returns a 410 Gone response.

POST /api/v1/links
{
  "url": "https://example.com/sale",
  "slug": "flash-sale",
  "expiresAt": "2026-04-01T00:00:00Z"
}

Max Clicks

Limit the number of times a link can be clicked. After the limit is reached, the link expires automatically.

POST /api/v1/links
{
  "url": "https://example.com/exclusive",
  "maxClicks": 500
}

Tags

Organize links with tags. You can add multiple tags when creating or updating a link, then filter by tag when listing.

# Create with tags
POST /api/v1/links
{
  "url": "https://example.com",
  "tags": ["marketing", "q1-campaign"]
}

# Filter by tag
GET /api/v1/links?tag=marketing

Search & Filter

Find links using full-text search, tag filtering, status filtering, and sorting.

# Search by keyword
GET /api/v1/links?q=example

# Filter by tag and status
GET /api/v1/links?tag=marketing&status=active

# Sort by clicks descending
GET /api/v1/links?sort=clicks&order=desc

# Paginate with cursor
GET /api/v1/links?cursor=next_abc&limit=20

Bulk Operations

Perform actions on multiple links at once — archive, delete, or add/remove tags in bulk.

POST /api/v1/links/bulk
{
  "action": "archive",
  "ids": ["lnk_abc", "lnk_def", "lnk_ghi"]
}

POST /api/v1/links/bulk
{
  "action": "add_tag",
  "ids": ["lnk_abc", "lnk_def"],
  "tag": "archived-q1"
}

POST /api/v1/links/bulk
{
  "action": "delete",
  "ids": ["lnk_old1", "lnk_old2"]
}

Archive & Delete

Archive a link to stop it from redirecting while preserving its analytics. Delete permanently removes the link and all associated data.

# Archive (soft delete — keeps analytics)
PATCH /api/v1/links/:id
{ "status": "archived" }

# Restore
PATCH /api/v1/links/:id
{ "status": "active" }

# Permanent delete
DELETE /api/v1/links/:id