Skip to main content

Analyze PageSpeed

curl -X GET "https://api.latentgeo.com/pagespeed/analyze?url=https://example.com&strategy=mobile" \
  -H "Authorization: Bearer YOUR_API_KEY"
Analyze page performance using Google PageSpeed Insights.

Query Parameters

url
string
required
URL to analyze for performance metrics
strategy
string
default:"mobile"
Analysis strategy: mobile or desktop

Response

Returns detailed performance metrics including Core Web Vitals and optimization suggestions.
lighthouseResult
object
Complete Lighthouse audit results
loadingExperience
object
Real-world loading experience data from Chrome User Experience Report
{
  "lighthouseResult": {
    "finalUrl": "https://example.com/",
    "categories": {
      "performance": {
        "score": 0.92,
        "title": "Performance"
      },
      "accessibility": {
        "score": 0.88,
        "title": "Accessibility"
      },
      "best-practices": {
        "score": 0.95,
        "title": "Best Practices"
      },
      "seo": {
        "score": 1.0,
        "title": "SEO"
      }
    },
    "audits": {
      "first-contentful-paint": {
        "score": 0.98,
        "displayValue": "0.8 s",
        "numericValue": 800
      },
      "largest-contentful-paint": {
        "score": 0.95,
        "displayValue": "1.2 s",
        "numericValue": 1200
      },
      "cumulative-layout-shift": {
        "score": 1.0,
        "displayValue": "0.02",
        "numericValue": 0.02
      }
    }
  },
  "loadingExperience": {
    "metrics": {
      "LARGEST_CONTENTFUL_PAINT_MS": {
        "percentile": 1450,
        "category": "FAST"
      },
      "CUMULATIVE_LAYOUT_SHIFT_SCORE": {
        "percentile": 0.05,
        "category": "FAST"
      },
      "INTERACTION_TO_NEXT_PAINT": {
        "percentile": 120,
        "category": "FAST"
      }
    },
    "overall_category": "FAST"
  }
}

Error Codes

401
error
Unauthorized - Invalid or missing authentication token
400
error
Bad Request - Invalid URL or strategy parameter
429
error
Too Many Requests - PageSpeed API rate limit exceeded
502
error
Bad Gateway - Google PageSpeed API error

Compare Strategies

curl -X GET "https://api.latentgeo.com/pagespeed/compare?url=https://example.com" \
  -H "Authorization: Bearer YOUR_API_KEY"
Compare page performance across mobile and desktop strategies.

Query Parameters

url
string
required
URL to analyze for both mobile and desktop

Response

Returns performance data for both mobile and desktop strategies.
mobile
object
Mobile performance analysis with the same structure as the analyze endpoint
desktop
object
Desktop performance analysis with the same structure as the analyze endpoint
{
  "mobile": {
    "lighthouseResult": {
      "finalUrl": "https://example.com/",
      "categories": {
        "performance": {
          "score": 0.85,
          "title": "Performance"
        }
      }
    },
    "loadingExperience": {
      "overall_category": "AVERAGE"
    }
  },
  "desktop": {
    "lighthouseResult": {
      "finalUrl": "https://example.com/",
      "categories": {
        "performance": {
          "score": 0.98,
          "title": "Performance"
        }
      }
    },
    "loadingExperience": {
      "overall_category": "FAST"
    }
  }
}

Error Codes

401
error
Unauthorized - Invalid or missing authentication token
400
error
Bad Request - Invalid URL parameter
429
error
Too Many Requests - PageSpeed API rate limit exceeded
502
error
Bad Gateway - Google PageSpeed API error

Build docs developers (and LLMs) love