AutomationFebruary 20, 2026

GTmetrix API integration guide

The GTmetrix API allows you to automate performance testing and integrate speed metrics into your monitoring workflow.

Getting started

Sign up for a GTmetrix account and generate an API key from your account settings. The API uses HTTP Basic authentication with your API key.

Basic request

curl -u YOUR_API_KEY: \
  -X POST \
  -d "url=https://example.com" \
  https://gtmetrix.com/api/0.1/test

Response handling

The API returns a test ID immediately. Poll the test endpoint to check status and retrieve results when complete. Results include:

  • PageSpeed and YSlow scores
  • Page load time and size
  • Number of requests
  • Waterfall chart data
  • Recommendations

Automation tips

  1. Schedule regular tests (daily or weekly)
  2. Store historical data for trend analysis
  3. Set up alerts for performance degradation
  4. Test from multiple locations
  5. Compare mobile vs desktop performance

Integration patterns

  • Add to CI/CD pipelines for pre-deployment checks
  • Create dashboards for stakeholder visibility
  • Trigger alerts in Slack or email for threshold breaches
  • Track competitor performance alongside your own