U2M API reference

Factual U2M API reference for creating short URLs, reading supported statistics, and requesting QR codes.

Quick start

  1. Send a POST request to /shorten with a JSON body containing longUrl.
  2. Share the shortUrl returned by the API.
  3. Use statsUrl or /stats/{token} to inspect analytics.

POST /shorten

Create a short u2m.io link from a full http or https URL.

Request
{
  "longUrl": "https://example.com/long-url"
}
Response
{
  "shortUrl": "https://u2m.io/aB3kLm9p",
  "statsToken": "550e8400-e29b-41d4-a716-446655440000",
  "statsUrl": "https://u2m.io/stats/550e8400-e29b-41d4-a716-446655440000"
}

GET /stats/global

Return aggregate platform statistics and public leaderboards.

Response
{
  "totalUrls": 1200,
  "totalClicks": 8420,
  "botClicks": 210,
  "topCountries": [
    {
      "name": "United States",
      "count": 430
    }
  ],
  "topUrls": [
    {
      "shortCode": "aB3kLm9p",
      "destinationDomain": "example.com",
      "clickCount": 200
    }
  ]
}

GET /stats/{token}

Return private analytics for a URL when the stats token is known.

Response
{
  "totalClicks": 420,
  "countries": [
    {
      "name": "Germany",
      "count": 80
    }
  ],
  "browsers": [
    {
      "name": "Chrome",
      "count": 200
    }
  ]
}

GET /qr/{shortCode}

Return a PNG QR code for a short code.

Response
image/png

Related U2M resources