Get a PageSpeed Insights API Key

Step-by-step guide to getting a free PageSpeed Insights API key from Google Cloud Console. Setup takes 2 minutes.
Harlan WiltonHarlan Wilton3 min read Published

Free API key setup in 2 minutes. No billing required for the free tier.

Steps

1. Open Google Cloud Console

Go to console.cloud.google.com

Sign in with any Google account. You don't need a paid Google Cloud account — the PSI API has a free tier.

2. Create or Select a Project

Click the project dropdown at the top of the page:

  • New users: Click "New Project", give it a name like "PSI Testing", and create
  • Existing users: Select an existing project or create a new one

3. Enable the PageSpeed Insights API

  1. Go to APIs & ServicesLibrary (or search "API Library" in the top search bar)
  2. Search for "PageSpeed Insights API"
  3. Click on it and press Enable

The API is now active for your project.

4. Create Credentials

  1. Go to APIs & ServicesCredentials
  2. Click Create CredentialsAPI Key
  3. Copy the key that appears

Your key is ready to use immediately.

Secure Your Key

API keys can be stolen and abused. Add restrictions.

For Server-Side Use

Restrict by IP address:

  1. Click on your API key in the Credentials list
  2. Under Application restrictions, select IP addresses
  3. Add your server's IP address(es)
  4. Save

For Client-Side Use

Restrict by HTTP referrer:

  1. Click on your API key in the Credentials list
  2. Under Application restrictions, select HTTP referrers
  3. Add your domain: yourdomain.com/*
  4. Save

API Restrictions

Limit the key to only the PSI API:

  1. Under API restrictions, select Restrict key
  2. Choose PageSpeed Insights API from the dropdown
  3. Save

Test Your Key

Verify it works with a curl request:

curl "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://example.com&key=YOUR_API_KEY"

A successful response returns JSON with Lighthouse data. An invalid key returns:

{
  "error": {
    "code": 400,
    "message": "API key not valid. Please pass a valid API key."
  }
}

Quotas

LimitValue
Requests per day25,000
Requests per 100 seconds400
Requests per 100 seconds per user60

Monitor usage at APIs & ServicesPageSpeed Insights APIQuotas.

The daily limit resets at midnight Pacific Time.

Next Steps

Skip the API Key Dance

Unlighthouse runs Lighthouse locally — no API keys, no quotas, no Google Cloud Console.

npx unlighthouse --site https://your-site.com
Try Unlighthouse