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/testResponse 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
- Schedule regular tests (daily or weekly)
- Store historical data for trend analysis
- Set up alerts for performance degradation
- Test from multiple locations
- 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