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/shortenMethods:GETPOST
Latency:~5ms
Try it out
POST
/v1/url/shortenParameters
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
| Field | Type | Required | Description |
|---|---|---|---|
| url | string | Required | The URL to shorten (must be a valid HTTP/HTTPS URL) |
| code | string | Optional | Custom short code (3–20 alphanumeric chars) |
GET Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| code | string | Required | The 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
| Plan | Link Lifetime | Custom Codes |
|---|---|---|
| Free | 30 days | No |
| Starter | 180 days | Yes |
| Professional | 365 days | Yes |
| Business | 365 days | Yes |
Rate Limits
| Plan | Requests/Month | Rate Limit |
|---|---|---|
| Free | 500 | 10 req/min |
| Starter | 5,000 | 30 req/min |
| Professional | 50,000 | 120 req/min |
| Business | 250,000 | 500 req/min |