Back to all APIs
URL Shortener
Shorten URLs with click analytics and custom domains
Category: UtilitiesEndpoint:
/v1/url/shortenAvg Response
<50ms
Uptime SLA
99.99%
Free Tier
1,000/mo
Quick Start
JavaScript / TypeScript
javascript
import { KhaleejiAPI } from '@khaleejiapi/sdk'; const client = new KhaleejiAPI('your_api_key'); // Create a short URLconst result = await client.utility.shortenURL({ url: 'https://example.com/very/long/path/to/page', code: 'mylink',}); console.log(result);// {// code: "mylink",// shortUrl: "https://khaleejiapi.dev/api/v1/url/mylink",// originalUrl: "https://example.com/very/long/path/to/page",// createdAt: "2025-01-15T10:30:00Z"// }Python
python
from khaleejiapi import KhaleejiAPI client = KhaleejiAPI('your_api_key') result = client.utility.shorten_url( url="https://example.com/very/long/path/to/page", code="mylink") print(result["shortUrl"])# "https://khaleejiapi.dev/api/v1/url/mylink"cURL
curl
curl -X POST "https://khaleejiapi.dev/api/v1/url/shorten" \ -H "x-api-key: your_api_key" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/very/long/path/to/page","code":"mylink"}'