GET
/
shorten

This API DOES NOT require authorization, which means using an anonymous account.

This API converts long URLs into short URLs.

If the same long URL has already been shortened in the same account, it will return the previously shortened URL.

Example #1: Shorten google.com

You can short google.com by request API URL: https://api.u301.com/v2/shorten?url=https://google.com, even if visit the URL directly in the browser.

Example #2: Specify Domain

We assume you have already added your own domain go.example.com, you can shorten your link by request API:

https://api.u301.com/v2/shorten?domain=go.example.com&url=https://google.com

Which specifies the domain in the query string, and that will override the default domain.

Example #3: Custom Alias

We’d like to create a shortened link u301.co/dashboard which point to u301 dashboard.
Request with a parameter slug:
https://api.u301.com/v2/shorten?url=https://u301.com/dashboard/&slug=dashboard

the returned result is

{
  "hostname": "u301.com",
  "url": "https://u301.com/dashboard/",
  "code": "cZ",
  "tally": 216,
  "status": "public",
  "slug": "dashboard",
  "urlPrefix": "https://u301.co",
  "domain": "u301.co",
  "shortened": "https://u301.co/dashboard"
}

You can see the link in field shortened is https://u301.co/dashboard 🎉

Query Parameters

url
string
required

The long URL to shorten. the URL MUST starts with a valid schema, such as http:// or https://

title
string

The title of the link

domain
string

Domain that you want to use for the short link.

slug
string

Custom alias for the short link, must be unique, only accept letter, number, underscore _ and hyphen -.

Response

200 - application/json
code
string
required

The short url code

url
string
required

The normalized original url

status
string

Status of the shortened url, it could be 'public', 'under_review' and 'blocked'

shortened
string

The shortened url