API Documentation

Integrate ShrtLnk into your app. Create cloaked short links with bridge-page previews via JSON or form POST.

Overview

Base URL: https://shrtnlnk.com

JSON endpoints accept Content-Type: application/json or application/x-www-form-urlencoded.

Method Path Purpose
POST /api/links Recommended — store a short link (no CSRF)
GET /api/links/{code} Get link details and click count
PATCH /api/links/{code} Update an existing short link
POST /shorten Web UI shorten (CSRF required from browser)
GET /s/{code} Bridge cloaking page, then destination
Link cloaking: Set url_cloak: 1 (default) for a bridge page with preview; set url_cloak: 0 for an instant 302 redirect to the destination.

Authentication

No API keys or tokens are required by default. If you expose the API publicly, protect /api/* at the firewall or API gateway level.

Response fields

Field Description
successtrue on success
idDatabase ID
short_urlFull shareable URL
short_codeCode used in /s/{code}
original_urlNormalized destination
redirect_modebridge or direct
url_cloak1 (bridge) or 0 (direct)
cloakedBoolean alias of url_cloak
page_titleBridge preview title
thumbnail_urlPreview image URL (nullable)
sourceWhere the link was created (web, api, or custom)
clicksVisit count
user_idOwner user ID (nullable)
updated_atLast update (ISO 8601)
existingtrue on create when link already existed
created_atISO 8601 timestamp

Errors

422 Validation failed or invalid URL

Validation error
{
  "message": "The original url field must be a valid URL.",
  "errors": {
    "original_url": ["The original url field must be a valid URL."]
  }
}
Business error
{
  "success": false,
  "message": "Invalid URL"
}

Behavior notes

URL normalization

  • Trims whitespace and adds https:// if missing
  • Lowercases hostname; removes trailing slash on path

Link preview

On create, the server may fetch Open Graph tags from the destination. Failures fall back to hostname as title with no thumbnail.

Deduplication

Same original_url, source, and cloak setting returns an existing link when scoped by user_id, user_agent, or the anonymous bucket.