URL Shortener API Documentation

Overview

This API allows you to create, retrieve, delete, and list shortened URLs. Certain operations require authentication via an API token.

Base URL

All API endpoints are relative to the following base URL:

https://taila.cz/s

Authentication

Endpoints that modify data (create, delete) or list all data require an authentication token.

Pass your token in the X-Auth-Token HTTP header with each authenticated request.

X-Auth-Token: YOUR_SECRET_TOKEN

Important: Keep your token secure and do not expose it publicly. Replace YOUR_SECRET_TOKEN with your actual token when making requests.

Requests without a valid token to protected endpoints will receive a 403 Forbidden response.

Endpoints

Create a Shortened URL

POST /shorten

Creates a shortened URL for a given long URL. You may optionally provide a custom alias. If no custom alias is provided, a random one is generated. If a provided custom alias already exists, the API returns a 400 error.

Authentication Required: Yes

Request Headers

Request Body

A JSON object containing the URL to shorten and an optional custom alias:

{
  "url": "https://example.com/this-is-a-very-long-url-that-needs-shortening",
  "custom_short_url": "my-custom-link"
}

Responses

Example (cURL)

curl -X POST https://taila.cz/s/shorten \
     -H "Content-Type: application/json" \
     -H "X-Auth-Token: YOUR_SECRET_TOKEN" \
     -d '{
       "url": "https://github.com/your-username/your-repo",
       "custom_short_url": "gh-repo"
     }'

Redirect to Long URL

GET /<short_alias>

Redirects the client (e.g., browser) to the original long URL associated with the provided short_alias.

Authentication Required: No

Parameters

Responses

Example (Browser)

Simply navigate to:

https://taila.cz/s/my-custom-link

Delete a Shortened URL

DELETE /delete/<short_alias>

Deletes the shortened URL record identified by the short_alias.

Authentication Required: Yes

Parameters

Request Headers

Responses

Example (cURL)

curl -X DELETE https://taila.cz/s/delete/my-custom-link \
     -H "X-Auth-Token: YOUR_SECRET_TOKEN"

List All Shortened URLs

GET /list

Retrieves a list of all currently stored short URL mappings.

Authentication Required: Yes

Request Headers

Responses

Example (cURL)

curl -X GET https://taila.cz/s/list \
     -H "X-Auth-Token: YOUR_SECRET_TOKEN"