Skip to main content

GET /[shortCode]

Resolve a short code and redirect to the original URL. This is the core redirect functionality that makes short links work.

Path Parameters

shortCode
string
required
The short code to resolve. Can be auto-generated (8 characters) or custom (1-20 characters).

Headers

The endpoint reads these headers for analytics tracking:
X-Forwarded-For
string
Client IP address for click tracking. First IP in comma-separated list is used.
X-Real-IP
string
Alternative client IP header (fallback if X-Forwarded-For is not present).
User-Agent
string
Browser/client information for analytics.
Referer
string
The referring page URL (also accepts Referrer spelling).

Response

On success, returns an HTTP 307 redirect to the original URL.
Location
header
The destination URL to redirect to.
Status
number
HTTP 307 (Temporary Redirect) - preserves request method and body.

Behavior

Error Responses

Examples

curl -L https://shrtnr.app/Xy9pQz1m
# Redirects to original URL

Success Response

307 Temporary Redirect
HTTP/1.1 307 Temporary Redirect
Location: https://example.com/original/long/url
Content-Length: 0

Error Response

404 Not Found
HTTP/1.1 404 Not Found
Content-Type: text/plain

Not found

Reserved Short Codes

The following short codes cannot be used and will always return 404:
  • api - API routes
  • shorten - Shortening interface
  • login - Authentication
  • register - User registration
  • dashboard - User dashboard
  • _next - Next.js internal routes
  • favicon.ico - Browser favicon requests
The endpoint uses HTTP 307 (Temporary Redirect) instead of 301 (Permanent) to preserve the HTTP method and allow analytics tracking on each visit.
Short codes are case-sensitive. MyLink, mylink, and MYLINK are three different short codes.

Performance

Build docs developers (and LLMs) love