In this article, you will learn how to enable the Google URL Shortener API and obtain an API Key so that you can use the Google URL Shortener API throughout Intermediate JavaScript: Requests.

First, make sure you have a regular Google account. If you don't, you can create one here.

Make sure that you are logged into the Google account that you want to associate with your project if you have more than one.

Navigate to the Google Developers page and click "Sign In" in the upper right hand corner.

Then, navigate to the Developer Dashboard and click "Enable API."

In the field that says "Search all 100+ APIs", search for "URL Shortener" and select "URL Shortener API" (see below).

url shortener

You will then be redirected to a screen that says "A project is needed to enable APIs" Click "Create Project." You may have to click "Create" again.

Name your project whatever you wish. Then click "Create."

You'll be redirected to the search page again. Click "Enable" above the search bar. There will be another bar that says "To use this API, you may need credentials. Click "Create credentials" in the top right corner to get started."

create credentials

When you click "Create credentials", you will be redirected to the "Credentials" page.

For "Which API are you using," it should already say "URL Shortener API" but select that if it does not.

Then, under "Where will you be calling the API from," select "Web browser (Javascript)."

Then, select "Public data" under "What data will you be accessing?" Your entries should include the following:

what credentials

Click "What credentials do I need?" You should be redirected to a page that says "Add credentials to your project." It should give you an API Key. That api key will always be available in the credentials console.

Congratulations! You have enabled the Google URL Shortener API and obtained an API Key!