Powerful API to shorten URLs with no authentication required
Sub-100ms response times with our optimized infrastructure
Start using immediately without API keys or signups
99.9% uptime with automatic failover
Welcome to the URLsmush API documentation. This open API allows you to programmatically shorten long URLs without any authentication required.
All API endpoints return JSON responses. Simply send a POST request with your URL to get started.
Create a new short URL from a long URL. The response will include the shortened URL that you can share.
{ "url": "https://example.com/very/long/url/to/be/shortened" }
curl -X POST https://urlsmush.com/api.php \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/very/long/url/to/be/shortened" }'
fetch('https://urlsmush.com/api.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://example.com/very/long/url/to/be/shortened' }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
$url = 'https://urlsmush.com/api.php'; $data = ['url' => 'https://example.com/very/long/url/to/be/shortened']; $options = [ 'http' => [ 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data), ], ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); $response = json_decode($result, true); print_r($response);
import requests import json url = "https://urlsmush.com/api.php" payload = {"url": "https://example.com/very/long/url/to/be/shortened"} headers = {"Content-Type": "application/json"} response = requests.post(url, data=json.dumps(payload), headers=headers) print(response.json())
{ "status": "success", "message": "URL shortened successfully", "data": { "long_url": "https://example.com/very/long/url/to/be/shortened", "short_url": "https://urlsmush.com/abc123", "short_code": "abc123" } }
{ "status": "error", "message": "URL parameter is required", "data": null }
When a user visits your shortened URL, they will be automatically redirected to the original long URL.
Simply construct the URL with your 6-character code:
https://urlsmush.com/abc123
Visiting this URL will:
Redirects to the original URL with headers:
HTTP/1.1 301 Moved Permanently Location: https://example.com/very/long/url/to/be/shortened Cache-Control: max-age=31536000
HTTP/1.1 404 Not Found Content-Type: application/json { "status": "error", "message": "Short URL not found", "data": null }