Skip to content
POST AI agent ready /v1/site/performance

Site Performance API - TTFB, Redirects & Compression Check

Fetches a URL and measures time-to-first-byte (TTFB), total response time, content encoding (gzip, brotli, or none), redirect count, redirect chain with each hop, HTTP status code, server header, and content metadata. Useful for performance monitoring, CI/CD gates, and debugging slow page loads.

Parameters

stringrequired

URL to measure performance for.

Code examples

curl -X POST https://api.botoi.com/v1/site/performance \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

When to use this API

Uptime monitoring dashboards

Poll this endpoint every minute for your production URLs. Track TTFB and total_time_ms over time. Alert when TTFB exceeds your SLA threshold or when status_code is not 200.

CI/CD performance gates

Call this endpoint after deploying to staging. Fail the pipeline if TTFB exceeds 500ms or if compression is disabled. Catch performance regressions before they reach production.

Redirect chain debugging

Pass a URL and inspect the redirect_chain array to see every hop, status code, and timing. Identify unnecessary redirects that add latency. Common culprits: HTTP-to-HTTPS, www-to-non-www, and trailing-slash redirects.

Frequently asked questions

What does TTFB measure?
Time-to-first-byte (TTFB) is the time in milliseconds between sending the HTTP request and receiving the first byte of the response. It includes DNS resolution, TCP connection, TLS handshake, and server processing time.
Does this execute JavaScript or render the page?
No. This endpoint measures the HTTP response, not client-side rendering. It times the server response and inspects headers. For JavaScript rendering performance, use a browser-based tool like Lighthouse.
Where is the request sent from?
Requests are sent from Cloudflare Workers edge nodes. The nearest Cloudflare data center handles the request, so TTFB reflects the latency between that edge node and the target server.
How many redirects does it follow?
The endpoint follows up to 10 redirects. Each redirect is recorded in the redirect_chain array with its URL, status code, and timing. If the chain exceeds 10 hops, the request fails with a redirect loop error.
Can I test authenticated pages?
No. The endpoint sends a standard GET request without cookies or authentication headers. It measures performance of publicly accessible pages only.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.