Utilities

URL Shortener

Create and resolve shortened URLs with optional custom codes. Powered by Valkey for high-speed storage with automatic expiration (30 days for Free tier, 365 days for paid plans). Includes click tracking and FNV hash-based auto-code generation.

Endpoint:/v1/url/shorten
Methods:GETPOST
Latency:~5ms

Try it out

POST/v1/url/shorten

Parameters

Code

curl
curl -X POST "https://khaleejiapi.dev/api/v1/url/shorten?url=https%3A%2F%2Fkhaleejiapi.dev%2Fdocs" \
-H "X-API-Key: your_api_key"

Methods

GET — Resolve Short URL

Resolve a shortened URL by its code. Pass code as a query parameter. Returns the original URL, creation date, expiry, and click count. Increments the click counter.

POST — Create Short URL

Create a new shortened URL. Send url (required) and optional code in the request body. If no custom code is provided, a 6-character FNV hash code is auto-generated.

POST Request Body

FieldTypeRequiredDescription
urlstringRequiredThe URL to shorten (must be a valid HTTP/HTTPS URL)
codestringOptionalCustom short code (3–20 alphanumeric chars)

GET Query Parameters

NameTypeRequiredDescription
codestringRequiredThe short URL code to resolve

Response Fields

shortUrl

Full shortened URL with domain

code

The short code (auto-generated or custom)

originalUrl

The original long URL

createdAt

ISO 8601 creation timestamp

expiresAt

ISO 8601 expiration timestamp

clicks

Total click/resolve count

Expiration

PlanLink LifetimeCustom Codes
Free30 daysNo
Starter180 daysYes
Professional365 daysYes
Business365 daysYes

Rate Limits

PlanRequests/MonthRate Limit
Free50010 req/min
Starter5,00030 req/min
Professional50,000120 req/min
Business250,000500 req/min