Shorten URLs, generate QR codes, and access click analytics programmatically.
Copy and run this curl command:
curl -X POST https://u2m.io/shorten \ -H "Content-Type: application/json" \ -d '{"longUrl": "https://example.com/my-page"}'
You'll get back a short URL and a stats token:
{
"shortUrl": "https://u2m.io/aB3kLm9p",
"statsToken": "abc123def456",
"statsUrl": "https://u2m.io/stats/abc123def456"
}Open the statsUrl in your browser to see click analytics, geographic data, and more.
statsToken — returned automatically when you shorten a URL. Keep your statsToken private to protect your analytics.
| Status | Meaning | When |
|---|---|---|
| 200 | OK | Request succeeded |
| 400 | Bad Request | Invalid URL, missing required field, or malformed JSON |
| 404 | Not Found | Short code does not exist |
| 429 | Too Many Requests | Rate limit exceeded (100 req/min per IP) |
| 500 | Internal Server Error | Unexpected server error |
{
"status": 400,
"error": "Bad Request",
"message": "Invalid URL format"
}Creates a short URL that redirects to the provided long URL. Optionally specify a custom short code and expiration date.
| Field | Type | Required | Description |
|---|---|---|---|
| longUrl | string | required | The URL to shorten |
| customCode | string | optional | Custom short code (4-20 alphanumeric chars) |
| expirationDate | string | optional | Expiration in ISO 8601 format (e.g. 2027-01-01T00:00:00) |
curl -X POST https://u2m.io/shorten \ -H "Content-Type: application/json" \ -d '{ "longUrl": "https://example.com/very/long/path", "customCode": "mylink" }'
{
"shortUrl": "https://u2m.io/mylink",
"statsToken": "abc123def456",
"statsUrl": "https://u2m.io/stats/abc123def456"
}A simpler alternative that accepts the URL as a query parameter. Useful for quick browser-based shortening.
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | required | The URL to shorten (URL-encoded) |
curl "https://u2m.io/shorten?url=https%3A%2F%2Fexample.com%2Flong-path"Shorten up to 100 URLs in a single request. Each URL is processed independently, so partial failures are possible.
curl -X POST https://u2m.io/shorten/bulk \ -H "Content-Type: application/json" \ -d '[ { "longUrl": "https://example.com/page-1" }, { "longUrl": "https://example.com/page-2", "customCode": "pg2" } ]'
[
{
"longUrl": "https://example.com/page-1",
"shortUrl": "https://u2m.io/aB3kLm9p",
"statsToken": "tok123",
"statsUrl": "https://u2m.io/stats/tok123",
"status": "success"
},
{
"longUrl": "https://example.com/page-2",
"shortUrl": "https://u2m.io/pg2",
"statsToken": "tok456",
"statsUrl": "https://u2m.io/stats/tok456",
"status": "success"
}
]Redirects the user to the original long URL. Each visit is counted as a click for analytics. Short codes are 4-20 alphanumeric characters.
curl -L https://u2m.io/mylink
# Redirects to: https://example.com/very/long/pathReturns the destination URL for a short code without triggering a redirect or recording a click.
{
"longUrl": "https://example.com/very/long/path",
"consecutiveFailures": 0,
"isDynamicDomain": false
}Returns the total number of clicks for a given short code.
curl https://u2m.io/analytics/mylink
42Generates a QR code image for the given short URL. Supports PNG and SVG output formats with configurable sizes.
| Parameter | Type | Default | Description |
|---|---|---|---|
| size | integer | 300 | Image dimensions in pixels (100-2048) |
| format | string | png | png or svg |
curl -o qr.png "https://u2m.io/qr/mylink?size=500&format=png"Returns aggregate statistics across all shortened URLs on the platform, including total URLs, total clicks, top countries, and most popular links.
{
"totalUrls": 15234,
"totalClicks": 892451,
"topCountries": [
{ "name": "United States", "count": 245000 },
{ "name": "Germany", "count": 89000 }
],
"topUrls": [
{
"shortCode": "aB3kLm9p",
"destinationDomain": "example.com",
"clickCount": 12500
}
]
}Returns detailed click analytics for a specific URL using its stats token (provided when the URL was shortened). Includes time series data, geographic breakdown, browser/device/OS distribution, and referrer sources.
| Parameter | Type | Default | Description |
|---|---|---|---|
| range | string | 7d | Time range for data (e.g. 7d, 30d, 90d) |
{
"totalClicks": 1250,
"clicksOverTime": [
{ "timestamp": "2026-03-01", "count": 45 },
{ "timestamp": "2026-03-02", "count": 62 }
],
"countries": [
{ "name": "Turkey", "count": 320 }
],
"browsers": [
{ "name": "Chrome", "count": 890 }
],
"devices": [
{ "name": "Desktop", "count": 750 }
],
"os": [
{ "name": "Windows", "count": 600 }
],
"referrers": [
{ "name": "twitter.com", "count": 200 }
]
}Returns the most recently shortened URLs across the platform. Useful for displaying a live activity feed.
[
{
"shortCode": "aB3kLm9p",
"destinationDomain": "example.com",
"createdAt": "2026-03-08T14:30:00"
}
]