Url: insert

The url.insert method creates a new short URL. Try it now.

Authentication is optional for the url.insert method. If an authentication token with access to https://www.googleapis.com/auth/urlshortener is provided, the method creates a short URL for the authenticated user. The short URL created will appear in the authenticated user's list method results and on their dashboard at http://goo.gl/. If no authentication is provided, the short URL that the method creates is not associated with any particular account.

When creating a new short URL, you must supply a URL Resource as the message body. Note that for a new short URL, only the longUrl property is required.

This method requires one query parameter:

  • Your API key (using the key query parameter).

The returned resource contains the short URL and the long URL. Note that the returned long URL may be loosely canonicalized, e.g. to convert "google.com" into "http://google.com/".


HTTP Request

POST https://www.googleapis.com/urlshortener/v1/url?key={key}

Request Body

In the request body, supply an Url resource.


If successful, this method returns a response body with the following structure:

  "longUrl": value
Property Name Value Description Notes
longUrl string Long URL to be shortened, e.g. "http://www.google.com/".

Try It!

Use the explorer below to call this method on live data and see the response. Alternatively, try the standalone explorer.